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

AW: position of productions.



What I'm doing in this case is to check the actual type in the
in or out method of my visitor, like:
 
if( node instanceof alternative_one )
{
}
else
if( node instanceof alternative_two )
{
}
 
I do this until I get an token at one point. It's not nice but it works.
I do it for java source analysis to get the position of method usages and
such.
 
Cheers,
Thomas

==========================================================================
Thomas Leonhardt           email  leonhardt@informatik.tu-darmstadt.de
TU Darmstadt               WWW    http://www.pi.informatik.tu-darmstadt.de
FG Praktische Informatik   phone  +49 / (0)6151 / 16 - 5313
D-64283 Darmstadt          fax    +49 / (0)6151 / 16 - 5472
Germany
==========================================================================
 

-----Ursprüngliche Nachricht-----
Von: owner-sablecc-list@sable.mcgill.ca [mailto:owner-sablecc-list@sable.mcgill.ca]Im Auftrag von Brandner Florian
Gesendet: Freitag, 11. Mai 2001 14:57
An: sablecc list
Betreff: position of productions.

Hallo,
 
I have a gramma with something like an assignment statement in it like this:
p = a ':=' b;
 
a and b are typed and these types must be identical, to get a valid assignment.
If this is not the case i want to emit an error message, with the position of production p.
 
Is it posible to get the line and position of an production (like the Token.getLine() and Token.getPos() )?
 
Florian