ebnf-parser
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "ebnf-parser", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A parser for BNF and EBNF grammars used by jison", | ||
@@ -9,3 +9,6 @@ "main": "ebnf-parser.js", | ||
}, | ||
"repository": "", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zaach/ebnf-parser.git" | ||
}, | ||
"keywords": [ | ||
@@ -12,0 +15,0 @@ "bnf", |
@@ -1,2 +0,2 @@ | ||
/* parser generated by jison 0.4.4 */ | ||
/* parser generated by jison 0.4.6 */ | ||
/* | ||
@@ -323,3 +323,3 @@ Returns a Parser object of the following structure: | ||
} | ||
/* generated by jison-lex 0.2.0 */ | ||
/* generated by jison-lex 0.2.1 */ | ||
var lexer = (function(){ | ||
@@ -525,5 +525,2 @@ var lexer = { | ||
if (token) { | ||
if (this.options.backtrack_lexer) { | ||
delete backup; | ||
} | ||
return token; | ||
@@ -537,5 +534,2 @@ } else if (this._backtrack) { | ||
} | ||
if (this.options.backtrack_lexer) { | ||
delete backup; | ||
} | ||
return false; | ||
@@ -726,3 +720,3 @@ }, | ||
break; | ||
case 33:return 49; | ||
case 33:return 49; // regexp with braces or quotes (and no spaces) | ||
break; | ||
@@ -735,12 +729,14 @@ case 34:return 49; | ||
break; | ||
case 37:yy.depth++; return 44; | ||
case 37:return 49; | ||
break; | ||
case 38:yy.depth==0? this.begin(ebnf ? 'ebnf' : 'bnf') : yy.depth--; return 46; | ||
case 38:yy.depth++; return 44; | ||
break; | ||
case 39:return 9; | ||
case 39:yy.depth==0? this.begin(ebnf ? 'ebnf' : 'bnf') : yy.depth--; return 46; | ||
break; | ||
case 40:return 9; | ||
break; | ||
} | ||
}, | ||
rules: [/^(?:%%)/,/^(?:\()/,/^(?:\))/,/^(?:\*)/,/^(?:\?)/,/^(?:\+)/,/^(?:\s+)/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:[a-zA-Z][a-zA-Z0-9_-]*)/,/^(?:"[^"]+")/,/^(?:'[^']+')/,/^(?::)/,/^(?:;)/,/^(?:\|)/,/^(?:%%)/,/^(?:%ebnf\b)/,/^(?:%prec\b)/,/^(?:%start\b)/,/^(?:%left\b)/,/^(?:%right\b)/,/^(?:%nonassoc\b)/,/^(?:%lex[\w\W]*?\/lex\b)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:<[a-zA-Z]*>)/,/^(?:\{\{[\w\W]*?\}\})/,/^(?:%\{(.|\r|\n)*?%\})/,/^(?:\{)/,/^(?:->.*)/,/^(?:.)/,/^(?:$)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:(.|\n|\r)+)/], | ||
conditions: {"bnf":{"rules":[0,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true},"ebnf":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true},"action":{"rules":[30,31,32,33,34,35,36,37,38],"inclusive":false},"code":{"rules":[30,39],"inclusive":false},"INITIAL":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true}} | ||
rules: [/^(?:%%)/,/^(?:\()/,/^(?:\))/,/^(?:\*)/,/^(?:\?)/,/^(?:\+)/,/^(?:\s+)/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:[a-zA-Z][a-zA-Z0-9_-]*)/,/^(?:"[^"]+")/,/^(?:'[^']+')/,/^(?::)/,/^(?:;)/,/^(?:\|)/,/^(?:%%)/,/^(?:%ebnf\b)/,/^(?:%prec\b)/,/^(?:%start\b)/,/^(?:%left\b)/,/^(?:%right\b)/,/^(?:%nonassoc\b)/,/^(?:%lex[\w\W]*?\/lex\b)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:<[a-zA-Z]*>)/,/^(?:\{\{[\w\W]*?\}\})/,/^(?:%\{(.|\r|\n)*?%\})/,/^(?:\{)/,/^(?:->.*)/,/^(?:.)/,/^(?:$)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:(.|\n|\r)+)/], | ||
conditions: {"bnf":{"rules":[0,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true},"ebnf":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true},"action":{"rules":[30,31,32,33,34,35,36,37,38,39],"inclusive":false},"code":{"rules":[30,40],"inclusive":false},"INITIAL":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":true}} | ||
}; | ||
@@ -747,0 +743,0 @@ return lexer; |
@@ -155,2 +155,9 @@ var assert = require("assert"), | ||
exports["test uneven braces and quotes within regex"] = function () { | ||
var grammar = "%% test: foo bar { node({}, 3 / 4, \"{\"); /{'\"/g; 1 / 2; }; hello: world { blah / bah };"; | ||
var expected = {bnf: {test: [["foo bar"," node({}, 3 / 4, \"{\"); /{'\"/g; 1 / 2; " ]], hello: [["world", " blah / bah "]]}}; | ||
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly"); | ||
}; | ||
exports["test code declaration"] = function () { | ||
@@ -186,3 +193,2 @@ var grammar = "%{var foo = 'bar';%}\n%%hello: world;"; | ||
var grammar = "%lex\n%%\n\\' return \"'\"\n/lex\n%% test: foo bar \"'\";"; | ||
console.log(grammar); | ||
var expected = {lex: { | ||
@@ -189,0 +195,0 @@ rules: [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
70518
2