mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
viml/parser/expressions: Make sure that listed nodes may be present
With the new test leaving `assert(false);` for any of the cases makes tests crash.
This commit is contained in:
parent
cddf84c398
commit
36a4f3a259
@ -3065,12 +3065,9 @@ viml_pexpr_parse_end:
|
||||
// to be caught later.
|
||||
break;
|
||||
}
|
||||
case kExprNodeSubscript:
|
||||
case kExprNodeConcatOrSubscript:
|
||||
case kExprNodeComplexIdentifier:
|
||||
case kExprNodeSubscript: {
|
||||
// FIXME: Investigate whether above are OK to be present in the stack.
|
||||
break;
|
||||
}
|
||||
case kExprNodeAssignment:
|
||||
case kExprNodeMod:
|
||||
case kExprNodeDivision:
|
||||
|
@ -4228,6 +4228,50 @@ return function(itp, _check_parsing, hl, fmtn)
|
||||
hl('ConcatOrSubscript', '.'),
|
||||
hl('Number', '1', 1),
|
||||
})
|
||||
|
||||
check_parsing('a[1][2][3[4', {
|
||||
-- 01234567890
|
||||
-- 0 1
|
||||
ast = {
|
||||
{
|
||||
'Subscript:0:7:[',
|
||||
children = {
|
||||
{
|
||||
'Subscript:0:4:[',
|
||||
children = {
|
||||
{
|
||||
'Subscript:0:1:[',
|
||||
children = {
|
||||
'PlainIdentifier(scope=0,ident=a):0:0:a',
|
||||
'Integer(val=1):0:2:1',
|
||||
},
|
||||
},
|
||||
'Integer(val=2):0:5:2',
|
||||
},
|
||||
},
|
||||
{
|
||||
'Subscript:0:9:[',
|
||||
children = {
|
||||
'Integer(val=3):0:8:3',
|
||||
'Integer(val=4):0:10:4',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
hl('IdentifierName', 'a'),
|
||||
hl('SubscriptBracket', '['),
|
||||
hl('Number', '1'),
|
||||
hl('SubscriptBracket', ']'),
|
||||
hl('SubscriptBracket', '['),
|
||||
hl('Number', '2'),
|
||||
hl('SubscriptBracket', ']'),
|
||||
hl('SubscriptBracket', '['),
|
||||
hl('Number', '3'),
|
||||
hl('SubscriptBracket', '['),
|
||||
hl('Number', '4'),
|
||||
})
|
||||
end)
|
||||
itp('works with bracket subscripts', function()
|
||||
check_parsing(':', {
|
||||
|
Loading…
Reference in New Issue
Block a user