Skip to content

bytebase/plsql-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The plsql-parser is a parser for Oracle 11g/12c PL/SQL. It is based on the ANTLR4 and use the grammar from antlr4-grammars-plsql.

Build

Before build, you need to install the ANTLR4.

requirements:

./build.sh

Update grammar

Manually change the grammar file in this project

  1. Update the PlSqlLexer.g4 and PlSqlParser.g4 in root directory.
  2. run ./build.sh to generate the parser code.

From antlr4-grammars-plsql

  1. Clone the PlSqlLexer.g4 and PlSqlParser.g4 grammar files from https://github.com/antlr/grammars-v4/tree/master/sql/plsql into parser folder.
  2. Clone the https://github.com/antlr/grammars-v4/blob/master/sql/plsql/Go/transformGrammar.py into root directory.
  3. Run the transformGrammar.py to generate the PlSqlLexer.g4 and PlSqlParser.g4 in parser directory.
  4. Copy the PlSqlLexer.g4 and PlSqlParser.g4 to root directory.
  5. run ./build.sh to generate the parser code.

Test the parser

Run TestPLSQLParser in parser_test.go to test the parser.

go test -v

References