Skip to content

Commit 40f21cb

Browse files
committed
Merge remote-tracking branch 'origin/master' into run-vint-on-travis
2 parents ba7c98f + fa4eec0 commit 40f21cb

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

autoload/vimlparser.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ function! s:VimLParser.parse_cmd_function() abort
13391339
if left.type ==# s:NODE_IDENTIFIER
13401340
let s = left.value
13411341
let ss = split(s, '\zs')
1342-
if ss[0] !=# '<' && !s:isupper(ss[0]) && stridx(s, ':') ==# -1 && stridx(s, '#') ==# -1
1342+
if ss[0] !=# '<' && ss[0] !=# '_' && !s:isupper(ss[0]) && stridx(s, ':') ==# -1 && stridx(s, '#') ==# -1
13431343
throw s:Err(printf('E128: Function name must start with a capital or contain a colon: %s', s), left.pos)
13441344
endif
13451345
endif

js/vimlparser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ VimLParser.prototype.parse_cmd_function = function() {
16221622
if (left.type == NODE_IDENTIFIER) {
16231623
var s = left.value;
16241624
var ss = viml_split(s, "\\zs");
1625-
if (ss[0] != "<" && !isupper(ss[0]) && viml_stridx(s, ":") == -1 && viml_stridx(s, "#") == -1) {
1625+
if (ss[0] != "<" && ss[0] != "_" && !isupper(ss[0]) && viml_stridx(s, ":") == -1 && viml_stridx(s, "#") == -1) {
16261626
throw Err(viml_printf("E128: Function name must start with a capital or contain a colon: %s", s), left.pos);
16271627
}
16281628
}

py/vimlparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ def parse_cmd_function(self):
13381338
if left.type == NODE_IDENTIFIER:
13391339
s = left.value
13401340
ss = viml_split(s, "\\zs")
1341-
if ss[0] != "<" and not isupper(ss[0]) and viml_stridx(s, ":") == -1 and viml_stridx(s, "#") == -1:
1341+
if ss[0] != "<" and ss[0] != "_" and not isupper(ss[0]) and viml_stridx(s, ":") == -1 and viml_stridx(s, "#") == -1:
13421342
raise VimLParserException(Err(viml_printf("E128: Function name must start with a capital or contain a colon: %s", s), left.pos))
13431343
# :function {name}
13441344
if self.reader.peekn(1) != "(":

test/test_funcname.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(function (_F))
2+
(function (s:SID))
3+
(function (<SID>SID))

test/test_funcname.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function _F()
2+
endfunction
3+
4+
function s:SID()
5+
endfunction
6+
7+
function <SID>SID()
8+
endfunction

0 commit comments

Comments
 (0)