Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANTLR - mismatched input error #1602

Closed
ssdimmanuel opened this issue Jan 13, 2017 · 2 comments
Closed

ANTLR - mismatched input error #1602

ssdimmanuel opened this issue Jan 13, 2017 · 2 comments

Comments

@ssdimmanuel
Copy link

ssdimmanuel commented Jan 13, 2017

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:

//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND
/*
//SYSPRINT DD SYSOUT=*
//* Comment line #1
//* Comment line #2
//SYSOUT DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//* Comment line #3
//SYSUDUMP DD SYSOUT=A
When I use AntlrWorks to run this grammar with the input, I get the following error:

line 2:0 mismatched input 'SORT' expecting INLINEDATA
How can this error be resolved ?

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Jan 13, 2017 via email

@ssdimmanuel
Copy link
Author

Thanks Eric. Closing this issue and opened the same question in the google forum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants