Skip to content

Commit 8f207d5

Browse files
authored
Merge pull request #59 from haya14busa/add-usercmd-regex
Fix USERCMD regex and py/js support
2 parents a860f13 + 508efe2 commit 8f207d5

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

autoload/vimlparser.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ function! s:VimLParser.parse_command()
746746
let self.ea.forceit = s:FALSE
747747
endif
748748

749-
if self.ea.cmd.flags !~# '\<BANG\>' && self.ea.forceit && self.ea.cmd.flags !~# 'USERCMD'
749+
if self.ea.cmd.flags !~# '\<BANG\>' && self.ea.forceit && self.ea.cmd.flags !~# '\<USERCMD\>'
750750
throw s:Err('E477: No ! allowed', self.ea.cmdpos)
751751
endif
752752

js/vimlfunc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var pat_vim2js = {
3535
"\\<NOTRLCOM\\>" : "\\bNOTRLCOM\\b",
3636
"\\<TRLBAR\\>" : "\\bTRLBAR\\b",
3737
"\\<USECTRLV\\>" : "\\bUSECTRLV\\b",
38+
"\\<USERCMD\\>" : "\\bUSERCMD\\b",
3839
"\\<\\(XFILE\\|FILES\\|FILE1\\)\\>" : "\\b(XFILE|FILES|FILE1)\\b",
3940
"\\S" : "\\S",
4041
"\\a" : "[A-Za-z]",

js/vimlparser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var pat_vim2js = {
3535
"\\<NOTRLCOM\\>" : "\\bNOTRLCOM\\b",
3636
"\\<TRLBAR\\>" : "\\bTRLBAR\\b",
3737
"\\<USECTRLV\\>" : "\\bUSECTRLV\\b",
38+
"\\<USERCMD\\>" : "\\bUSERCMD\\b",
3839
"\\<\\(XFILE\\|FILES\\|FILE1\\)\\>" : "\\b(XFILE|FILES|FILE1)\\b",
3940
"\\S" : "\\S",
4041
"\\a" : "[A-Za-z]",
@@ -969,7 +970,7 @@ VimLParser.prototype.parse_command = function() {
969970
else {
970971
this.ea.forceit = FALSE;
971972
}
972-
if (!viml_eqregh(this.ea.cmd.flags, "\\<BANG\\>") && this.ea.forceit && !viml_eqregh(this.ea.cmd.flags, "USERCMD")) {
973+
if (!viml_eqregh(this.ea.cmd.flags, "\\<BANG\\>") && this.ea.forceit && !viml_eqregh(this.ea.cmd.flags, "\\<USERCMD\\>")) {
973974
throw Err("E477: No ! allowed", this.ea.cmdpos);
974975
}
975976
if (this.ea.cmd.name != "!") {

py/vimlfunc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class AttributeDict(dict):
3131
"\\<NOTRLCOM\\>" : "\\bNOTRLCOM\\b",
3232
"\\<TRLBAR\\>" : "\\bTRLBAR\\b",
3333
"\\<USECTRLV\\>" : "\\bUSECTRLV\\b",
34+
"\\<USERCMD\\>" : "\\bUSERCMD\\b",
3435
"\\<\\(XFILE\\|FILES\\|FILE1\\)\\>" : "\\b(XFILE|FILES|FILE1)\\b",
3536
"\\S" : "\\S",
3637
"\\a" : "[A-Za-z]",

py/vimlparser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class AttributeDict(dict):
3131
"\\<NOTRLCOM\\>" : "\\bNOTRLCOM\\b",
3232
"\\<TRLBAR\\>" : "\\bTRLBAR\\b",
3333
"\\<USECTRLV\\>" : "\\bUSECTRLV\\b",
34+
"\\<USERCMD\\>" : "\\bUSERCMD\\b",
3435
"\\<\\(XFILE\\|FILES\\|FILE1\\)\\>" : "\\b(XFILE|FILES|FILE1)\\b",
3536
"\\S" : "\\S",
3637
"\\a" : "[A-Za-z]",
@@ -805,7 +806,7 @@ def parse_command(self):
805806
self.ea.forceit = TRUE
806807
else:
807808
self.ea.forceit = FALSE
808-
if not viml_eqregh(self.ea.cmd.flags, "\\<BANG\\>") and self.ea.forceit and not viml_eqregh(self.ea.cmd.flags, "USERCMD"):
809+
if not viml_eqregh(self.ea.cmd.flags, "\\<BANG\\>") and self.ea.forceit and not viml_eqregh(self.ea.cmd.flags, "\\<USERCMD\\>"):
809810
raise VimLParserException(Err("E477: No ! allowed", self.ea.cmdpos))
810811
if self.ea.cmd.name != "!":
811812
self.reader.skip_white()

0 commit comments

Comments
 (0)