Name: antlr4-javascript-sql
Owner: Siren
Description: null
Created: 2015-08-05 13:51:22.0
Updated: 2018-03-09 13:37:39.0
Pushed: 2016-05-19 15:58:21.0
Homepage: null
Size: 532
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
An UMD module wrapping ANTLR generated parser, lexer, listener and visitor for SQL databases, based on the antlr4-javascript-sparql module by Szymon Danielczyk.
Parser classes where generated from G4 grammar files using the ANTLR runtime, version 4.5.1.
The SQL grammar file is Copyright (c) 2014 by Bart Kiers, released under the MIT License; it can be downloaded from the antlr/grammars-v4 repository.
Classes have been generated with the following commands:
-Xmx500M -cp "antlr-4.5.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=JavaScript grammars/sql/SQL.g4 -o lib
Then a the following modifications have been made to generated classes:
SQLLexer
, atn
and decisionToFDA
have been moved inside the constructorSQLParser
atn
, decisionToFDA
, sharedContextCache
have been moved inside the constructor; atn
has been bound to this
and the Object.defineProperty
has been commented outTo build UMD module type:
install -g browserify
install": "browserify --ignore-missing main.js -o release/antlr4-sql.js",
To use with webpack define following shim antlr4-sql.js
antlr4 = require('antlr4-base');
SQLLexer = require('node_modules/antlr4-javascript-sql/lib/SQLLexer.js');
SQLParser = require('node_modules/antlr4-javascript-sql/lib/SQLParser.js');
SQLListener = require('node_modules/antlr4-javascript-sql/lib/SQLListener');
SQLVisitor = require('node_modules/antlr4-javascript-sql/lib/SQLVisitor');
listener = SQLListener(antlr4);
visitor = SQLVisitor(antlr4);
le.exports = {
LLexer: SQLLexer(antlr4),
LParser: SQLParser(antlr4, listener, visitor),
LListener: listener,
LVisitor: visitor
install
test