You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The representation of string literals is still a work-in-progress, and the implementation became even more inconsistent when we moved away from the handspun lexer towards PhpTokenizer. We should put some thought into how best to represent strings and template strings.
here in #11 and in #168 you talk about that strings and template strings are still not implemented perfectly. Can you iterate on what exactly is still missing or not working?
And it returns an instance of StringLiteral which is essentially a non-delimited list of whitespace/characters and expression nodes. That sounds good to me and seems to be flexible enough.
Have you considered also making escape characters like \n its own token appearing as a children node in a string? Could that be helpful? I know that this distinction is made in language grammars (syntax highlighting) at least.
Activity
PythooonUser commentedon Aug 7, 2020
Hey,
here in #11 and in #168 you talk about that strings and template strings are still not implemented perfectly. Can you iterate on what exactly is still missing or not working?
I had a look at the parse output of e.g.
Which gives
{ "SourceFileNode": { "statementList": [ [...] { "ExpressionStatement": { "expression": { "StringLiteral": { "startQuote": { "kind": "DoubleQuoteToken", "fullStart": 6, "start": 6, "length": 1 }, "children": [ { "kind": "EncapsedAndWhitespace", "fullStart": 7, "start": 7, "length": 6 }, { "Variable": { "dollar": null, "name": { "kind": "VariableName", "fullStart": 13, "start": 13, "length": 6 } } } ], "endQuote": { "kind": "DoubleQuoteToken", "fullStart": 19, "start": 19, "length": 1 } } }, "semicolon": { "kind": "SemicolonToken", "fullStart": 20, "start": 20, "length": 1 } } } ] [...] } }And it returns an instance of
StringLiteralwhich is essentially a non-delimited list of whitespace/characters and expression nodes. That sounds good to me and seems to be flexible enough.Have you considered also making escape characters like
\nits own token appearing as a children node in a string? Could that be helpful? I know that this distinction is made in language grammars (syntax highlighting) at least.Cheers
roblourens commentedon Aug 7, 2020
Honestly I'm not sure what else we had in mind. Would have to look back at old notes.
Probably would not parse it at that granularity unless there was a good reason for it.
PythooonUser commentedon Aug 7, 2020
Yes, I see. The current implementation seems to be in a good state :)
roblourens commentedon Aug 8, 2020
Thanks for taking a look though. I will close this unless there is a reason to reopen it.
Merge pull request microsoft#11 from phan/php83-override-and-static-i…