Skip to content

Commit b2d5728

Browse files
committed
foo.123
1 parent 3d2cbb4 commit b2d5728

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

autoload/vimlparser.vim

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,25 +3191,15 @@ endfunction
31913191
" SUBSCRIPT or CONCAT
31923192
" dict "." [0-9A-Za-z_]+ => (subscript dict key)
31933193
" str "." expr6 => (concat str expr6)
3194-
" AMBIGUOUS:
3195-
" foo.bar(a, b)
3196-
" o => ((dot foo bar) a b)
3197-
" x => (concat foo (bar a b))
3198-
" foo.123
3199-
" x => (dot foo 123)
3200-
" o => (concat foo 123)
32013194
function s:ExprParser.parse_dot(token, left)
32023195
if a:left.type != s:NODE_IDENTIFIER && a:left.type != s:NODE_CURLYNAME && a:left.type != s:NODE_DICT && a:left.type != s:NODE_SUBSCRIPT && a:left.type != s:NODE_CALL && a:left.type != s:NODE_DOT
32033196
return s:NIL
32043197
endif
32053198
if !s:iswordc(self.reader.p(0))
32063199
return s:NIL
32073200
endif
3208-
if s:isdigit(self.reader.p(0))
3209-
return s:NIL
3210-
endif
32113201
let pos = self.reader.getpos()
3212-
let attr = self.reader.read_word()
3202+
let name = self.reader.read_word()
32133203
if s:isnamec(self.reader.p(0))
32143204
" foo.s:bar or foo.bar#baz
32153205
return s:NIL
@@ -3219,7 +3209,7 @@ function s:ExprParser.parse_dot(token, left)
32193209
let node.left = a:left
32203210
let node.right = s:Node(s:NODE_IDENTIFIER)
32213211
let node.right.pos = pos
3222-
let node.right.value = attr
3212+
let node.right.value = name
32233213
return node
32243214
endfunction
32253215

test/test_dot.ok

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
(echo (concat "foo" bar))
66
(echo ((dot foo bar)))
77
(echo (concat foo s:bar))
8-
(echo (concat foo 123))
8+
(echo (dot foo 123))
9+
(echo (dot foo 123abc))

test/test_dot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ echo "foo".bar
66
echo foo.bar()
77
echo foo.s:bar
88
echo foo.123
9+
echo foo.123abc

0 commit comments

Comments
 (0)