Generate all the lexers and parsers by running npm run antl4ts-all
.
If you just need to re-generate one of the grammars, you can run one of the following:
npm run antlr4ts-mysql # MySQL
npm run antlr4ts-plsql # PL/SQL (Oracle)
npm run antlr4ts-plpgsql # PL/SQL (PostgreSQL)
npm run antlr4ts-tsql # TSQL (Microsoft SQL Server)
After generating the MySQL lexer/parser, you need to add the superclass imports:
import { MySQLBaseLexer } from './MySQLBaseLexer';
import { SqlMode } from './common';
and
import { MySQLBaseParser } from "./MySQLBaseParser";
import { SqlMode } from './common';
And prepend all method calls with this.
and all static references with MySQLLexer.
. Additionally, you must append references to SqlMode
variables (essentially, anything that is left over after prepending with the previous two items) with SqlMode.
.
After generating the PL/SQL lexer/parser, you need to add the superclass imports:
import { PlSqlParserBase } from "./PlSqlParserBase";
and
import { PlSqlLexerBase } from "./PlSqlLexerBase";
And prepend all method calls with this.
. These grammars are designed for non-TypeScript languages, which do not require method calls to use the this
keyword.
Make sure you have installed all dependencies:
npm install
To build your local version of antlr4ts-sql, use the build script:
npm run build