[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FWD: [H-e-l-p] with accessing ignoredTokens]

> Gary Montgomery wrote:
>      Hmmm. I played around with this last night. For everynode
>      passed in I get a null return from
>      Parser.ignoredTokens.getIn().

This is because you do it in defaultIn() and/or defaultOut.  Now these
two methods are only called for Axxx nodes (alternatives).  As you know,
ignored tokens are attached to the next Txxx node (token).  So, you
should do as Thomas suggested and put your code in defaultCase() which
is only called for Txxx nodes.

I know it isn't obvious from the method names, but a quick look at the
source code of DepthFirstAdapter will show you why things work that
way.  Maybe we should change the names to defaultAIn(), defaultAOut()
and put a call to something like defaultToken() in  defaultCase()
[hoping the vm has a good inliner] ???

Etienne M. Gagnon, M.Sc.                     e-mail: egagnon@j-meg.com
Author of SableCC:                             http://www.sablecc.org/
and SableVM:                                   http://www.sablevm.org/