Skip to content

Commit ffb12a7

Browse files
committed
feat(vimparser): upgrade latest version
1 parent e663768 commit ffb12a7

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/lib/vimparser.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,15 +2781,16 @@ ExprTokenizer.prototype.get_dstring = function() {
27812781
return s;
27822782
}
27832783

2784-
ExprTokenizer.prototype.get_dict_literal_key = function() {
2784+
ExprTokenizer.prototype.parse_dict_literal_key = function() {
27852785
this.reader.skip_white();
2786-
var r = this.reader;
2787-
var c = r.peek();
2786+
var c = this.reader.peek();
27882787
if (!isalnum(c) && c != "_" && c != "-") {
27892788
throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
27902789
}
2790+
var node = Node(NODE_STRING);
27912791
var s = c;
27922792
this.reader.seek_cur(1);
2793+
node.pos = this.reader.getpos();
27932794
while (TRUE) {
27942795
var c = this.reader.p(0);
27952796
if (c == "<EOF>" || c == "<EOL>") {
@@ -2801,7 +2802,8 @@ ExprTokenizer.prototype.get_dict_literal_key = function() {
28012802
this.reader.seek_cur(1);
28022803
s += c;
28032804
}
2804-
return s;
2805+
node.value = "'" + s + "'";
2806+
return node;
28052807
}
28062808

28072809
function ExprParser() { this.__init__.apply(this, arguments); }
@@ -3507,7 +3509,7 @@ ExprParser.prototype.parse_expr9 = function() {
35073509
return node;
35083510
}
35093511
while (1) {
3510-
var key = is_litdict ? this.parse_dict_literal_key() : this.parse_expr1();
3512+
var key = is_litdict ? this.tokenizer.parse_dict_literal_key() : this.parse_expr1();
35113513
var token = this.tokenizer.get();
35123514
if (token.type == TOKEN_CCLOSE) {
35133515
if (!viml_empty(node.value)) {
@@ -3583,13 +3585,6 @@ ExprParser.prototype.parse_expr9 = function() {
35833585
return node;
35843586
}
35853587

3586-
ExprParser.prototype.parse_dict_literal_key = function() {
3587-
var node = Node(NODE_STRING);
3588-
node.pos = this.reader.tell();
3589-
node.value = "'" + this.tokenizer.get_dict_literal_key() + "'";
3590-
return node;
3591-
}
3592-
35933588
// SUBSCRIPT or CONCAT
35943589
// dict "." [0-9A-Za-z_]+ => (subscript dict key)
35953590
// str "." expr6 => (concat str expr6)

0 commit comments

Comments
 (0)