diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index cfca8cf9318b51372c624199f448ac401cbb965e..e0af47afc57497ed8812b0f811080208bd7b211d 100644 --- a/libwccl/parser/grammar.g +++ b/libwccl/parser/grammar.g @@ -911,7 +911,7 @@ options { exportVocab = ANTLRExpr; charVocabulary = '\3'..'\377'; testLiterals = false; - k = 3; + k = 2; } STRING @@ -1075,10 +1075,18 @@ options { paraphrase = "Multi line comment"; } : "/*" - ({ LA(2)!='/' }? '*' - | ('\r' '\n') => '\r' '\n' {newline();} - | '\r' {newline();} - | '\n' {newline();} + ( /* This actually works OK despite the ambiguity that + '\r' '\n' can be matched in one alternative or by matching + '\r' in one iteration and '\n' in another.. But + this is really matched just by one rule per (...)* + loop iteration, so it's OK. + This is exactly how they do it all over the web - just + turn off the warning for this particular token.*/ + options { generateAmbigWarnings=false; } + : { LA(2)!='/' }? '*' + | '\r' '\n' { newline(); } + | '\r' { newline(); } + | '\n' { newline(); } | ~('*'|'\n'|'\r') )* "*/"