[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
Strings
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:
http://www.sable.mcgill.ca/listarchives/sablecc-list/msg00402.html
with the code snipet:
++++++++++++++++++++++++++++++++++
LinkedList list = (LinkedList) Parser.ignoredTokens.getIn(classnode);
for(Iterator i = list.iterator(); i.hasNext(); )
{
System.out.println(i.next());
}
++++++++++++++++++++++++++++++++++
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
here:
Parser.ignoredTokens.getIn(classnode)?
Doesn't each instance of Parser have it's own ignoredTokens?
As a quick test, I tried extending DepthFirstAdapter and placing the
snipet
in defaultIn().
Added a constructor that takes a reference to the Parser used to create
the
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
ignoredTokens.
Any help would be very much appreciated,
Gary Montgomery