parser fix for chain indexing into nested arrays
`[ [‘a1’, ‘a2’ ], [‘b1’, ‘b2’] ][2][1]` => `'b1'`
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Generated automatically by nearley, version 2.20.1
|
||||
// Generated automatically by nearley, version 2.16.0
|
||||
// http://github.com/Hardmath123/nearley
|
||||
function id(x) { return x[0]; }
|
||||
|
||||
@@ -93,7 +93,7 @@ let ParserRules = [
|
||||
d => [d[2], ...d[3]]
|
||||
},
|
||||
{"name": "arguments", "symbols": [{"literal":"("}, "_", {"literal":")"}], "postprocess": d => []},
|
||||
{"name": "indexExpression", "symbols": ["arrayExpression", {"literal":"["}, "_", "expression", "_", {"literal":"]"}], "postprocess": d => node.index.create({array: d[0], index: d[3]})},
|
||||
{"name": "indexExpression", "symbols": ["indexExpression", {"literal":"["}, "_", "expression", "_", {"literal":"]"}], "postprocess": d => node.index.create({array: d[0], index: d[3]})},
|
||||
{"name": "indexExpression", "symbols": ["arrayExpression"], "postprocess": id},
|
||||
{"name": "arrayExpression$subexpression$1", "symbols": ["expression"], "postprocess": d => d[0]},
|
||||
{"name": "arrayExpression$ebnf$1", "symbols": []},
|
||||
|
||||
@@ -125,7 +125,7 @@ arguments ->
|
||||
| "(" _ ")" {% d => [] %}
|
||||
|
||||
indexExpression ->
|
||||
arrayExpression "[" _ expression _ "]" {% d => node.index.create({array: d[0], index: d[3]}) %}
|
||||
indexExpression "[" _ expression _ "]" {% d => node.index.create({array: d[0], index: d[3]}) %}
|
||||
| arrayExpression {% id %}
|
||||
|
||||
arrayExpression ->
|
||||
|
||||
Reference in New Issue
Block a user