@@ -747,7 +747,7 @@ function! s:VimLParser.parse_command()
747
747
let self .ea .forceit = s: FALSE
748
748
endif
749
749
750
- if self .ea .cmd.flags !~# ' \<BANG\>' && self .ea .forceit && self .ea .cmd.flags !~# ' USERCMD'
750
+ if self .ea .cmd.flags !~# ' \<BANG\>' && self .ea .forceit && self .ea .cmd.flags !~# ' \< USERCMD\> '
751
751
throw s: Err (' E477: No ! allowed' , self .ea .cmdpos)
752
752
endif
753
753
@@ -798,16 +798,9 @@ function! s:VimLParser.parse_command()
798
798
call self .parse_argcmd ()
799
799
endif
800
800
801
- " call self[self.ea.cmd.parser]()
802
801
call self ._parse_command (self .ea .cmd.parser)
803
802
endfunction
804
803
805
- " let s:parsers = sort(keys(filter(copy(s:VimLParser), { k -> k =~# '\v^parse_(win)?cmd' })))
806
- " for s:parser in s:parsers
807
- " echo printf("elseif a:parser == '%s'", s:parser)
808
- " echo printf(" call self.%s()", s:parser)
809
- " endfor
810
- " echo 'endif'
811
804
function ! s: VimLParser ._parse_command (parser) abort
812
805
if a: parser == ' parse_cmd_append'
813
806
call self .parse_cmd_append ()
@@ -901,6 +894,8 @@ function! s:VimLParser._parse_command(parser) abort
901
894
call self .parse_wincmd ()
902
895
elseif a: parser == ' parse_cmd_syntax'
903
896
call self .parse_cmd_syntax ()
897
+ else
898
+ throw printf (' unknown parser: %s' , string (a: parser ))
904
899
endif
905
900
endfunction
906
901
@@ -4039,50 +4034,73 @@ function! s:Compiler.compile(node)
4039
4034
return self .compile_toplevel (a: node )
4040
4035
elseif a: node .type == s: NODE_COMMENT
4041
4036
call self .compile_comment (a: node )
4037
+ return s: NIL
4042
4038
elseif a: node .type == s: NODE_EXCMD
4043
4039
call self .compile_excmd (a: node )
4040
+ return s: NIL
4044
4041
elseif a: node .type == s: NODE_FUNCTION
4045
4042
call self .compile_function (a: node )
4043
+ return s: NIL
4046
4044
elseif a: node .type == s: NODE_DELFUNCTION
4047
4045
call self .compile_delfunction (a: node )
4046
+ return s: NIL
4048
4047
elseif a: node .type == s: NODE_RETURN
4049
4048
call self .compile_return (a: node )
4049
+ return s: NIL
4050
4050
elseif a: node .type == s: NODE_EXCALL
4051
4051
call self .compile_excall (a: node )
4052
+ return s: NIL
4052
4053
elseif a: node .type == s: NODE_LET
4053
4054
call self .compile_let (a: node )
4055
+ return s: NIL
4054
4056
elseif a: node .type == s: NODE_UNLET
4055
4057
call self .compile_unlet (a: node )
4058
+ return s: NIL
4056
4059
elseif a: node .type == s: NODE_LOCKVAR
4057
4060
call self .compile_lockvar (a: node )
4061
+ return s: NIL
4058
4062
elseif a: node .type == s: NODE_UNLOCKVAR
4059
4063
call self .compile_unlockvar (a: node )
4064
+ return s: NIL
4060
4065
elseif a: node .type == s: NODE_IF
4061
4066
call self .compile_if (a: node )
4067
+ return s: NIL
4062
4068
elseif a: node .type == s: NODE_WHILE
4063
4069
call self .compile_while (a: node )
4070
+ return s: NIL
4064
4071
elseif a: node .type == s: NODE_FOR
4065
4072
call self .compile_for (a: node )
4073
+ return s: NIL
4066
4074
elseif a: node .type == s: NODE_CONTINUE
4067
4075
call self .compile_continue (a: node )
4076
+ return s: NIL
4068
4077
elseif a: node .type == s: NODE_BREAK
4069
4078
call self .compile_break (a: node )
4079
+ return s: NIL
4070
4080
elseif a: node .type == s: NODE_TRY
4071
4081
call self .compile_try (a: node )
4082
+ return s: NIL
4072
4083
elseif a: node .type == s: NODE_THROW
4073
4084
call self .compile_throw (a: node )
4085
+ return s: NIL
4074
4086
elseif a: node .type == s: NODE_ECHO
4075
4087
call self .compile_echo (a: node )
4088
+ return s: NIL
4076
4089
elseif a: node .type == s: NODE_ECHON
4077
4090
call self .compile_echon (a: node )
4091
+ return s: NIL
4078
4092
elseif a: node .type == s: NODE_ECHOHL
4079
4093
call self .compile_echohl (a: node )
4094
+ return s: NIL
4080
4095
elseif a: node .type == s: NODE_ECHOMSG
4081
4096
call self .compile_echomsg (a: node )
4097
+ return s: NIL
4082
4098
elseif a: node .type == s: NODE_ECHOERR
4083
4099
call self .compile_echoerr (a: node )
4100
+ return s: NIL
4084
4101
elseif a: node .type == s: NODE_EXECUTE
4085
4102
call self .compile_execute (a: node )
4103
+ return s: NIL
4086
4104
elseif a: node .type == s: NODE_TERNARY
4087
4105
return self .compile_ternary (a: node )
4088
4106
elseif a: node .type == s: NODE_OR
0 commit comments