Hi everyone!

I am currently working on a grammar, that converts SQL*PLUS scripts in JDBC 
compatible statements.
Basically I am separating the different statements in

* normal SQL statements (to be JDBC compatible, the trailing semicolon must be 
removed)
* PL/SQL statements (or more precise: statement that require a trailing “END;”)
* comments (I keep them for metadata or something)

Furthermore, the SQL*PLUS specific “/” is recognized.

I simply tried imitate the behavior of multiline-comments, since I am for now 
not interested in the inner structure of the statements, however the appended 
grammar yields many errors like the following while parsing

line 4:27 mismatched character 'e' expecting set null
line 4:29 no viable alternative at character 't'
line 4:30 mismatched character ';' expecting set null
line 5:7 mismatched character 'R' expecting set null

Besides of this, the grammar does what I want it to do, but I don’t really 
trust it.
I appended a test-file, that gets recognized the way I want.

Thanks,
Markus

PS: Since PL/SQL can have nested BEGIN…END-blocks I will have to include a 
mechanism to count  the BEGINs and ENDs. I am thinking about a counter, that 
gets incremented, when the lexer finds a BEGIN and decrements when it finds an 
END. Would you recommend this or do you know a better way?
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Attachment: PLSQLSplitter.g
Description: PLSQLSplitter.g

Attachment: test.sql
Description: test.sql

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to