AntlrVSIX icon indicating copy to clipboard operation
AntlrVSIX copied to clipboard

Code in comments may not be skipped

Open SimonSntPeter opened this issue 3 years ago • 0 comments

This is minor but a pain. If I have some antlr4 rule and an embedded action, if I comment out the rule extraction it doesn't work properly:

select_statement returns [SelectStatement ss] : // sns = opt_set_name_scaffold <<< here wctec = opt_with_CTEs_clause qe = query_expression obc = opt_order_by_clause { // var sns = $sns.ns; <<< and here

Compile this and I get

"unknown attribute reference sns in $sns.ns"

To force the "$sns.ns" to be ignored, even though it's already in a comment so should never be processed, I add a space after the $, thus

// var sns = $ sns.ns; << space after $ sign

then it correctly starts to ignore it.

Expected behaviour: should ignore stuff in comments.

(markdown buttons not working, so above is plain text, sorry)

SimonSntPeter avatar May 26 '21 08:05 SimonSntPeter