vim-jp/vim-vimlparser

Colon included in identifier name (e.g. `foo[bar:]`)

blueyed opened this issue · 1 comments

Given t-undef-slice.py:

import pprint
import vimlparser

s = vimlparser.StringReader(['echo foo[bar:]'])
pprint.pprint(vimlparser.VimLParser(s).parse(s))

Running PYTHONPATH=py python t-undef-slice.py displays:

{'body': [{'ea': {'addr_count': 0,
                  'amount': 0,
                  'append': 0,
                  'argcmd': {},
                  'argopt': {},
                  'argpos': {'col': 6, 'i': 5, 'lnum': 1, 'offset': 5},
                  'bad_char': 0,
                  'cmd': {'flags': 'EXTRA|NOTRLCOM|SBOXOK|CMDWIN',
                          'minlen': 2,
                          'name': 'echo',
                          'parser': 'parse_cmd_echo'},
                  'cmdpos': {'col': 1, 'i': 0, 'lnum': 1, 'offset': 0},
                  'do_ecmd_cmd': '',
                  'do_ecmd_lnum': 0,
                  'flags': 0,
                  'force_bin': 0,
                  'force_enc': 0,
                  'force_ff': 0,
                  'forceit': 0,
                  'line1': 0,
                  'line2': 0,
                  'linepos': {'col': 1, 'i': 0, 'lnum': 1, 'offset': 0},
                  'modifiers': [],
                  'range': [],
                  'read_edit': 0,
                  'regname': 0,
                  'usefilter': 0},
           'list': [{'left': {'pos': {'col': 6, 'i': 5, 'lnum': 1, 'offset': 5},
                              'type': 86,
                              'value': 'foo'},
                     'pos': {'col': 9, 'i': 8, 'lnum': 1, 'offset': 8},
                     'right': {'pos': {'col': 10,
                                       'i': 9,
                                       'lnum': 1,
                                       'offset': 9},
                               'type': 86,
                               'value': 'bar:'},
                     'type': 76}],
           'pos': {'col': 1, 'i': 0, 'lnum': 1, 'offset': 0},
           'type': 28}],
 'pos': {'col': 1, 'i': 0, 'lnum': 1, 'offset': 0},
 'type': 1}

Note the value bar: (with leading :) for the identifier.
It should be just bar.

tyru commented

This can also reproduce.

let x = 'x'
let d = { x: 2 }

#158