On Sun, Jun 6, 2010 at 8:16 PM, Loring Craymer <[email protected]> wrote: > Then you probably would want to handle this special case with a custom > subclass of ANTLRFileStream that checks to see if the first line begins with > 'C' and consumes the line (but not the newline following) if it does. (You > would also need to subclass CommonTokenStream if you need to keep that first > comment). This is not the most elegant solution, perhaps, but it provides > optimal performance at about the same implementation cost as any of the > alternatives. > > Lexer modes would be another way of handling this problem, but they are not > currently supported in ANTLR 3. For that matter, this would also not be a > problem if ANTLR lexer grammars were true context free grammars that > supported start symbols, but then you would have to deal with writing the top > level Tokens rule yourself--probably not a good trade.
Thanks for all the ideas. It sounds like for now I'm going to want to just hand-write my parser. The language in question really is dead simple, it's just line-orientation that seems to be complicating the picture so much. - Christian 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.
