Comments (4)
Honestly I'm not sure what else we had in mind. Would have to look back at old notes.
Have you considered also making escape characters like \n its own token appearing as a children node in a string?
Probably would not parse it at that granularity unless there was a good reason for it.
from tolerant-php-parser.
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.
<?php "Hello $world";
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 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.
Cheers
from tolerant-php-parser.
Yes, I see. The current implementation seems to be in a good state :)
from tolerant-php-parser.
Thanks for taking a look though. I will close this unless there is a reason to reopen it.
from tolerant-php-parser.
Related Issues (20)
- Publish a 0.0.23 release? HOT 1
- Project motivation / VS Code / IDE support? HOT 7
- Publish a 0.0.25 release?
- Support php 8.1 intersection types, new token constants
- Spurious failure on nested conditionals without parentheses
- Single word namespaces which are reserved words produce an error incorrectly HOT 1
- `match` is not categorized as Keyword HOT 1
- Support parsing php 8.2 Disjunctive Normal Form types (`(A&B)|C`) HOT 1
- Support php 8.1 `never` return type, add to returnTypeDeclarationTokens
- Using `void` as a parameter/property type is a compilation error, not a parse error
- Publish a new release supporting php 8.2 syntax? HOT 10
- Idea: Start converting older tokenization to php 8.0 T_NAME_QUALIFIED/T_NAME_RELATIVE/T_NAME_FULLY_QUALIFIED
- Support `__halt_compiler` as a member of the top level statements
- PHP 8.2 would deprecate dynamic properties by default: Consider `#[\AllowDynamicProperties]`
- Regression with namespace names vs. MissingToken HOT 2
- match is a valid method name HOT 2
- EnumDeclaration does not support classInterfaceClause HOT 1
- Quoted string parsing doesn't work as expected
- Why is QualifiedName::getResolvedName disabled for Node\TraitUseClause? HOT 4
- Migrate Travis CI checks to GitHub workflows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tolerant-php-parser.