ebnf2railroad
Advanced tools
Comparing version 1.13.1 to 1.14.0
{ | ||
"name": "ebnf2railroad", | ||
"version": "1.13.1", | ||
"version": "1.14.0", | ||
"description": "EBNF to Railroad diagram", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -248,2 +248,32 @@ const dasherize = (str) => str.replace(/\s+/g, "-"); | ||
} | ||
if ( | ||
production.repetition && | ||
production.skippable === false && | ||
!production.repeater | ||
) { | ||
const renderConfig = detectRenderConfig(production.repetition, options); | ||
return `${ | ||
renderConfig.multiline ? lineIndent(renderConfig.indent) : "" | ||
}{ ${productionToEBNF(production.repetition, renderConfig)}${ | ||
renderConfig.multiline ? lineIndent(renderConfig.indent) : " " | ||
}}-`; | ||
} | ||
if ( | ||
production.repetition && | ||
production.skippable === false && | ||
production.repeater | ||
) { | ||
const renderConfig = detectRenderConfig(production.repetition, options); | ||
return `${ | ||
renderConfig.multiline ? lineIndent(renderConfig.indent) : "" | ||
}${productionToEBNF( | ||
production.repetition, | ||
renderConfig | ||
)}, { ${productionToEBNF( | ||
production.repeater, | ||
renderConfig | ||
)} , ${productionToEBNF(production.repetition, renderConfig)}${ | ||
renderConfig.multiline ? lineIndent(renderConfig.indent) : " " | ||
}}`; | ||
} | ||
if (production.repetition) { | ||
@@ -250,0 +280,0 @@ const renderConfig = detectRenderConfig(production.repetition, options); |
@@ -75,8 +75,8 @@ /* parser generated by jison 0.4.18 */ | ||
var ebnfParser = (function(){ | ||
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,6],$V2=[5,7,29],$V3=[1,20],$V4=[1,11],$V5=[1,12],$V6=[1,13],$V7=[1,15],$V8=[1,21],$V9=[1,22],$Va=[1,24],$Vb=[1,25],$Vc=[10,12,13,15,17,19,29],$Vd=[10,12,13,15,17,19]; | ||
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,6],$V2=[5,7,29],$V3=[1,20],$V4=[1,11],$V5=[1,12],$V6=[1,13],$V7=[1,15],$V8=[1,21],$V9=[1,22],$Va=[1,24],$Vb=[1,25],$Vc=[10,12,13,15,18,20,29],$Vd=[10,12,13,15,18,20]; | ||
var parser = {trace: function trace () { }, | ||
yy: {}, | ||
symbols_: {"error":2,"grammar":3,"production_list":4,"EOF":5,"production":6,"IDENTIFIER":7,"=":8,"rhs":9,";":10,"comment":11,",":12,"|":13,"{":14,"}":15,"(":16,")":17,"[":18,"]":19,"DIGIT":20,"*":21,"identifier":22,"terminal":23,"exception":24,"specialSequence":25,"-":26,"STRING":27,"SEQUENCE":28,"COMMENT":29,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",7:"IDENTIFIER",8:"=",10:";",12:",",13:"|",14:"{",15:"}",16:"(",17:")",18:"[",19:"]",20:"DIGIT",21:"*",26:"-",27:"STRING",28:"SEQUENCE",29:"COMMENT"}, | ||
productions_: [0,[3,2],[4,2],[4,1],[6,4],[6,1],[9,3],[9,3],[9,3],[9,3],[9,3],[9,4],[9,3],[9,2],[9,1],[9,1],[9,1],[9,1],[24,3],[24,3],[22,1],[25,1],[23,1],[11,1]], | ||
symbols_: {"error":2,"grammar":3,"production_list":4,"EOF":5,"production":6,"IDENTIFIER":7,"=":8,"rhs":9,";":10,"comment":11,",":12,"|":13,"{":14,"}":15,"-":16,"(":17,")":18,"[":19,"]":20,"DIGIT":21,"*":22,"identifier":23,"terminal":24,"exception":25,"specialSequence":26,"STRING":27,"SEQUENCE":28,"COMMENT":29,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",7:"IDENTIFIER",8:"=",10:";",12:",",13:"|",14:"{",15:"}",16:"-",17:"(",18:")",19:"[",20:"]",21:"DIGIT",22:"*",27:"STRING",28:"SEQUENCE",29:"COMMENT"}, | ||
productions_: [0,[3,2],[4,2],[4,1],[6,4],[6,1],[9,3],[9,3],[9,4],[9,3],[9,3],[9,3],[9,4],[9,3],[9,2],[9,1],[9,1],[9,1],[9,1],[25,3],[25,3],[23,1],[26,1],[24,1],[11,1]], | ||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { | ||
@@ -106,35 +106,38 @@ /* this == yyval */ | ||
case 8: | ||
this.$ = { repetition: $$[$0-2], skippable: false } | ||
break; | ||
case 9: | ||
this.$ = { repetition: $$[$0-1], skippable: true } | ||
break; | ||
case 9: | ||
case 10: | ||
this.$ = { group: $$[$0-1] } | ||
break; | ||
case 10: | ||
case 11: | ||
this.$ = { optional: $$[$0-1] } | ||
break; | ||
case 11: | ||
case 12: | ||
this.$ = { comment: $$[$0-3].comment, before: true, group: { optional: $$[$0-1] } } | ||
break; | ||
case 12: | ||
case 13: | ||
this.$ = { repetition: $$[$0], amount: $$[$0-2] } | ||
break; | ||
case 13: | ||
case 14: | ||
this.$ = { ...$$[$0], group: $$[$0-1] } | ||
break; | ||
case 18: | ||
case 19: | ||
this.$ = { include: $$[$0-2].trim(), exceptNonTerminal: $$[$0].trim() } | ||
break; | ||
case 19: | ||
case 20: | ||
this.$ = { include: $$[$0-2].trim(), exceptTerminal: $$[$0].slice(1, -1) } | ||
break; | ||
case 20: | ||
case 21: | ||
this.$ = { nonTerminal: $$[$0].trim() }; | ||
break; | ||
case 21: | ||
case 22: | ||
this.$ = { specialSequence: $$[$0].slice(1, -1).trim() } | ||
break; | ||
case 22: | ||
case 23: | ||
this.$ = { terminal: $$[$0].slice(1, -1) } | ||
break; | ||
case 23: | ||
case 24: | ||
this.$ = {comment: $$[$0].slice(2, -2) } | ||
@@ -144,3 +147,3 @@ break; | ||
}, | ||
table: [{3:1,4:2,6:3,7:$V0,11:5,29:$V1},{1:[3]},{5:[1,7],6:8,7:$V0,11:5,29:$V1},o($V2,[2,3]),{8:[1,9]},o($V2,[2,5]),o([5,7,10,12,13,15,17,18,19,29],[2,23]),{1:[2,1]},o($V2,[2,2]),{7:$V3,9:10,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{10:[1,23],11:26,12:$Va,13:$Vb,29:$V1},{7:$V3,9:27,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:28,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:29,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{18:[1,30]},{21:[1,31]},o($Vc,[2,14]),o($Vc,[2,15]),o($Vc,[2,16]),o($Vc,[2,17]),o($Vc,[2,20],{26:[1,32]}),o($Vc,[2,22]),o($Vc,[2,21]),o($V2,[2,4]),{7:$V3,9:33,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:34,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},o($Vc,[2,13]),{11:26,12:$Va,13:$Vb,15:[1,35],29:$V1},{11:26,12:$Va,13:$Vb,17:[1,36],29:$V1},{11:26,12:$Va,13:$Vb,19:[1,37],29:$V1},{7:$V3,9:38,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:39,11:14,14:$V4,16:$V5,18:$V6,20:$V7,22:16,23:17,24:18,25:19,27:$V8,28:$V9,29:$V1},{7:[1,40],27:[1,41]},o($Vd,[2,6],{11:26,29:$V1}),o([10,13,15,17,19],[2,7],{11:26,12:$Va,29:$V1}),o($Vc,[2,8]),o($Vc,[2,9]),o($Vc,[2,10]),{11:26,12:$Va,13:$Vb,19:[1,42],29:$V1},o($Vd,[2,12],{11:26,29:$V1}),o($Vc,[2,18]),o($Vc,[2,19]),o($Vc,[2,11])], | ||
table: [{3:1,4:2,6:3,7:$V0,11:5,29:$V1},{1:[3]},{5:[1,7],6:8,7:$V0,11:5,29:$V1},o($V2,[2,3]),{8:[1,9]},o($V2,[2,5]),o([5,7,10,12,13,15,18,19,20,29],[2,24]),{1:[2,1]},o($V2,[2,2]),{7:$V3,9:10,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{10:[1,23],11:26,12:$Va,13:$Vb,29:$V1},{7:$V3,9:27,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:28,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:29,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{19:[1,30]},{22:[1,31]},o($Vc,[2,15]),o($Vc,[2,16]),o($Vc,[2,17]),o($Vc,[2,18]),o($Vc,[2,21],{16:[1,32]}),o($Vc,[2,23]),o($Vc,[2,22]),o($V2,[2,4]),{7:$V3,9:33,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:34,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},o($Vc,[2,14]),{11:26,12:$Va,13:$Vb,15:[1,35],29:$V1},{11:26,12:$Va,13:$Vb,18:[1,36],29:$V1},{11:26,12:$Va,13:$Vb,20:[1,37],29:$V1},{7:$V3,9:38,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{7:$V3,9:39,11:14,14:$V4,17:$V5,19:$V6,21:$V7,23:16,24:17,25:18,26:19,27:$V8,28:$V9,29:$V1},{7:[1,40],27:[1,41]},o($Vd,[2,6],{11:26,29:$V1}),o([10,13,15,18,20],[2,7],{11:26,12:$Va,29:$V1}),o($Vc,[2,9],{16:[1,42]}),o($Vc,[2,10]),o($Vc,[2,11]),{11:26,12:$Va,13:$Vb,20:[1,43],29:$V1},o($Vd,[2,13],{11:26,29:$V1}),o($Vc,[2,19]),o($Vc,[2,20]),o($Vc,[2,8]),o($Vc,[2,12])], | ||
defaultActions: {7:[2,1]}, | ||
@@ -627,7 +630,7 @@ parseError: function parseError (str, hash) { | ||
break; | ||
case 3: return 20; | ||
case 3: return 21; | ||
break; | ||
case 4: return 18; | ||
case 4: return 19; | ||
break; | ||
case 5: return 19; | ||
case 5: return 20; | ||
break; | ||
@@ -638,3 +641,3 @@ case 6: return 14; | ||
break; | ||
case 8: return 21; | ||
case 8: return 22; | ||
break; | ||
@@ -655,3 +658,3 @@ case 9: return 8; | ||
break; | ||
case 16: return 26; | ||
case 16: return 16; | ||
break; | ||
@@ -662,9 +665,9 @@ case 17: return 14; | ||
break; | ||
case 19: return 16; | ||
case 19: return 17; | ||
break; | ||
case 20: return 17; | ||
case 20: return 18; | ||
break; | ||
case 21: return 18; | ||
case 21: return 19; | ||
break; | ||
case 22: return 19; | ||
case 22: return 20; | ||
break; | ||
@@ -671,0 +674,0 @@ case 23: return 27; |
@@ -24,2 +24,3 @@ const { ebnfOptimizer } = require("./ast/ebnf-transform"); | ||
unwrapOptional, | ||
repetition, | ||
optionalChoices, | ||
@@ -26,0 +27,0 @@ ]); |
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
121444
30
3252
0