Kaynağa Gözat

Only allow identifiers after the '.' in a field expression

pull/2/head
Max Brunsfeld 9 yıl önce
ebeveyn
işleme
7930ba3917
4 değiştirilmiş dosya ile 29161 ekleme ve 31927 silme
  1. +4
    -4
      grammar.js
  2. +1
    -1
      package.json
  3. +2
    -2
      src/grammar.json
  4. +29154
    -31920
      src/parser.c

+ 4
- 4
grammar.js Dosyayı Görüntüle

@ -17,7 +17,7 @@ const PREC = {
CAST: 13, CAST: 13,
UNARY: 14, UNARY: 14,
FIELD: 15, FIELD: 15,
SUBSCRIPT: 16,
SUBSCRIPT: 16
}; };
module.exports = grammar({ module.exports = grammar({
@ -520,8 +520,8 @@ module.exports = grammar({
), ),
field_expression: $ => choice( field_expression: $ => choice(
prec.left(PREC.FIELD, seq($._expression, '.', $._expression)),
prec.left(PREC.FIELD, seq($._expression, '->', $._expression))
prec.left(PREC.FIELD, seq($._expression, '.', $.identifier)),
prec.left(PREC.FIELD, seq($._expression, '->', $.identifier))
), ),
compound_literal_expression: $ => seq( compound_literal_expression: $ => seq(
@ -613,7 +613,7 @@ module.exports = grammar({
repeat(choice(/[^\*]/, /\*[^/]/)), repeat(choice(/[^\*]/, /\*[^/]/)),
'*/' '*/'
) )
)),
))
} }
}); });

+ 1
- 1
package.json Dosyayı Görüntüle

@ -17,7 +17,7 @@
"tree-sitter-compiler": ">= 0.0.45" "tree-sitter-compiler": ">= 0.0.45"
}, },
"scripts": { "scripts": {
"prepublish": "tree-sitter compile && node-gyp build",
"build": "tree-sitter compile && node-gyp build",
"test": "tree-sitter test" "test": "tree-sitter test"
} }
} }

+ 2
- 2
src/grammar.json Dosyayı Görüntüle

@ -2595,7 +2595,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression"
"name": "identifier"
} }
] ]
} }
@ -2616,7 +2616,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression"
"name": "identifier"
} }
] ]
} }

+ 29154
- 31920
src/parser.c
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


Yükleniyor…
İptal
Kaydet