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
[vf] Multiple parser bug fixes #340
Conversation
@@ -70,7 +70,7 @@ PARSER_END(VfParser) | |||
| <#XMLNAME: (<ALPHA_CHAR> | "_" | ":") (<IDENTIFIER_CHAR>)* > | |||
| <#QUOTED_STRING_NO_BREAKS: ( "'" ( ~["'", "\r", "\n"] )* "'" ) | |||
| ( "\"" ( ~["\"", "\r", "\n"] )* "\"" ) > | |||
| <#QUOTED_STRING: ( "'" ( ~["'"] )* "'" ) | ( "\"" ( ~["\""] )* "\"" ) > | |||
| <#QUOTED_STRING: ( "'" ( ~["'"] )* "'" ) | ( "\"" ( ~["\""] | "\\\"" )* "\"" ) > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't you change ( "'" ( ~["'"] )* "'" )
to ( "'" ( ~["'"] | "\\'" )* "'" )
to allow strings with single quotes including escaped quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsotuyod This would be superfluous, VisualForce rewrites all double quotes in the source code into single quotes for the resulting page. Putting something like <abc ab=' \' '>abc</abc>
causes a compilation error and <abc ab=' \' >abc</abc>
does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, not what I expected, but if vf works that way...
All comments (both XML / HTML and EL) are currently part of the generated AST... this is usually not the case on grammars, moving them to special tokens which are ignored. Completely outside of this PR's scope, but is there any reason to not want it that way? |
You are absolutely right, I'm going to pull the new AST node and the other AST node. |
@sgorbaty awesome, make it on a different PR, I'll be merging this soon enough |
Oops. @jsotuyod, I just pushed it in. |
@sgorbaty lol! Don't worry, that was way faster than expected. |
Merged! Will be included in PMD 5.6.0 |
Fixing several VF parser bugs:
Added additional parser unit tests.