Commit Graph

955 Commits

Author SHA1 Message Date
3d2a9e423a Update README 2023-12-10 00:43:30 +01:00
966682546c go mod tidy 2023-12-10 00:36:22 +01:00
65868e812d Move repository over to git.maride.cc 2023-12-09 22:25:24 +01:00
aa809cad77 Apply out-of-bounds fix from github.com/jeremybobbin/php-parser 2023-12-09 22:17:23 +01:00
Laytan Laats
59da1fe671 test: skip failing test for now 2023-07-24 20:38:20 +02:00
Pavel Selitskas
deeda4f6a7 scanner: emit T_STRING when enum not in enum declaration context 2023-07-24 20:34:39 +02:00
Tyler Christensen
87718f9993 php8.2: do not resolve reserved names {true, false, null} in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
e3aaf7bd13 php8.1: do not resolve reserved name never in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
9281143091 php8: do not resolve reserved name mixed in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
6855357aaa php8.1: resolve intersection types in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
3c45afd848 php8: resolve union types in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
5baa28bb27 php8: resolve attributes in NamespaceResolver 2023-07-18 15:32:28 +02:00
Tyler Christensen
6d1eee5a79 php8: resolve enums in NamespaceResolver 2023-07-18 15:32:28 +02:00
Laytan Laats
33d9423421 chore: release v0.10.0 2023-04-17 01:37:56 +02:00
Laytan Laats
9a4744a28d fix: start and end col not being set for names 2023-04-17 01:14:21 +02:00
Laytan Laats
307175c408 fix: typo using endcol as startcol 2023-04-17 00:06:24 +02:00
Laytan Laats
6b3673ece4 feat: expose the lexer to be used by users 2023-04-11 22:38:29 +02:00
Laytan Laats
f98b59a5f0 fix: print a newline after a doc comment, these are trimmed when parsing and cause the output to look bad 2023-04-10 02:18:02 +02:00
Laytan Laats
6a5a06a206 fix: add some boundary checks so the formatter panics less often 2023-04-10 02:17:36 +02:00
Laytan Laats
68ac672368 build: replace VKCOM import with laytan import 2023-03-31 16:50:08 +02:00
Laytan Laats
92d341cbb5 feat: generate ast.Type "enum" 2023-03-30 02:20:12 +02:00
Laytan Laats
b2e5aefaa7 chore: release v0.9.0 2023-03-26 03:13:26 +02:00
Laytan Laats
ec3527909c refactor: remove unused function 2023-03-26 01:54:21 +01:00
Laytan Laats
7c12f73974 feat: add start column and end column to position struct 2023-03-26 01:54:00 +01:00
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