Comparing version 0.2.7 to 0.2.8
@@ -68,5 +68,3 @@ #!/usr/bin/env node | ||
if (!options.stripActions) { | ||
s += handle[i][1].match(/\}/) ? | ||
"\n {{"+handle[i][1]+(handle[i][1].match(/\}$/) ? ' ' : '')+"}}" : | ||
"\n {"+handle[i][1]+"}"; | ||
s += "\n {"+handle[i][1]+"}"; | ||
} | ||
@@ -73,0 +71,0 @@ if (handle[i][2] && handle[i][2].prec) { |
@@ -5,5 +5,5 @@ /* Jison generated parser */ | ||
yy: {}, | ||
symbols_: {"error":2,"spec":3,"declaration_list":4,"%%":5,"grammar":6,"EOF":7,"declaration":8,"START":9,"id":10,"LEX_BLOCK":11,"operator":12,"associativity":13,"token_list":14,"LEFT":15,"RIGHT":16,"NONASSOC":17,"symbol":18,"production_list":19,"production":20,":":21,"handle_list":22,";":23,"|":24,"handle_action":25,"handle":26,"prec":27,"action":28,"PREC":29,"STRING":30,"ID":31,"ACTION":32,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"%%",7:"EOF",9:"START",11:"LEX_BLOCK",15:"LEFT",16:"RIGHT",17:"NONASSOC",21:":",23:";",24:"|",29:"PREC",30:"STRING",31:"ID",32:"ACTION"}, | ||
productions_: [0,[3,4],[3,5],[4,2],[4,0],[8,2],[8,1],[8,1],[12,2],[13,1],[13,1],[13,1],[14,2],[14,1],[6,1],[19,2],[19,1],[20,4],[22,3],[22,1],[25,3],[26,2],[26,0],[27,2],[27,0],[18,1],[18,1],[10,1],[28,1],[28,0]], | ||
symbols_: {"error":2,"spec":3,"declaration_list":4,"%%":5,"grammar":6,"EOF":7,"declaration":8,"START":9,"id":10,"LEX_BLOCK":11,"operator":12,"associativity":13,"token_list":14,"LEFT":15,"RIGHT":16,"NONASSOC":17,"symbol":18,"production_list":19,"production":20,":":21,"handle_list":22,";":23,"|":24,"handle_action":25,"handle":26,"prec":27,"action":28,"PREC":29,"STRING":30,"ID":31,"{":32,"action_body":33,"}":34,"ACTION":35,"ACTION_BODY":36,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"%%",7:"EOF",9:"START",11:"LEX_BLOCK",15:"LEFT",16:"RIGHT",17:"NONASSOC",21:":",23:";",24:"|",29:"PREC",30:"STRING",31:"ID",32:"{",34:"}",35:"ACTION",36:"ACTION_BODY"}, | ||
productions_: [0,[3,4],[3,5],[4,2],[4,0],[8,2],[8,1],[8,1],[12,2],[13,1],[13,1],[13,1],[14,2],[14,1],[6,1],[19,2],[19,1],[20,4],[22,3],[22,1],[25,3],[26,2],[26,0],[27,2],[27,0],[18,1],[18,1],[10,1],[28,3],[28,1],[28,0],[33,0],[33,1],[33,5]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
@@ -73,9 +73,17 @@ | ||
break; | ||
case 28:this.$ = yytext; | ||
case 28:this.$ = $$[$0-1]; | ||
break; | ||
case 29:this.$ = ''; | ||
case 29:this.$ = $$[$0]; | ||
break; | ||
case 30:this.$ = ''; | ||
break; | ||
case 31:this.$ = ''; | ||
break; | ||
case 32:this.$ = yytext; | ||
break; | ||
case 33:this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0]; | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,5:[2,4],9:[2,4],11:[2,4],15:[2,4],16:[2,4],17:[2,4]},{1:[3]},{5:[1,3],8:4,9:[1,5],11:[1,6],12:7,13:8,15:[1,9],16:[1,10],17:[1,11]},{6:12,10:15,19:13,20:14,31:[1,16]},{5:[2,3],9:[2,3],11:[2,3],15:[2,3],16:[2,3],17:[2,3]},{10:17,31:[1,16]},{5:[2,6],9:[2,6],11:[2,6],15:[2,6],16:[2,6],17:[2,6]},{5:[2,7],9:[2,7],11:[2,7],15:[2,7],16:[2,7],17:[2,7]},{10:20,14:18,18:19,30:[1,21],31:[1,16]},{30:[2,9],31:[2,9]},{30:[2,10],31:[2,10]},{30:[2,11],31:[2,11]},{5:[1,23],7:[1,22]},{5:[2,14],7:[2,14],10:15,20:24,31:[1,16]},{5:[2,16],7:[2,16],31:[2,16]},{21:[1,25]},{5:[2,27],9:[2,27],11:[2,27],15:[2,27],16:[2,27],17:[2,27],21:[2,27],23:[2,27],24:[2,27],29:[2,27],30:[2,27],31:[2,27],32:[2,27]},{5:[2,5],9:[2,5],11:[2,5],15:[2,5],16:[2,5],17:[2,5]},{5:[2,8],9:[2,8],10:20,11:[2,8],15:[2,8],16:[2,8],17:[2,8],18:26,30:[1,21],31:[1,16]},{5:[2,13],9:[2,13],11:[2,13],15:[2,13],16:[2,13],17:[2,13],30:[2,13],31:[2,13]},{5:[2,25],9:[2,25],11:[2,25],15:[2,25],16:[2,25],17:[2,25],23:[2,25],24:[2,25],29:[2,25],30:[2,25],31:[2,25],32:[2,25]},{5:[2,26],9:[2,26],11:[2,26],15:[2,26],16:[2,26],17:[2,26],23:[2,26],24:[2,26],29:[2,26],30:[2,26],31:[2,26],32:[2,26]},{1:[2,1]},{7:[1,27]},{5:[2,15],7:[2,15],31:[2,15]},{22:28,23:[2,22],24:[2,22],25:29,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22]},{5:[2,12],9:[2,12],11:[2,12],15:[2,12],16:[2,12],17:[2,12],30:[2,12],31:[2,12]},{1:[2,2]},{23:[1,31],24:[1,32]},{23:[2,19],24:[2,19]},{10:20,18:34,23:[2,24],24:[2,24],27:33,29:[1,35],30:[1,21],31:[1,16],32:[2,24]},{5:[2,17],7:[2,17],31:[2,17]},{23:[2,22],24:[2,22],25:36,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22]},{23:[2,29],24:[2,29],28:37,32:[1,38]},{23:[2,21],24:[2,21],29:[2,21],30:[2,21],31:[2,21],32:[2,21]},{10:20,18:39,30:[1,21],31:[1,16]},{23:[2,18],24:[2,18]},{23:[2,20],24:[2,20]},{23:[2,28],24:[2,28]},{23:[2,23],24:[2,23],32:[2,23]}], | ||
table: [{3:1,4:2,5:[2,4],9:[2,4],11:[2,4],15:[2,4],16:[2,4],17:[2,4]},{1:[3]},{5:[1,3],8:4,9:[1,5],11:[1,6],12:7,13:8,15:[1,9],16:[1,10],17:[1,11]},{6:12,10:15,19:13,20:14,31:[1,16]},{5:[2,3],9:[2,3],11:[2,3],15:[2,3],16:[2,3],17:[2,3]},{10:17,31:[1,16]},{5:[2,6],9:[2,6],11:[2,6],15:[2,6],16:[2,6],17:[2,6]},{5:[2,7],9:[2,7],11:[2,7],15:[2,7],16:[2,7],17:[2,7]},{10:20,14:18,18:19,30:[1,21],31:[1,16]},{30:[2,9],31:[2,9]},{30:[2,10],31:[2,10]},{30:[2,11],31:[2,11]},{5:[1,23],7:[1,22]},{5:[2,14],7:[2,14],10:15,20:24,31:[1,16]},{5:[2,16],7:[2,16],31:[2,16]},{21:[1,25]},{5:[2,27],9:[2,27],11:[2,27],15:[2,27],16:[2,27],17:[2,27],21:[2,27],23:[2,27],24:[2,27],29:[2,27],30:[2,27],31:[2,27],32:[2,27],35:[2,27]},{5:[2,5],9:[2,5],11:[2,5],15:[2,5],16:[2,5],17:[2,5]},{5:[2,8],9:[2,8],10:20,11:[2,8],15:[2,8],16:[2,8],17:[2,8],18:26,30:[1,21],31:[1,16]},{5:[2,13],9:[2,13],11:[2,13],15:[2,13],16:[2,13],17:[2,13],30:[2,13],31:[2,13]},{5:[2,25],9:[2,25],11:[2,25],15:[2,25],16:[2,25],17:[2,25],23:[2,25],24:[2,25],29:[2,25],30:[2,25],31:[2,25],32:[2,25],35:[2,25]},{5:[2,26],9:[2,26],11:[2,26],15:[2,26],16:[2,26],17:[2,26],23:[2,26],24:[2,26],29:[2,26],30:[2,26],31:[2,26],32:[2,26],35:[2,26]},{1:[2,1]},{7:[1,27]},{5:[2,15],7:[2,15],31:[2,15]},{22:28,23:[2,22],24:[2,22],25:29,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22],35:[2,22]},{5:[2,12],9:[2,12],11:[2,12],15:[2,12],16:[2,12],17:[2,12],30:[2,12],31:[2,12]},{1:[2,2]},{23:[1,31],24:[1,32]},{23:[2,19],24:[2,19]},{10:20,18:34,23:[2,24],24:[2,24],27:33,29:[1,35],30:[1,21],31:[1,16],32:[2,24],35:[2,24]},{5:[2,17],7:[2,17],31:[2,17]},{23:[2,22],24:[2,22],25:36,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22],35:[2,22]},{23:[2,30],24:[2,30],28:37,32:[1,38],35:[1,39]},{23:[2,21],24:[2,21],29:[2,21],30:[2,21],31:[2,21],32:[2,21],35:[2,21]},{10:20,18:40,30:[1,21],31:[1,16]},{23:[2,18],24:[2,18]},{23:[2,20],24:[2,20]},{32:[2,31],33:41,34:[2,31],36:[1,42]},{23:[2,29],24:[2,29]},{23:[2,23],24:[2,23],32:[2,23],35:[2,23]},{32:[1,44],34:[1,43]},{32:[2,32],34:[2,32]},{23:[2,28],24:[2,28]},{32:[2,31],33:45,34:[2,31],36:[1,42]},{32:[1,44],34:[1,46]},{32:[2,31],33:47,34:[2,31],36:[1,42]},{32:[1,44],34:[2,33]}], | ||
defaultActions: {22:[2,1],27:[2,2]}, | ||
@@ -418,9 +426,9 @@ parseError: function parseError(str, hash) { | ||
break; | ||
case 17: /* ignore type */ | ||
case 17:/* ignore type */ | ||
break; | ||
case 18:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-4); return 32; | ||
case 18:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-4); return 35; | ||
break; | ||
case 19:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 32; | ||
case 19:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 35; | ||
break; | ||
case 20:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 32; | ||
case 20:yy.depth=0; this.begin('action'); return 32; | ||
break; | ||
@@ -431,6 +439,12 @@ case 21:/* ignore bad characters */ | ||
break; | ||
case 23:return 36; | ||
break; | ||
case 24:yy.depth++; return 32; | ||
break; | ||
case 25:yy.depth==0? this.begin('INITIAL') : yy.depth--; return 34; | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^\s+/,/^\/\/.*/,/^\/\*[^*]*\*/,/^[a-zA-Z][a-zA-Z0-9_-]*/,/^"[^"]+"/,/^'[^']+'/,/^:/,/^;/,/^\|/,/^%%/,/^%prec\b/,/^%start\b/,/^%left\b/,/^%right\b/,/^%nonassoc\b/,/^%lex[\w\W]*?\/lex\b/,/^%[a-zA-Z]+[^\n]*/,/^<[a-zA-Z]*>/,/^\{\{[\w\W]*?\}\}/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^./,/^$/]; | ||
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":true}};return lexer;})() | ||
lexer.rules = [/^\s+/,/^\/\/.*/,/^\/\*[^*]*\*/,/^[a-zA-Z][a-zA-Z0-9_-]*/,/^"[^"]+"/,/^'[^']+'/,/^:/,/^;/,/^\|/,/^%%/,/^%prec\b/,/^%start\b/,/^%left\b/,/^%right\b/,/^%nonassoc\b/,/^%lex[\w\W]*?\/lex\b/,/^%[a-zA-Z]+[^\n]*/,/^<[a-zA-Z]*>/,/^\{\{[\w\W]*?\}\}/,/^%\{(.|\n)*?%\}/,/^\{/,/^./,/^$/,/^[^{}]+/,/^\{/,/^\}/]; | ||
lexer.conditions = {"action":{"rules":[23,24,25],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":true}};return lexer;})() | ||
parser.lexer = lexer; | ||
@@ -437,0 +451,0 @@ return parser; |
@@ -66,3 +66,3 @@ /* Jison generated parser */ | ||
case 25: this.$ = $$[$0]; | ||
if (this.$.match(/[\w\d]$/) && !this.$.match(/\\u[a-fA-F0-9]{4}$/)) | ||
if (this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) | ||
this.$ += "\\b"; | ||
@@ -457,28 +457,30 @@ | ||
break; | ||
case 23:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 48 | ||
case 23:return 48 | ||
break; | ||
case 24:return 42 | ||
case 24:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 48 | ||
break; | ||
case 25:return 40 | ||
case 25:return 42 | ||
break; | ||
case 26:return 14 | ||
case 26:return 40 | ||
break; | ||
case 27:return 16 | ||
case 27:return 14 | ||
break; | ||
case 28:yy.ruleSection = true; return 6 | ||
case 28:return 16 | ||
break; | ||
case 29:return 49 | ||
case 29:yy.ruleSection = true; return 6 | ||
break; | ||
case 30:return 45 | ||
case 30:return 49 | ||
break; | ||
case 31:return 46 | ||
case 31:return 45 | ||
break; | ||
case 32:/* ignore bad characters */ | ||
case 32:return 46 | ||
break; | ||
case 33:return 9 | ||
case 33:/* ignore bad characters */ | ||
break; | ||
case 34:return 9 | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\[a-zA-Z0"]/,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/]; | ||
lexer.conditions = {"indented":{"rules":[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,31,32,33],"inclusive":true},"trail":{"rules":[0,2,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,31,32,33],"inclusive":true},"INITIAL":{"rules":[2,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,31,32,33],"inclusive":true}};return lexer;})() | ||
lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\([0-7]{1,3}|[rfntvsSbBwWdD]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4})/,/^\\./,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/]; | ||
lexer.conditions = {"indented":{"rules":[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,31,32,33,34],"inclusive":true},"trail":{"rules":[0,2,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,31,32,33,34],"inclusive":true},"INITIAL":{"rules":[2,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,31,32,33,34],"inclusive":true}};return lexer;})() | ||
parser.lexer = lexer; | ||
@@ -485,0 +487,0 @@ return parser; |
{ | ||
"author": "Zach Carter <zach@carter.name> (http://zaa.ch)", | ||
"name": "jison", | ||
"version": "0.2.7", | ||
"author": "Zach Carter", | ||
"email": "zach@carter.name", | ||
"description": "A parser generator with Bison's API", | ||
"version": "0.2.8", | ||
"keywords": [ | ||
@@ -17,5 +17,11 @@ "jison", | ||
], | ||
"githubName": "jison", | ||
"type": "zip", | ||
"location": "http://github.com/zaach/jison/zipball/master", | ||
"preferGlobal": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/zaach/jison.git" | ||
}, | ||
"bugs": { | ||
"email": "jison@librelist.com", | ||
"url": "http://github.com/zaach/jison/issues" | ||
}, | ||
"main": "lib/jison", | ||
@@ -28,4 +34,13 @@ "bin": { | ||
"engines": { | ||
"node": ">=0.1.90" | ||
"node": "0.4 || 0.5" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"test": "*", | ||
"jison": "*", | ||
"uglify-js": "*" | ||
}, | ||
"scripts": { | ||
"test": "node tests/all-tests.js" | ||
}, | ||
"directories": { | ||
@@ -50,5 +65,3 @@ "lib": "lib", | ||
}, | ||
"files": [ | ||
"" | ||
] | ||
} | ||
"homepage": "http://jison.org" | ||
} |
@@ -120,1 +120,8 @@ var assert = require("assert"), | ||
}; | ||
exports["test balanced braces"] = function () { | ||
var grammar = "%% test: foo bar { node({}, node({foo:'bar'})); }; hello: world ;"; | ||
var expected = {bnf: {test: [["foo bar"," node({}, node({foo:'bar'})); " ]], hello: ["world"]}}; | ||
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly"); | ||
}; |
@@ -20,3 +20,3 @@ var assert = require("assert"), | ||
exports["test actions"] = function () { | ||
var grammar = "%start foo %% test: foo bar | baz ; hello: world %prec UM {{action{} }} ;"; | ||
var grammar = "%start foo %% test: foo bar | baz ; hello: world %prec UM {action{}} ;"; | ||
var expected = {start: "foo", bnf: {test: ["foo bar", "baz"], hello: [[ "world", "action{}", {prec: "UM"} ]]}}; | ||
@@ -23,0 +23,0 @@ |
@@ -28,3 +28,3 @@ var assert = require("assert"), | ||
exports["test excaped chars"] = function () { | ||
exports["test escaped chars"] = function () { | ||
var lexgrammar = '%%\n"\\n"+ {return \'NL\';}\n\\n+ {return \'NL2\';}\n\\s+ {/* skip */}'; | ||
@@ -160,6 +160,6 @@ var expected = { | ||
exports["test quote escape"] = function () { | ||
var lexgrammar = '%%\n\\""x" return 1;'; | ||
var lexgrammar = '%%\n\\"\\\'"x" return 1;'; | ||
var expected = { | ||
rules: [ | ||
["\"x\\b", "return 1;"] | ||
["\"'x\\b", "return 1;"] | ||
] | ||
@@ -171,2 +171,17 @@ }; | ||
exports["test escape things"] = function () { | ||
var lexgrammar = '%%\n\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}'; | ||
var expected = { | ||
rules: [ | ||
["\"'\\*i\\b", "return 1;"], | ||
["a\\b", "return 2;"], | ||
["\\cA", ""], | ||
["\\012", ""], | ||
["\\xFF", ""] | ||
] | ||
}; | ||
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); | ||
}; | ||
exports["test unicode encoding"] = function () { | ||
@@ -173,0 +188,0 @@ var lexgrammar = '%%\n"\\u03c0" return 1;'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
66613
1
1
10
14
827476
3
127
14087