File tree 4 files changed +29
-0
lines changed
4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -342,6 +342,17 @@ type Throw struct {
342
342
func (f * Throw ) Pos () Pos { return f .Throw }
343
343
func (f * Throw ) Cmd () Cmd { return * f .ExArg .Cmd }
344
344
345
+ // vimlparser: EVAL .ea .left
346
+ // :eval {Expr}
347
+ type Eval struct {
348
+ Eval Pos // position of starting the :eval
349
+ ExArg ExArg // Ex command arg
350
+ Expr Expr
351
+ }
352
+
353
+ func (f * Eval ) Pos () Pos { return f .Eval }
354
+ func (f * Eval ) Cmd () Cmd { return * f .ExArg .Cmd }
355
+
345
356
// vimlparser: ECHO .ea .list
346
357
// vimlparser: ECHON .ea .list
347
358
// vimlparser: ECHOMSG .ea .list
@@ -584,6 +595,7 @@ func (*Let) stmtNode() {}
584
595
func (* LockVar ) stmtNode () {}
585
596
func (* Return ) stmtNode () {}
586
597
func (* Throw ) stmtNode () {}
598
+ func (* Eval ) stmtNode () {}
587
599
func (* Try ) stmtNode () {}
588
600
func (* UnLet ) stmtNode () {}
589
601
func (* UnLockVar ) stmtNode () {}
Original file line number Diff line number Diff line change @@ -135,6 +135,9 @@ func Walk(v Visitor, node Node) {
135
135
case * Throw :
136
136
Walk (v , n .Expr )
137
137
138
+ case * Eval :
139
+ Walk (v , n .Expr )
140
+
138
141
case * EchoCmd :
139
142
walkExprList (v , n .Exprs )
140
143
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ func (c *Compiler) compileExcommand(node ast.ExCommand) error {
129
129
c .compileTry (n )
130
130
case * ast.Throw :
131
131
c .compileThrow (n )
132
+ case * ast.Eval :
133
+ c .compileEval (n )
132
134
case * ast.EchoCmd :
133
135
c .compileEchocmd (n )
134
136
case * ast.Echohl :
@@ -332,6 +334,11 @@ func (c *Compiler) compileThrow(node *ast.Throw) {
332
334
c .fprintln ("(%s %s)" , cmd , c .compileExpr (node .Expr ))
333
335
}
334
336
337
+ func (c * Compiler ) compileEval (node * ast.Eval ) {
338
+ cmd := node .Cmd ().Name
339
+ c .fprintln ("(%s %s)" , cmd , c .compileExpr (node .Expr ))
340
+ }
341
+
335
342
func (c * Compiler ) compileEchocmd (node * ast.EchoCmd ) {
336
343
cmd := node .Cmd ().Name
337
344
exprs := make ([]string , 0 , len (node .Exprs ))
Original file line number Diff line number Diff line change @@ -275,6 +275,13 @@ func newAstNode(n *VimNode, filename string) ast.Node {
275
275
Expr : newExprNode (n .left , filename ),
276
276
}
277
277
278
+ case NODE_EVAL :
279
+ return & ast.Eval {
280
+ Eval : pos ,
281
+ ExArg : newExArg (* n .ea , filename ),
282
+ Expr : newExprNode (n .left , filename ),
283
+ }
284
+
278
285
case NODE_ECHO , NODE_ECHON , NODE_ECHOMSG , NODE_ECHOERR :
279
286
return & ast.EchoCmd {
280
287
Start : pos ,
You can’t perform that action at this time.
0 commit comments