[antlr-interest] A few questions about parsing SQL by PL/SQL.

Ivan Brezina ibre5041 at ibrezina.net
Fri Mar 2 03:31:44 PST 2012


Look at:
www.antlr.org/wiki/pages/viewpage.action?pageId=1782 (seems to be down ATM).

PL/SQL is case-insensitive language.

BTW: does anybody know how to execute gunit in case-insensitive mode?

Ivan


Quoting "Felix.?" <ygnhzeus at gmail.com>:

> Hi all,
> Does someone has experience using this PL/SQL(
> https://github.com/porcelli/plsql-parser) grammar listed on antlr?
> I got a few problems while trying to use it to parse a simple SQL string.
> 1.Am I right to generate the java code of  PLSQLLexer.g,PLSQLParser.g,
> PLSQLWalker.g in sequence?I got a lot of warnings in this phase.
> 2.Is there any instruction about how to use the generated class for parsing
> a SQL string and walking through it?Here is my code:
> public static void main(String[] args) throws IOException {
> // TODO Auto-generated method stub
> String source ="SELECT f FROM FS";
> ANTLRStringStream input = new ANTLRStringStream(source);
>     PLSQLLexer lex = new PLSQLLexer(input);
>     CommonTokenStream tokens = new CommonTokenStream(lex);
>     PLSQLParser parser = new PLSQLParser(tokens);
>     try
>     {
>         parser.*****();
>     }
>     catch (RecognitionException e)
>     {
>         e.printStackTrace();
>     }
> }
>
> I don't know which method should be invoked in "*****()".I tried
> "parser.select_key();" but got "line 1:0 missing SQL92_RESERVED_SELECT at
> 'SELECT'".
> Is there anything missing?
>
> Thanks very much!
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:   
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the antlr-interest mailing list