Skip to content

Commit ba41116

Browse files
authored
Merge pull request #42 from haya14busa/follow-upstream
include upstream changes
2 parents be91a8f + 95c08c9 commit ba41116

File tree

3 files changed

+53
-17
lines changed

3 files changed

+53
-17
lines changed

autoload/vimlparser.vim

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ function! s:VimLParser.parse_command()
747747
let self.ea.forceit = s:FALSE
748748
endif
749749

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\>'
751751
throw s:Err('E477: No ! allowed', self.ea.cmdpos)
752752
endif
753753

@@ -798,16 +798,9 @@ function! s:VimLParser.parse_command()
798798
call self.parse_argcmd()
799799
endif
800800

801-
" call self[self.ea.cmd.parser]()
802801
call self._parse_command(self.ea.cmd.parser)
803802
endfunction
804803

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'
811804
function! s:VimLParser._parse_command(parser) abort
812805
if a:parser == 'parse_cmd_append'
813806
call self.parse_cmd_append()
@@ -901,6 +894,8 @@ function! s:VimLParser._parse_command(parser) abort
901894
call self.parse_wincmd()
902895
elseif a:parser == 'parse_cmd_syntax'
903896
call self.parse_cmd_syntax()
897+
else
898+
throw printf('unknown parser: %s', string(a:parser))
904899
endif
905900
endfunction
906901

@@ -4039,50 +4034,73 @@ function! s:Compiler.compile(node)
40394034
return self.compile_toplevel(a:node)
40404035
elseif a:node.type == s:NODE_COMMENT
40414036
call self.compile_comment(a:node)
4037+
return s:NIL
40424038
elseif a:node.type == s:NODE_EXCMD
40434039
call self.compile_excmd(a:node)
4040+
return s:NIL
40444041
elseif a:node.type == s:NODE_FUNCTION
40454042
call self.compile_function(a:node)
4043+
return s:NIL
40464044
elseif a:node.type == s:NODE_DELFUNCTION
40474045
call self.compile_delfunction(a:node)
4046+
return s:NIL
40484047
elseif a:node.type == s:NODE_RETURN
40494048
call self.compile_return(a:node)
4049+
return s:NIL
40504050
elseif a:node.type == s:NODE_EXCALL
40514051
call self.compile_excall(a:node)
4052+
return s:NIL
40524053
elseif a:node.type == s:NODE_LET
40534054
call self.compile_let(a:node)
4055+
return s:NIL
40544056
elseif a:node.type == s:NODE_UNLET
40554057
call self.compile_unlet(a:node)
4058+
return s:NIL
40564059
elseif a:node.type == s:NODE_LOCKVAR
40574060
call self.compile_lockvar(a:node)
4061+
return s:NIL
40584062
elseif a:node.type == s:NODE_UNLOCKVAR
40594063
call self.compile_unlockvar(a:node)
4064+
return s:NIL
40604065
elseif a:node.type == s:NODE_IF
40614066
call self.compile_if(a:node)
4067+
return s:NIL
40624068
elseif a:node.type == s:NODE_WHILE
40634069
call self.compile_while(a:node)
4070+
return s:NIL
40644071
elseif a:node.type == s:NODE_FOR
40654072
call self.compile_for(a:node)
4073+
return s:NIL
40664074
elseif a:node.type == s:NODE_CONTINUE
40674075
call self.compile_continue(a:node)
4076+
return s:NIL
40684077
elseif a:node.type == s:NODE_BREAK
40694078
call self.compile_break(a:node)
4079+
return s:NIL
40704080
elseif a:node.type == s:NODE_TRY
40714081
call self.compile_try(a:node)
4082+
return s:NIL
40724083
elseif a:node.type == s:NODE_THROW
40734084
call self.compile_throw(a:node)
4085+
return s:NIL
40744086
elseif a:node.type == s:NODE_ECHO
40754087
call self.compile_echo(a:node)
4088+
return s:NIL
40764089
elseif a:node.type == s:NODE_ECHON
40774090
call self.compile_echon(a:node)
4091+
return s:NIL
40784092
elseif a:node.type == s:NODE_ECHOHL
40794093
call self.compile_echohl(a:node)
4094+
return s:NIL
40804095
elseif a:node.type == s:NODE_ECHOMSG
40814096
call self.compile_echomsg(a:node)
4097+
return s:NIL
40824098
elseif a:node.type == s:NODE_ECHOERR
40834099
call self.compile_echoerr(a:node)
4100+
return s:NIL
40844101
elseif a:node.type == s:NODE_EXECUTE
40854102
call self.compile_execute(a:node)
4103+
return s:NIL
40864104
elseif a:node.type == s:NODE_TERNARY
40874105
return self.compile_ternary(a:node)
40884106
elseif a:node.type == s:NODE_OR

go/vimlfunc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var patVim2Go = map[string]string{
1818
"\\<NOTRLCOM\\>": "\\bNOTRLCOM\\b",
1919
"\\<TRLBAR\\>": "\\bTRLBAR\\b",
2020
"\\<USECTRLV\\>": "\\bUSECTRLV\\b",
21+
"\\<USERCMD\\>": "\\bUSERCMD\\b",
2122
"\\<\\(XFILE\\|FILES\\|FILE1\\)\\>": "\\b(XFILE|FILES|FILE1)\\b",
2223
"\\S": "\\S",
2324
"\\a": "[A-Za-z]",
@@ -62,7 +63,6 @@ var patVim2Go = map[string]string{
6263
"^[a-z]$": "^[a-z]$",
6364
"^[vgslabwt]:$\\|^\\([vgslabwt]:\\)\\?[A-Za-z_][0-9A-Za-z_#]*$": "^[vgslabwt]:$|^([vgslabwt]:)?[A-Za-z_][0-9A-Za-z_#]*$",
6465
"^[0-7]$": "^[0-7]$",
65-
"USERCMD": "USERCMD",
6666
}
6767

6868
var patVim2GoRegh = make(map[string]*regexp.Regexp)

go/vimlparser.go

Lines changed: 26 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)