Bläddra i källkod

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

pull/2/head
Max Brunsfeld 9 år sedan
förälder
incheckning
7930ba3917
4 ändrade filer med 29161 tillägg och 31927 borttagningar
  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 Visa fil

@ -17,7 +17,7 @@ const PREC = {
CAST: 13,
UNARY: 14,
FIELD: 15,
SUBSCRIPT: 16,
SUBSCRIPT: 16
};
module.exports = grammar({
@ -520,8 +520,8 @@ module.exports = grammar({
),
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(
@ -613,7 +613,7 @@ module.exports = grammar({
repeat(choice(/[^\*]/, /\*[^/]/)),
'*/'
)
)),
))
}
});

+ 1
- 1
package.json Visa fil

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

+ 2
- 2
src/grammar.json Visa fil

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

+ 29154
- 31920
src/parser.c
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


Laddar…
Avbryt
Spara