lphply 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lphply-2.0.0.dist-info/AUTHORS +14 -0
- lphply-2.0.0.dist-info/LICENSE +33 -0
- lphply-2.0.0.dist-info/METADATA +105 -0
- lphply-2.0.0.dist-info/RECORD +13 -0
- lphply-2.0.0.dist-info/WHEEL +5 -0
- lphply-2.0.0.dist-info/entry_points.txt +3 -0
- lphply-2.0.0.dist-info/top_level.txt +1 -0
- phply/__init__.py +2 -0
- phply/parsetab.py +561 -0
- phply/phpast.py +213 -0
- phply/phplex.py +636 -0
- phply/phpparse.py +2060 -0
- phply/pythonast.py +527 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
phply is written and maintained by Dave Benjamin and
|
|
2
|
+
various contributors:
|
|
3
|
+
|
|
4
|
+
Development Lead
|
|
5
|
+
````````````````
|
|
6
|
+
|
|
7
|
+
- Dave Benjamin <dave@ramenlabs.com>
|
|
8
|
+
|
|
9
|
+
Patches and Suggestions
|
|
10
|
+
```````````````````````
|
|
11
|
+
|
|
12
|
+
- Dan Colish
|
|
13
|
+
- Kevin J. Qiu
|
|
14
|
+
- Yoann Aubineau
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Copyright (c) 2010 by Dave Benjamin and contributors. See AUTHORS
|
|
2
|
+
for more details.
|
|
3
|
+
|
|
4
|
+
Some rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms of the software as well
|
|
7
|
+
as documentation, with or without modification, are permitted provided
|
|
8
|
+
that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above
|
|
14
|
+
copyright notice, this list of conditions and the following
|
|
15
|
+
disclaimer in the documentation and/or other materials provided
|
|
16
|
+
with the distribution.
|
|
17
|
+
|
|
18
|
+
* The names of the contributors may not be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
23
|
+
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
|
24
|
+
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
26
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
29
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
30
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
32
|
+
SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
33
|
+
DAMAGE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: lphply
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Lexer and parser for PHP source implemented using PLY
|
|
5
|
+
Author-email: Dave Benjamin <dave@ramenlabs.com>
|
|
6
|
+
Maintainer-email: Stanislaw Pitucha <viraptor@gmail.com>
|
|
7
|
+
License: BSD-3-Clause
|
|
8
|
+
Project-URL: Homepage, https://github.com/LoRexxar/Lphply
|
|
9
|
+
Project-URL: Repository, https://github.com/LoRexxar/Lphply
|
|
10
|
+
Project-URL: Issues, https://github.com/LoRexxar/Lphply/issues
|
|
11
|
+
Keywords: php,parser,lexer,ast,ply
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: PHP
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
26
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
License-File: AUTHORS
|
|
31
|
+
Requires-Dist: ply
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest; extra == "test"
|
|
34
|
+
|
|
35
|
+
# phply
|
|
36
|
+
|
|
37
|
+
Lexer and parser for PHP source code implemented in Python using [PLY](https://github.com/dabeaz/ply) (Python Lex-Yacc).
|
|
38
|
+
|
|
39
|
+
Supports PHP **5.6 through 8.5** syntax.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install lphply
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> **注意:** 由于 `lphply` 的内部包名仍为 `phply`,与上游 `viraptor/phply` 的 PyPI 包冲突。如果之前安装过 `phply`,请先卸载:`pip uninstall phply && pip install lphply`。
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
### Lexer
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from phply.phplex import lexer
|
|
55
|
+
|
|
56
|
+
lexer.input('<?php echo "Hello, World!"; ?>')
|
|
57
|
+
for token in lexer:
|
|
58
|
+
print(token)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Parser
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from phply.phplex import lexer
|
|
65
|
+
from phply.phpparse import make_parser
|
|
66
|
+
|
|
67
|
+
parser = make_parser()
|
|
68
|
+
with open('example.php', 'r') as f:
|
|
69
|
+
code = f.read()
|
|
70
|
+
result = parser.parse(code, lexer=lexer)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Command-line tools
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Parse a PHP file
|
|
77
|
+
phpparse file.php
|
|
78
|
+
|
|
79
|
+
# Lex a PHP file
|
|
80
|
+
phplex file.php
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
Clone the repository and install in development mode:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/LoRexxar/Lphply.git
|
|
89
|
+
cd Lphply
|
|
90
|
+
pip install -e ".[test]"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Running tests
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pytest
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
BSD-3-Clause. See [LICENSE](LICENSE) for details.
|
|
102
|
+
|
|
103
|
+
## Credits
|
|
104
|
+
|
|
105
|
+
Fork of [viraptor/phply](https://github.com/viraptor/phply), originally by Dave Benjamin.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
phply/__init__.py,sha256=41y0l1_rGePCXF9Hzgm1I79PHhhw0xJMaLltvYPfr8k,38
|
|
2
|
+
phply/parsetab.py,sha256=TINO-VGoUU98XqIoWsAzT8NVmOxP9_IP3aHqKOkbNdA,433668
|
|
3
|
+
phply/phpast.py,sha256=cJOTgwGAb1ENlQYqwbG0Js3V8nSPxWXA1uiMcmPwzC8,9217
|
|
4
|
+
phply/phplex.py,sha256=l2WJ3Eq30w5Qzr9pLySSahqA8pn6RZBI4kLzAcErnAs,16428
|
|
5
|
+
phply/phpparse.py,sha256=SidxIDOUXQvkc-9lj3uDlQHDxyLay2MkdJztLFZdblI,72800
|
|
6
|
+
phply/pythonast.py,sha256=mKR4bdvejWu5_DV841fYDRF0cW_8IUzk0elZOQg1HMY,21787
|
|
7
|
+
lphply-2.0.0.dist-info/AUTHORS,sha256=Ys6BKEJuqsywGQQ6blVD3_ybap07xCCPnKq72TYsix4,243
|
|
8
|
+
lphply-2.0.0.dist-info/LICENSE,sha256=67BhgCK77_LyrqB8TIOi3B31Fr_Y9DEDVYuYfxlf3zc,1581
|
|
9
|
+
lphply-2.0.0.dist-info/METADATA,sha256=mLlR0w6xffidgPO1mAShJsVVd_T2ETPJM98xzmiRaSs,2649
|
|
10
|
+
lphply-2.0.0.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
11
|
+
lphply-2.0.0.dist-info/entry_points.txt,sha256=crZKolQPfmpPQNI1LinUts6Peem6XVvZ45e5Fglf6hc,84
|
|
12
|
+
lphply-2.0.0.dist-info/top_level.txt,sha256=FOfWyLnR3glqY5lY27-ZKZgWPBPRcj7OwqQMNzL62aI,6
|
|
13
|
+
lphply-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phply
|
phply/__init__.py
ADDED