I have a grammar which looks like this consisting of comment and control statements of a particular language:
Grammar:
grammar DD;
ddlist: (ddstmt| jclcomment)+;
ddstmt: dd1 | dd2 | dd3 | dd4 ;
dd1: JCLBEGIN ddname DDWORD 'DUMMY';
dd2: JCLBEGIN ddname DDWORD 'DYNAM';
dd3: JCLBEGIN ddname DDWORD NAME'=' (''|NAME);
dd4: JCLBEGIN ddname DDWORD '' inlinerec INLINESTMTEND?;
inlinerec: (INLINEDATA )+ ;
fragment INLINEDATA: (~[\r\n])*;
ddname: NAME;
jclcomment: JCLCOMMENT+;
JCLCOMMENT: COMMENTBEGIN ~[\r\n]*;
DDWORD: 'DD';
JCLBEGIN: '//' ;
COMMENTBEGIN: '//*' ;
INLINESTMTEND: '/*' ;
NAME : [A-Z#] (ALPHA | NUMBER | SPECIALCHARS)*;
NUMBER: [0-9];
ALPHA: [A-Z];
SPECIALCHARS: '#' | '@' | '$';
WS : [ \r\n] -> channel(HIDDEN);
My input is this:
line 2:0 mismatched input 'SORT' expecting INLINEDATA
How can this error be resolved ?
I have a grammar which looks like this consisting of comment and control statements of a particular language:
Grammar:
grammar DD;
ddlist: (ddstmt| jclcomment)+;
ddstmt: dd1 | dd2 | dd3 | dd4 ;
dd1: JCLBEGIN ddname DDWORD 'DUMMY';
dd2: JCLBEGIN ddname DDWORD 'DYNAM';
dd3: JCLBEGIN ddname DDWORD NAME'=' (''|NAME);
dd4: JCLBEGIN ddname DDWORD '' inlinerec INLINESTMTEND?;
inlinerec: (INLINEDATA )+ ;
fragment INLINEDATA: (~[\r\n])*;
ddname: NAME;
jclcomment: JCLCOMMENT+;
JCLCOMMENT: COMMENTBEGIN ~[\r\n]*;
DDWORD: 'DD';
JCLBEGIN: '//' ;
COMMENTBEGIN: '//' ;
INLINESTMTEND: '/' ;
NAME : [A-Z#] (ALPHA | NUMBER | SPECIALCHARS)*;
NUMBER: [0-9];
ALPHA: [A-Z];
SPECIALCHARS: '#' | '@' | '$';
WS : [ \r\n] -> channel(HIDDEN);
My input is this:
line 2:0 mismatched input 'SORT' expecting INLINEDATA
How can this error be resolved ?