Conversation
aryx
left a comment
There was a problem hiding this comment.
Please add some tests in corpus/ and regenerate the parser.c and other files
grammar.js
Outdated
| )), | ||
| // accept statements at top-level to enable | ||
| // parsing of partial code snippets (e.g, in markdown; see #168). | ||
| optional(repeat($._statement)), |
There was a problem hiding this comment.
I'm not sure the statement will actually be parsed because of the optional($.text) at the top that may "eat" every tokens.
There was a problem hiding this comment.
Hmmm...you're right, I tried moving this line to the top of the program but the text still swallows everything up (see failing test)
There was a problem hiding this comment.
This is more complicated than I originally thought....do you have any idea on how to allow top-level statement parsing for injected code snippets while still allowing HTML?
There was a problem hiding this comment.
Might need to create another parser that only parses PHP, say phpo (for php-only), similar to the markdown and markdown-inline parsers.
acb0f7c to
2ed6877
Compare
2ed6877 to
8def205
Compare
|
Closing as accepting top level statements is not possible with this parser in its current state: the As mentioned in the above comment, the solution is probably to create two separate parsers in this repo (similar to the markdown parser), one which is |
Closes #168
Checklist: