Skip to content

Commit 72bc89d

Browse files
committed
support blob type
1 parent f67c0bd commit 72bc89d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

go/export.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ func newAstNode(n *VimNode, filename string) ast.Node {
446446
Expr: newExprNode(n.left, filename),
447447
}
448448

449+
case NODE_BLOB:
450+
return &ast.BasicLit{
451+
ValuePos: pos,
452+
Kind: token.BLOB,
453+
Value: n.value.(string),
454+
}
455+
449456
case NODE_PARENEXPR:
450457
n := n.value.(*VimNode)
451458
return &ast.ParenExpr{

go/vimlfunc.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ var patVim2Go = map[string]string{
6262
"^[A-Z]$": "^[A-Z]$",
6363
"^[a-z]$": "^[a-z]$",
6464
"^[vgslabwt]:$\\|^\\([vgslabwt]:\\)\\?[A-Za-z_][0-9A-Za-z_#]*$": "^[vgslabwt]:$|^([vgslabwt]:)?[A-Za-z_][0-9A-Za-z_#]*$",
65-
"^[0-7]$": "^[0-7]$",
65+
"^[0-7]$": "^[0-7]$",
66+
"^[0-9A-Fa-f][0-9A-Fa-f]$": "^[0-9A-Fa-f][0-9A-Fa-f]$",
67+
"^\\.[0-9A-Fa-f]$": "^\\.[0-9A-Fa-f]$",
68+
"^[0-9A-Fa-f][^0-9A-Fa-f]$": "^[0-9A-Fa-f][^0-9A-Fa-f]$",
69+
"^[^a-z]\\S\\+$": "^[^a-z]\\S+$",
6670
}
6771

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

token/token.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const (
6363
CCLOSE
6464
COMMA
6565
NUMBER
66+
BLOB
6667
SQUOTE
6768
DQUOTE
6869
OPTION
@@ -134,6 +135,7 @@ var tokens = [...]string{
134135
CCLOSE: "}",
135136
COMMA: ",",
136137
NUMBER: "<NUMBER>",
138+
BLOB: "<BLOB>",
137139
SQUOTE: "'",
138140
DQUOTE: `"`,
139141
OPTION: "<&OPTION>",

0 commit comments

Comments
 (0)