[antlr-interest] Advice on ANTLR 2.7.3 enabling position of token

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Jun 25 11:45:40 PDT 2008


Hi All,

Let me remind that we develop SQL parser for our Valentina database engine.
We still using ANTLR 2.x (waiting for release of ANTLR 3.1 to switch).

I know that in ANTLR 3.x added handy feature that each token know its
    styrt/end position in the original text.

Is it possible implement this feature for ANTLR 2.x ?

We have long time wait for 3.x switch but not catch urgent case to solve it
using 2.x.


Problem is that when we parse string that contains FEW SQL commands, we
sometimes must be able get command itself to store it. We need this for
Stored Procedures and Triggers for example.

So when I have single string as

"
CREATE PROCEDURE proc1
BEGIN
   // some text of procedure 1
END


CREATE PROCEDURE proc1
BEGIN
   // some text of procedure 2
END
"


I must be able get from parser only

CREATE PROCEDURE proc1
BEGIN
   // some text of procedure 1
END


Any clues how I can improve ANTLR 2.x for this?
    * may be add own subclass of Token ?
        and self store there position when Lexer create token?
    

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]





More information about the antlr-interest mailing list