Commit Graph

931 Commits

Author SHA1 Message Date
Laytan Laats
92019441d0 fix: use go:build tools instead of ignore so go mod tidy doesn't remove deps 2023-03-26 01:33:03 +01:00
Laytan Laats
25877adda4 feat: add enter and leave checks for traversers
- Improved performance (can short circuit/not continue when done)
- Backwards compatible because added interfaces
- Now generating the implementation for easier updates
2023-03-25 22:03:02 +01:00
Laytan Laats
b934f01c67 refactor: remove unused and confusing function implementations 2023-03-25 21:54:47 +01:00
Laytan Laats
3ba9118676 refactor: generate node functions instead of manual
Easier to update now, also more reliable (nothing to forget)
2023-03-25 21:53:52 +01:00
Laytan Laats
702cadceab feat: bump supported version range up to 8.2 2023-03-25 16:14:23 +01:00
Laytan Laats
375ccd136d test: add php8.2 constants in traits test 2023-03-25 16:11:37 +01:00
Laytan Laats
ce8b54eae1 test: add php8.2 true, null and false types test 2023-03-25 15:52:40 +01:00
Laytan Laats
66cc411e7c refactor: change makefile to reflect drop of php5 and run make 2023-03-25 15:29:51 +01:00
Laytan Laats
d820a72c72 style: simplify comparison 2023-03-25 15:16:54 +01:00
Laytan Laats
67058cb58c ci/style: add editorconfig and golangci config 2023-03-25 15:15:54 +01:00
Laytan Laats
6d6856b2a4 style: go mod tidy 2023-03-25 15:15:40 +01:00
Laytan Laats
8b15eadd15 style: go fmt 2023-03-25 15:15:30 +01:00
Laytan Laats
c4170d3955 refactor: move from deprecated io/ioutil package 2023-03-25 15:14:30 +01:00
Laytan Laats
226f7fb5f1 refactor: remove unused function lastNode 2023-03-25 15:12:21 +01:00
Laytan Laats
74a8771740 refactor: move php7 scanner into php7 package 2023-03-25 15:02:34 +01:00
Laytan Laats
a97686125d refactor!: drop php5 support 2023-03-25 15:00:17 +01:00
Laytan Laats
ffc94c1a63 refactor: move test.php into testdata folder 2023-03-25 14:32:14 +01:00
Laytan Laats
86c10ca380 perf: reduce memory usage by reducing amt of position's created
The positions created were taking GB's of memory and were not being
GC'ed.
2022-09-09 00:40:11 +02:00
i582
4f5cd69ae9 cleanup 2022-06-26 03:42:25 +03:00
Makhnev Petr
67faf89b39
changelog: added v0.8.2 (#30) 2022-06-26 03:40:01 +03:00
i582
2d99e3a9ec readme: updated supported PHP versions 2022-06-26 03:36:20 +03:00
Makhnev Petr
e16671724e
php8.1: added intersection types support (#29) 2022-06-26 03:31:29 +03:00
Makhnev Petr
7f6cd25376
php8.2: added readonly classes support (#26) 2022-06-26 01:18:40 +03:00
Tsygankov-Slava
3dd40d3b5a
readme: fixed cli flags (#25) 2022-06-25 20:09:48 +03:00
Makhnev Petr
8bfffab3ab
changelog: added v0.8.1-rc.1 (#23) 2021-08-09 15:26:26 +05:00
Makhnev Petr
d85f5a4816
php8: fixed a bug with # comments (#22)
Example from issue:
```php
<?php
#
# Comment
#

$a = 100;
```

The problem with the example from the issue is that `#` is immediately followed by a line break.
And since the rule in the lexer for such comments was changed, this case was handled incorrectly.

```
(('#' ^'[') | '//') any_line* when is_not_comment_end => {
   lex.ungetStr("?>")
   lex.addFreeFloatingToken(tkn, token.T_COMMENT, lex.ts, lex.te)
};
```

This rule has one problem, it checks two characters at once, first for the match `#`, and 
then for the mismatch `[`, which leads to the fact that in the case of an empty comment, the first 
matcher will capture `#`, and the second line break (`\n`), which will lead to the fact that `any_line` 
matcher will not work and will not increase the line number.

The next rule added is specifically for this case.

```
'#' newline when is_not_comment_end => {
    lex.ungetStr("?>")
    lex.addFreeFloatingToken(tkn, token.T_COMMENT, lex.ts, lex.te)
};
```
2021-08-02 12:37:08 +03:00
Ruud Kamphuis
d846011a9b
readme: handle parse errors in example (#20) 2021-08-01 22:00:01 +03:00
Makhnev Petr
18acbf96bd
CHANGELOG.md: initial (#19) 2021-08-01 16:44:50 +03:00
Makhnev Petr
50ed139750
php8.1: added first class callable syntax (#18) 2021-07-31 23:50:59 +03:00
Makhnev Petr
13ed0df282
php8.1: grammar improvements (#16)
Renamed 'possible_comma' with 'optional_comma' as in PHP-Parser
Replace all 'identifier' with 'identifier_ex' and all 'T_STRING' with 'identifier' as in PHP-Parser
2021-07-31 23:17:26 +03:00
Makhnev Petr
b256331d90
php8.1: added final modifier for constants in class (#15)
This case is already covered by the existing grammar, so no changes are required.
2021-07-31 22:20:36 +03:00
Makhnev Petr
689cca66c4
.github: setup GitHub related things (#13)
- Added Github Actions
- Replaced `ISSUE_TEMPLATE.md`
2021-07-31 20:01:44 +03:00
i582
7e821b874b Merge remote-tracking branch 'origin/master' 2021-07-31 19:45:42 +03:00
i582
85b5d3ef36 cmd: added file path output before errors 2021-07-31 19:45:26 +03:00
Makhnev Petr
af394e9eb0
php8.1: added enum (#12) 2021-07-31 19:44:09 +03:00
Makhnev Petr
44bbff6073
php8.1: added new octal numbers syntax (#10)
Also fixed a bug where `0X...` and `0B...` were not recognized as valid numbers.
2021-07-31 18:37:01 +03:00
Makhnev Petr
8df80651e0
php8.1: added never type (#8) 2021-07-31 18:06:46 +03:00
Makhnev Petr
8c35b0aef1
php8.1: added readonly modifier (#6) 2021-07-31 18:00:21 +03:00
Ruud Kamphuis
4d0bfa25aa
readme: use correct conf pkg instead of cfg for config (#4) 2021-07-31 13:19:33 +03:00
i582
2488ec3def cnd: default version has been changed to 8.0 2021-07-30 21:03:47 +03:00
Makhnev Petr
72cd222aeb
all: renamed github.com/z7zmey/php-parser with github.com/VKCOM/php-parser 2021-07-30 21:01:34 +03:00
Makhnev Petr
049ce7ddc6
PHP 8 (#1)
PHP 8 Update

- nullsafe operator (?->)
- Remove (real) cast
- Named arguments
- Remove (unset) cast
- Remove {} access
- match expression
- Union types in type hints and static typehint
- Block catch without variable
- Trailing comma in parameter lists
- throw can be used as an expression
- Concatenation precedence
- Declaring properties in the constructor
- Attributes
- Names in the namespace are treated as a single token
- Trailing comma in closure use list
- Check that ::class on object works
- Deferencable changes and arbitrary expressions in new/instanceof
2021-07-30 20:53:27 +03:00
Vadym Slizov
367eff9de6
rename package cfg to conf 2021-02-13 23:54:34 +02:00
Vadym Slizov
9d12f1d162
fix formatting 2021-02-13 23:51:08 +02:00
Vadym Slizov
29477c9552
[#122] compile php5 parser 2021-02-13 23:50:10 +02:00
Vadym Slizov
c8b7fc0786
[#122] compile php5 parser 2021-02-13 23:48:44 +02:00
Vadym Slizov
c3287f4721
Merge pull request #125 from z7zmey/issue-98
[#98] fix panic when heredoc is not closed
2021-02-13 23:10:27 +02:00
Vadym Slizov
e1686cb83c
[#98] fix panic when heredoc is not closed 2021-02-13 23:09:41 +02:00
Vadym Slizov
15e7237b45
Merge pull request #124 from z7zmey/issue-120
[#120] move dog.go from root folder
2021-02-13 22:18:29 +02:00
Vadym Slizov
cb29615397
[#120] update readme 2021-02-13 22:16:54 +02:00