Thomas Brandon wrote: > The problem is most likely your DecimalLiteral rule: > DecimalLiteral > : > ; > Non-fragment lexer rules that can match no input will cause infinite loops. > This may only occur for certain input as other input will be matched > before ANTLR checks whether the troublesome rule can match. Having > input that matches no other rule ensures such a rule will cause an > infinite loop. > > Tom. > I've made the DecimalLiteral a fragment, but I still see the same problem for the ::foo input. I've double checked and I don't seem to have any places where a lexer rule is empty now.
Anything else that can cause this? Cheers > On Thu, Apr 2, 2009 at 7:09 PM, Ola Bini <[email protected]> wrote: > >> Hi, >> >> I'm having some trouble with the lexer looping forever on input that >> should be possible to disambiguate in limited time. Not exactly sure why >> this happens. It is definitely possible I have done something stupid in >> my grammar, of course. >> >> I've seen eternal looping before, for some constructs. A typical example >> was the input of a single quote, before defining anything that allows a >> single quote. This behavior seems a bit strange, in my opinion, but I >> never figured out why it happened. >> >> The current problem is for input such as "::foo". (without the double >> quotes). >> >> The relevant productions (the only ones that include colon) look like this: >> fragment >> OperatorChar >> : >> '+' | '-' | '*' | '%' | '<' >> | '>' | '!' | '?' | '~' | '&' >> | '|' | '^' | '$' | '=' | '@' >> | '\'' | '`' | ':' >> ; >> >> Identifier >> : >> '[]' >> | '{}' >> | (OperatorChar | '/') (OperatorChar | '#' | '/')* >> | '#' (OperatorChar | '#')+ >> | '.' '.'+ >> | Letter (Letter|IDDigit|':'|'!'|'?'|'$')* >> | ':' (Letter|IDDigit) (Letter|IDDigit|':'|'!'|'?'|'$')* >> ; >> >> Where Identifier is part of the main production for the parser. >> >> The full grammar can be seen at: >> http://github.com/olabini/ioke/raw/9e2795c9c5f2b326c0cbb3dfb456f885b9625ba2/src/grammar/ioke.g >> >> >> Cheers >> >> -- >> Ola Bini (http://olabini.com) >> Ioke creator (http://ioke.org) >> JRuby Core Developer (http://jruby.org) >> Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) >> Practical JRuby on Rails (http://apress.com/book/view/9781590598818) >> >> "Yields falsehood when quined" yields falsehood when quined. >> >> >> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest >> Unsubscribe: >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address >> >> > > -- Ola Bini (http://olabini.com) Ioke creator (http://ioke.org) JRuby Core Developer (http://jruby.org) Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) Practical JRuby on Rails (http://apress.com/book/view/9781590598818) "Yields falsehood when quined" yields falsehood when quined. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
