No project description provided
Project description
pyPhpTree module
Module for Python 3. Tiny parser of PHP source code, which finds lines with class/function/namespace/trait declarations. It reads PHP code only inside <? ... ?> tags (any count of fragments in one file), and outside of /* ... */ and // ... comments, and outside of single/double-quoted strings (multi-line strings supported, escape backslash supported), and outside of heredoc/herenow blocks.
API
Function get_headers(filename, lines) finds all entities, in given “lines” list, and gets dicts:
{ 'line': int, # 0-based line index, where name found 'col': int, # 0-based position in line, where name found 'level': int, # 0-based level of item. each item of level K+1 # is nested into (nearest upper) item of level K 'name': str, # name of entity # empty for anonymous funcs 'kind': str, # "class", "function", "namespace", "trait" }
It’s generator (yield), so to get list, use list(get_headers(...)).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyphptree-1.0.3.tar.gz
.
File metadata
- Download URL: pyphptree-1.0.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fde22cb8fcba5631ebfaaf5607db9babeae482189375ffb5eeb1679970174254 |
|
MD5 | 4d4bcfa4f25bd812a5624d1ce2f32539 |
|
BLAKE2b-256 | 9105413deb711441dac205fd799b63b111790d88cc2e235306c5d98173d0a522 |