@@ -137,6 +137,7 @@ let s:NODE_REG = 89
137137let s: NODE_CURLYNAMEPART = 90
138138let s: NODE_CURLYNAMEEXPR = 91
139139let s: NODE_LAMBDA = 92
140+ let s: NODE_PARENEXPR = 93
140141
141142let s: TOKEN_EOF = 1
142143let s: TOKEN_EOL = 2
@@ -403,6 +404,7 @@ endfunction
403404" CURLYNAMEPART .value
404405" CURLYNAMEEXPR .value
405406" LAMBDA .rlist .left
407+ " PARENEXPR .value
406408function ! s: Node (type )
407409 return {' type' : a: type }
408410endfunction
@@ -3514,7 +3516,9 @@ function! s:ExprParser.parse_expr9()
35143516 endwhile
35153517 return node
35163518 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 ()
35183522 let token = self .tokenizer.get ()
35193523 if token.type != s: TOKEN_PCLOSE
35203524 throw s: Err (printf (' unexpected token: %s' , token.value), token.pos)
@@ -4185,6 +4189,8 @@ function! s:Compiler.compile(node)
41854189 return self .compile_curlynameexpr (a: node )
41864190 elseif a: node .type == s: NODE_LAMBDA
41874191 return self .compile_lambda (a: node )
4192+ elseif a: node .type == s: NODE_PARENEXPR
4193+ return self .compile_parenexpr (a: node )
41884194 else
41894195 throw printf (' Compiler: unknown node: %s' , string (a: node ))
41904196 endif
@@ -4648,6 +4654,10 @@ function! s:Compiler.compile_lambda(node)
46484654 return printf (' (lambda (%s) %s)' , join (rlist, ' ' ), self .compile (a: node .left ))
46494655endfunction
46504656
4657+ function ! s: Compiler .compile_parenexpr (node)
4658+ return self .compile (a: node .value)
4659+ endfunction
4660+
46514661" TODO: under construction
46524662let s: RegexpParser = {}
46534663
0 commit comments