Hello,
I've got a given string something like this:
"syntax = 'proto2';option l = 0.9;"
However, the lexer/parser are failing to match correctly:
"syntax='proto2';optionl=0<missing ';'>.9;"
The error appears to be reported here (not sure how I identify that at the moment via the parser elements, contexts, etc):
"syntax='proto2';optionl=0<missing ';'>.9;"
digits: DIG DIG*; // Could this instead be DIG+ ?
exponent: E SIGN? digits;
/*
floatLit = ( decimals "." [ decimals ] [ exponent ] | decimals exponent | "."decimals [ exponent ] ) | "inf" | "nan"
decimals = decimalDigit { decimalDigit }
exponent = ( "e" | "E" ) [ "+" | "-" ] decimals
Also, technically the spec does not differentiate + from - Infinity, but we can here.
*/
floatLit
: INF
| NAN
| ( '.' digits exponent? )
| ( digits '.' digits? exponent? )
| ( digits exponent )
;
With the Constant rule eventually rolling all that up:
/*
constant = fullIdent | ( [ "-" | "+" ] intLit ) | ( [ "-" | "+" ] floatLit ) |
strLit | boolLit
*/
constant
: boolLit
| quotedStrLit
| SIGN? floatLit
| SIGN? intLit
| fullIdent
;
And the lexer rules:
INF: 'inf';
DIG: [0-9];
Does the '.' (dot) really need a formal lexer rule?
Best regards,
Michael W Powell