I attached a simplified grammar file with the problem. If you run the interpreter in antlrworks 1.4.3 the following will give an error
int n:0..10 But the following won't give an error: int n:0 .. 10 // white space before and after .. Note that my definition of FLOAT does not conflict with the range operator: FLOAT : ('0'..'9')+ '.' ('0'..'9')+ EXPONENT? | ('0'..'9')+ EXPONENT ; Thanks. On Sun, Nov 13, 2011 at 3:09 AM, Christian <chw...@gmx.de> wrote: > Hello Jiwon, > > first, try to write a simple minimal grammar that represents your > usecase because I do not see anything that explains the behavior you > described. Maybe there are some other rules that influence the parsing. > > Tell us afterwards. > > Regards, > Christian > > Am 13.11.2011 10:31, schrieb Jiwon Seo: >> I'm trying to add range operator in my language, and I'm having a >> problem with it. >> >> The range operator is defined as following: >> >> range: INT '..' INT ; >> >> where INT is '0'..'9'+ >> >> I do have FLOAT, but it is defined such that it does not have conflict >> with the range operator: >> >> FLOAT: ('0'..'9')+'.'('0'..'9')+ EXPONENT? >> | ('0'..'9')+ EXPONENT >> ; >> >> The thing is, if I use the range operator with white spaces before & >> after the dots(such as 10 .. 100), it parses fine >> But without the white spaces(such as 10..100), it says >> 'MismatchedTokenException' . >> >> Can anyone see why it's acting like that? I do not use dot ('.') in >> any other places. >> >> I'm using antlrworks 1.4.3 for writing grammar and testing it >> (interpreter & debugger) >> >> Thanks. >> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest >> Unsubscribe: >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address >> > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address >
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
simple.g
Description: Binary data
-- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.