Skip to content

Commit 6f2f86d

Browse files
committed
Revert "remove NODE_PARENEXPR"
This reverts commit 8760e9f.
1 parent 634ccc9 commit 6f2f86d

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

autoload/vimlparser.vim

+4-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ let s:NODE_CONST = 94
142142
let s:NODE_EVAL = 95
143143
let s:NODE_HEREDOC = 96
144144
let s:NODE_METHOD = 97
145+
let s:NODE_PARENEXPR = 200
145146

146147
let s:TOKEN_EOF = 1
147148
let s:TOKEN_EOL = 2
@@ -4312,7 +4313,9 @@ function! s:ExprParser.parse_expr9() abort
43124313
endwhile
43134314
return node
43144315
elseif token.type ==# s:TOKEN_POPEN
4315-
let node = self.parse_expr1()
4316+
let node = s:Node(s:NODE_PARENEXPR)
4317+
let node.pos = token.pos
4318+
let node.value = self.parse_expr1()
43164319
let token = self.tokenizer.get()
43174320
if token.type !=# s:TOKEN_PCLOSE
43184321
throw s:Err(printf('unexpected token: %s', token.value), token.pos)

go/export.go

+7
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ func newAstNode(n *VimNode, filename string) ast.Node {
479479
Body: newExprs(n.body, filename),
480480
}
481481

482+
case NODE_PARENEXPR:
483+
n := n.value.(*VimNode)
484+
return &ast.ParenExpr{
485+
Lparen: pos,
486+
X: newExprNode(n, filename),
487+
}
488+
482489
}
483490
panic(fmt.Errorf("Unknown node type: %v, node: %v", n.type_, n))
484491
}

go/gocompiler.vim

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ call extend(s:, vimlparser#import())
66

77
let s:opprec = {}
88
let s:opprec[s:NODE_TERNARY] = 1
9+
let s:opprec[s:NODE_PARENEXPR] = 1
910
let s:opprec[s:NODE_OR] = 2
1011
let s:opprec[s:NODE_AND] = 3
1112
let s:opprec[s:NODE_EQUAL] = 4
@@ -280,6 +281,8 @@ function s:GoCompiler.compile(node)
280281
return self.compile_env(a:node)
281282
elseif a:node.type == s:NODE_REG
282283
return self.compile_reg(a:node)
284+
elseif a:node.type == s:NODE_PARENEXPR
285+
return self.compile_parenexpr(a:node)
283286
else
284287
throw self.err('Compiler: unknown node: %s', string(a:node))
285288
endif

go/vimlparser.go

+9-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)