-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor inconsistency with endFilePos of error nodes (in ClassConstFetch) #359
Comments
It's not really clear what attributes should be assigned to an The ClassConstFetch case has an additional problem, because the start offset is not correct. The Error should start at 22, but it starts at 15 (the start of the ClassConstFetch). |
I'm not familiar with the impact this has on the rest of the code or how hard this is to accomplish, of course, but it seems as if the error node should never be including a token that is not part of it at all, even if it were valid. Is it perhaps an option to make this error node take up no space whatsoever or, reduce its |
Empty error nodes implemented with 48ec654. Fingers crossed this doesn't regress anything else... |
Hello
I received the following example code from a user:
As you might have spotted, this file contains syntax errors. I'm parsing it with
php-parse -r -P
. This reports that theClassConstFetch
runs from offset15
through to22
. When I change it into:... the parser correctly reports the name node with name
t
, but then also goes on to report that theClassConstFetch
runs from offset15
to22
. In other words, thet
does not seem to have counted for any increase in offset with respect to its omission. When you changet
tots
, the end offset does increase to23
.I was wondering if this is intentional or maybe a bug? I'm selecting text at the location of the value of the
define
statement and always used a length ofendFilePos - startFilePos + 1
. This works correctly, but when there is an error node, the string then suddenly also includes the closing brace of the define statement, even though there is no actual name node present.Thanks in advance
The text was updated successfully, but these errors were encountered: