Search Results

Search found 1 results on 1 pages for 'user1646481'.

Page 1/1 | 1 

  • Antlr MismatchedSetException During Interpretation

    - by user1646481
    I am new to Antlr and I have defined a basic grammar using Antlr 3. The grammar compiles and ANTLRWorks generates the Parser and Lexer code without any problems. The grammar can be seen below: grammar i; @header { package i; } module : 'Module1'| 'Module2'; object : 'I'; objectType : 'Name'; filters : EMPTY | 'WHERE' module; table : module object objectType; STRING : ('a'..'z'|'A'..'Z')+; EMPTY : ' '; The problem is that when I interpret the table Parser I get a MismatchedSetException. This is due to having the EMPTY. As soon as I remove EMPTY from the grammar, the interpretation works. I have looked on the Antlr website and some other examples and the Empty space is ' '. I am not sure what to do. I need this EMPTY. As soon as I change the EMPTY to be the following: EMPTY : ''; instead of: EMPTY : ' '; It actually interprets it. However, I am getting the following Exception: Interpreting... [10:57:23] problem matching token at 1:4 NoViableAltException(' '@[1:1: Tokens : ( T__4 | T__5 | T__6 | T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 );]) [10:57:23] problem matching token at 1:9 NoViableAltException(' '@[1:1: Tokens : ( T__4 | T__5 | T__6 | T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 );]) When I take out the EMPTY, there are no problems at all. I hope you can help.

    Read the article

1