Open jtejido opened 1 year ago
WS: [ \t\n] -> channel(HIDDEN);
+
-operator in the definition of ID. ID: Letter+ ;
not ID: Letter ;
fsm: 'fsm' ID EOF;
. If you do all three changes I listed before this fourth suggestion, and give fsm Test foobar
as input, the parse will succeed, but not fail on foobar
.Your grammar should looke like this:
grammar Fsm;
fsm : 'fsm' ID ;
ID: Letter+ ;
WS: [ \t\n] -> channel(HIDDEN);
fragment
Letter
: '\u0024' /* $ */ |
'\u0041'..'\u005a' /* A-Z */ |
'\u005f' /* _ */ |
'\u0061'..'\u007a' /* a-z */ |
'\u00c0'..'\u00d6' |
'\u00d8'..'\u00f6' |
'\u00f8'..'\u00ff' |
'\u0100'..'\u1fff' |
'\u3040'..'\u318f' |
'\u3300'..'\u337f' |
'\u3400'..'\u3d2d' |
'\u4e00'..'\u9fff' |
'\uf900'..'\ufaff'
;
Hi,
Just wanted to test something simple at first. I'd like to test a program that only start with the word 'fsm' and it out an error saying "<missing 'fsm'>"
the grammar to be tested:
The simple test is:
fsm Test