[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.

Ooookay. It's all slowly sinking in. 
> 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] ???

Maybe a "How do I..." Faq would cut down on the questions from people
like myself that have read all the documentation several times but have
not yet figured out all the places in the framework that I can poke or prod
and exactly what those results are. Not to say you should, Etienne,  but
that we the users should. 

How many of us are reinventing the wheel when it comes to writing grammars, 
walking across or transforming AST's, etc...? How many of us wast(ed) time
out the same basics. How do I access ignoredTokens? How do I do something
each instance of a certain node? How do I replace one type of node for

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