===============================================================================
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
Wilhelminenstr.
7 fax +49 /
(0)6151 / 16 - 5472
D-64283
Darmstadt
Germany
===============================================================================
-----Ursprüngliche Nachricht-----
Von: yuntao [mailto:yuntao@eventmonitor.com]
Gesendet: Donnerstag, 4. Oktober 2001 17:34
An: leonhardt@informatik.tu-darmstadt.de
Cc: yuntao
Betreff: position of the production in SableCCHi,I am going through the sablecc mailing list and found your response to one of the question.The original question and the answer are attached at the bottom of this message.I have the similar problem. I would like to throw a RuntimeException and in this exception,I would like to include the line number of where this error happens.I am looking at your answer and I can not quite get your solution. Could you please illustrate alittle bit more detail?For example: I have "a=2-"aaa";", since my minus operation can only apply to numeric data,I would like to throw an Exception. This statement is derived from the assign statement in thegrammer. So if I can find the node is an instance of the Expression node, how can I determine theline number of this statement appeared in the original input.Thanks a lot.Yuntao CuiOriginal message:What I'm doing in this case is to check the actual type in thein or out method of my visitor, like:if( node instanceof alternative_one ){}elseif( 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 andsuch.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
- Prev by Date: Re: if/else if
- Next by Date: Confusion
- Prev by thread: Re: if/else if
- Next by thread: Confusion
- Index(es):