@exercism/lezer-php 0.0.0-stage → 1.0.0
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.
- package/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/index.cjs +375 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +371 -0
- package/package.json +47 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
## 1.0.0
|
|
2
|
+
|
|
3
|
+
This is Exercism's first release of the package, published as
|
|
4
|
+
`@exercism/lezer-php`. It parses `from` as a function or method name, `foreach`
|
|
5
|
+
by reference, and mixed-case `class` and `static`.
|
|
6
|
+
|
|
7
|
+
## 1.0.6 (2026-08-31)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Support `readonly` property parameters.
|
|
12
|
+
|
|
13
|
+
Allow attributes on property parameters.
|
|
14
|
+
|
|
15
|
+
## 1.0.5 (2025-09-23)
|
|
16
|
+
|
|
17
|
+
### Bug fixes
|
|
18
|
+
|
|
19
|
+
Make the package work with new TS resolution styles.
|
|
20
|
+
|
|
21
|
+
## 1.0.4 (2025-07-22)
|
|
22
|
+
|
|
23
|
+
### Bug fixes
|
|
24
|
+
|
|
25
|
+
Properly parse intersection types.
|
|
26
|
+
|
|
27
|
+
Allow using keywords as member names in `->` syntax.
|
|
28
|
+
|
|
29
|
+
Properly parse class property hooks.
|
|
30
|
+
|
|
31
|
+
Parse dynamic scoped member access (`::{...}`).
|
|
32
|
+
|
|
33
|
+
Properly parse `readonly` modifiers on properties and anonymous classes.
|
|
34
|
+
|
|
35
|
+
Allow names after namespace separators to be keywords.
|
|
36
|
+
|
|
37
|
+
## 1.0.3 (2025-07-07)
|
|
38
|
+
|
|
39
|
+
### Bug fixes
|
|
40
|
+
|
|
41
|
+
Allow const declarations in enum bodies.
|
|
42
|
+
|
|
43
|
+
## 1.0.2 (2023-12-28)
|
|
44
|
+
|
|
45
|
+
### Bug fixes
|
|
46
|
+
|
|
47
|
+
Tag comments and strings as isolating for the purpose of bidirectional text.
|
|
48
|
+
|
|
49
|
+
## 1.0.1 (2023-01-18)
|
|
50
|
+
|
|
51
|
+
### Bug fixes
|
|
52
|
+
|
|
53
|
+
Fix an issue where the grammar didn't handle less-than characters at the end of the document correctly.
|
|
54
|
+
|
|
55
|
+
Remove use of `require` as an identifier in the build output, which could break CommonJS builds.
|
|
56
|
+
|
|
57
|
+
## 1.0.0 (2022-06-06)
|
|
58
|
+
|
|
59
|
+
### New features
|
|
60
|
+
|
|
61
|
+
First stable version.
|
|
62
|
+
|
|
63
|
+
## 0.16.0 (2022-04-20)
|
|
64
|
+
|
|
65
|
+
### Breaking changes
|
|
66
|
+
|
|
67
|
+
Move to 0.16 serialized parser format.
|
|
68
|
+
|
|
69
|
+
### Bug fixes
|
|
70
|
+
|
|
71
|
+
Allow `class` to be an identifier in constructs like `A::class`. Add highlighting information
|
|
72
|
+
|
|
73
|
+
### New features
|
|
74
|
+
|
|
75
|
+
The parser now includes syntax highlighting information in its node types.
|
|
76
|
+
|
|
77
|
+
## 0.15.0 (2021-09-03)
|
|
78
|
+
|
|
79
|
+
### New features
|
|
80
|
+
|
|
81
|
+
First numbered release.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @exercism/lezer-php
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is Exercism's fork of `@lezer/php`, published as
|
|
4
|
+
`@exercism/lezer-php`. Our changes live on the `exercism` branch:
|
|
5
|
+
|
|
6
|
+
- `from` can be used as a function or method name.
|
|
7
|
+
- `foreach ($xs as &$x)` and `foreach ($xs as $k => &$x)` parse.
|
|
8
|
+
- `class` and `static` are case-insensitive, like every other keyword.
|
|
9
|
+
|
|
10
|
+
## Install and use
|
|
11
|
+
|
|
12
|
+
To install it, run:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm install @exercism/lezer-php
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The package exports a Lezer `parser`. To use the parser in CodeMirror, install `@exercism/codemirror-lang-php`, which wraps the parser. To parse code directly:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
import {parser} from "@exercism/lezer-php"
|
|
22
|
+
|
|
23
|
+
const tree = parser.parse("<?php echo 1;")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To build and test it from a checkout, run `npm install` (which also builds the parser), then `npm test`.
|
|
27
|
+
|
|
28
|
+
The upstream README follows.
|
|
29
|
+
|
|
30
|
+
## @lezer/php
|
|
31
|
+
|
|
32
|
+
This is a PHP grammar for the
|
|
33
|
+
[Lezer](https://lezer.codemirror.net/) parser system.
|
|
34
|
+
|
|
35
|
+
The grammar used is based in part on the corresponding [tree-sitter
|
|
36
|
+
grammar](https://github.com/tree-sitter/tree-sitter-php) and the [Zend
|
|
37
|
+
Yacc
|
|
38
|
+
grammar](https://github.com/php/php-src/src/branch/main/Zend/zend_language_parser.y).
|
|
39
|
+
|
|
40
|
+
The code is licensed under an MIT license.
|