sirensolutions/antlr4-javascript-sql

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

antlr4-javascript-sql

An UMD module wrapping ANTLR generated parser, lexer, listener and visitor for SQL databases, based on the antlr4-javascript-sparql module by Szymon Danielczyk.

Info

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:

Usage

To 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

Test
install 
test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.