简体   繁体   中英

Antlr error 100 in grammar

I am getting ANTLR3 error 100 over the grammar below on ANTLR works 1.5. However, when I compile this on eclipse Luna, it compiles successfully:

datatype returns [Type type=null]
@after{
   $type=$t.type;
}
   :
     t=datatype_item -> ^(DATATYPE  datatype_item)
   ;

This is a small portion of a grammar and I am getting loads of errors similar to this. I have DATAType defined as imaginary token and there are no multiline or document comments in the grammar. Error details are as:

[15:43:08] error(100): SQL.g:897:25: syntax error: antlr: NoViableAltException(96@[])
    [15:43:08] error(100): SQL.g:897:27: syntax error: antlr: NoViableAltException(94@[])
    [15:43:08] error(100): SQL.g:897:27: syntax error: antlr: MissingTokenException(inserted [@-1,0:0='<missing SEMI>',<82>,897:26] at DATATYPE)
    [15:43:08] error(100): SQL.g:897:37: syntax error: antlr: MissingTokenException(inserted [@-1,0:0='<missing COLON>',<22>,897:36] at datatype_item)
    [15:43:08] error(100): SQL.g:897:50: syntax error: antlr: NoViableAltException(78@[])

Can anyone help me over this.

通过在顶部添加选项来解决我的问题,并使解析器语法成为语法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM