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

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

Note:  Majordomo doesn't like the work "help" in a message subject.
-------- Original Message --------
From: Gary Montgomery <Gary.Montgomery@G11N.COM>
To: sablecc-list <sablecc-list@sable.mcgill.ca>
Subject: Help with accessing ignoredTokens
Date: Mon, 21 May 2001 13:11:30 -0700

I'm using Sablecc to create several tools for modifying/analysis of
in Java source code.
When outputting modified source to a new file, I'f like to preserve the
original formating the
original source had. This was addressed in post: 

with the code snipet:
LinkedList list = (LinkedList) Parser.ignoredTokens.getIn(classnode);
for(Iterator i = list.iterator(); i.hasNext(); )

About this I have a few questions:

1) Location - Where would be the best place for this code snipet?
2) How is a static reference to a non-static variable supposed to work

Doesn't each instance of Parser have it's own ignoredTokens?

As a quick test, I tried extending DepthFirstAdapter and placing the
in defaultIn().  
Added a constructor that takes a reference to the Parser used to create
AST. Besides feeling
clunky, the linked list that is returned is always null. When I place
debugging into the Parse 
instance though I see it placing all of the Ignored tokens into

Any help would be very much appreciated,
Gary Montgomery