@@ -137,6 +137,7 @@ let s:NODE_REG = 89
137
137
let s: NODE_CURLYNAMEPART = 90
138
138
let s: NODE_CURLYNAMEEXPR = 91
139
139
let s: NODE_LAMBDA = 92
140
+ let s: NODE_PARENEXPR = 93
140
141
141
142
let s: TOKEN_EOF = 1
142
143
let s: TOKEN_EOL = 2
@@ -403,6 +404,7 @@ endfunction
403
404
" CURLYNAMEPART .value
404
405
" CURLYNAMEEXPR .value
405
406
" LAMBDA .rlist .left
407
+ " PARENEXPR .value
406
408
function ! s: Node (type )
407
409
return {' type' : a: type }
408
410
endfunction
@@ -3514,7 +3516,9 @@ function! s:ExprParser.parse_expr9()
3514
3516
endwhile
3515
3517
return node
3516
3518
elseif token.type == s: TOKEN_POPEN
3517
- let node = self .parse_expr1 ()
3519
+ let node = s: Node (s: NODE_PARENEXPR )
3520
+ let node.pos = token.pos
3521
+ let node.value = self .parse_expr1 ()
3518
3522
let token = self .tokenizer.get ()
3519
3523
if token.type != s: TOKEN_PCLOSE
3520
3524
throw s: Err (printf (' unexpected token: %s' , token.value), token.pos)
@@ -4185,6 +4189,8 @@ function! s:Compiler.compile(node)
4185
4189
return self .compile_curlynameexpr (a: node )
4186
4190
elseif a: node .type == s: NODE_LAMBDA
4187
4191
return self .compile_lambda (a: node )
4192
+ elseif a: node .type == s: NODE_PARENEXPR
4193
+ return self .compile_parenexpr (a: node )
4188
4194
else
4189
4195
throw printf (' Compiler: unknown node: %s' , string (a: node ))
4190
4196
endif
@@ -4648,6 +4654,10 @@ function! s:Compiler.compile_lambda(node)
4648
4654
return printf (' (lambda (%s) %s)' , join (rlist, ' ' ), self .compile (a: node .left ))
4649
4655
endfunction
4650
4656
4657
+ function ! s: Compiler .compile_parenexpr (node)
4658
+ return self .compile (a: node .value)
4659
+ endfunction
4660
+
4651
4661
" TODO: under construction
4652
4662
let s: RegexpParser = {}
4653
4663
0 commit comments