Terence Parr schrieb: > On May 2, 2008, at 2:00 PM, Johannes Luber wrote: >> Do I understand this correctly? If you currently call from within a >> lexer rule another lexer rule, then all attributes from the called >> rule are transferred to the calling rule. > > Well, unfortunately, setting the token type is "local" to the rule, > but all other things such as channel are set globally. so, there is > the inconsistency issue. We need to make it one way or the other.
That I agree with. >> If you fix it then called rules don't do this anymore, but you have >> to do it in the calling rule... Hmm. That would concentrate all >> behaviour into one place and makes sense from a pure design point of >> view, although I have no idea if that works only in theory. This >> does confuse me at one point: >> >> X : ID WS? '=' ID ; >> >> If ID and WS aren't fragment rules, do they generate tokens? > > no. they only recognize the input. > >> Or those tokens somehow subsumed into the X token? How does the >> order of rules change the lexing behaviour? > > It's just a recognition issue. Changing the rule order simply changes > which text is recognized first. Tokens are only created from the > outermost rule invocation unless you call emit(). What do you need fragment rules then for? Otherwise, I'd accept this proposal. Johannes _______________________________________________ antlr-dev mailing list [email protected] http://www.antlr.org:8080/mailman/listinfo/antlr-dev
