Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var parse = function(
tql,
onExactFilter,
onContainsFilter,
onContainsIgnoreCaseFilter,
onCompliesFilter,
onBetweenFilter,
onEmptyFilter,
onValidFilter,
onInvalidFilter,
onWordCompliesFilter
) {
var chars = new antlr4.InputStream(tql);
var lexer = new TqlLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var listener = new TqlListener();
var parser = new TqlParser(tokens);
var noop = function() {};
parser.buildParseTrees = true;
// Define listeners
listener.enterFieldIsEmpty = onEmptyFilter || noop;
listener.enterFieldIsValid = onValidFilter || noop;
listener.enterFieldIsInvalid = onInvalidFilter || noop;
listener.enterFieldContains = onContainsFilter || noop;
listener.enterFieldContainsIgnoreCase = onContainsIgnoreCaseFilter || noop;
listener.enterFieldCompliesPattern = onCompliesFilter || noop;
listener.enterFieldWordCompliesPattern = onWordCompliesFilter || noop;
listener.enterFieldBetween = onBetweenFilter || noop;
listener.enterLiteralComparison = function(ctx) {
private handleParseFile(err: NodeJS.ErrnoException, data: string) {
var chars = new antlr4.InputStream(data);
var lexer = new ApexLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new ApexParser(tokens);
parser.buildParseTrees = true;
parser.removeErrorListeners();
parser.addErrorListener(this);
var tree = parser.compilationUnit();
this.file = data;
this.parseNode(tree);
this.ds.set(this.uri, this.diag);
}
var fs = require("fs");
var antlr4 = require('antlr4/index');
var __TemplateGrammarName__Lexer = require('./__TemplateGrammarName__Lexer').__TemplateGrammarName__Lexer;
/*$ParserInclude*/var __TemplateGrammarName__Parser = require('./__TemplateGrammarName__Parser').__TemplateGrammarName__Parser;/*ParserInclude$*/
/*AntlrCaseInsensitive*/
var fileName = "../../Text"
if (process.argv.length >= 2) {
fileName = process.argv[2];
}
var input = fs.readFileSync(fileName).toString();
var chars = new antlr4.InputStream(input);
var lexer = new __TemplateGrammarName__Lexer(chars);
var tokensStream = new antlr4.CommonTokenStream(lexer);
/*$ParserPart*/
var rootRule;
if (process.argv.length >= 3) {
rootRule = process.argv[3];
}
var parser = new __TemplateGrammarName__Parser(tokensStream);
var ruleName = rootRule === undefined ? parser.ruleNames[0] : rootRule;
var ast = parser[ruleName]();
console.log("Tree " + ast.toStringTree(null, parser));
/*ParserPart$*/
var QASMImport = function(circuit, input, errorCallback) {
var chars = new antlr4.InputStream(input);
var lexer = new QASMLexer.QASMLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new QASMParser.QASMParser(tokens);
parser.buildParseTrees = true;
parser.removeErrorListeners();
var errors = [];
var errorListener = new ErrorListener(errors);
parser.addErrorListener(errorListener);
var tree = parser.mainprog();
var QASM = new QCQASMListener(circuit);
antlr4.tree.ParseTreeWalker.DEFAULT.walk(QASM, tree);
if(errorCallback) {
errorCallback(errors);
}
};
Mandelbrot.prototype.parse = function(script) {
var inputStream = new antlr4.InputStream(script)
var lexer = new MandelbrotLexer(inputStream)
var tokenStream = new antlr4.CommonTokenStream(lexer)
var parser = new MandelbrotParser(tokenStream)
var fractal = parser.fractal()
return fractal
};