~rockorager/tree-sitter-hare

73dbd11c9eace8aefb740710fb11a5dff7c4e305 — Tim Culverhouse 1 year, 6 months ago d7019d3
add +/- to float/int literals
1 files changed, 23 insertions(+), 15 deletions(-)

M grammar.js
M grammar.js => grammar.js +23 -15
@@ 328,24 328,32 @@ module.exports = grammar({
    void: ($) => token("void"),

    integer_constant: ($) =>
      choice(
        token(seq("0x", hexDigit, optional(integerSuffix))),
        token(seq("0o", octalDigits, optional(integerSuffix))),
        token(seq("0b", binaryDigits, optional(integerSuffix))),
        token(seq(decimalDigits, optional(exponent), optional(integerSuffix))),
      ),
      token(seq(
        optional(/[-\+]/),
        choice(
          token(seq("0x", hexDigit, optional(integerSuffix))),
          token(seq("0o", octalDigits, optional(integerSuffix))),
          token(seq("0b", binaryDigits, optional(integerSuffix))),
          token(
            seq(decimalDigits, optional(exponent), optional(integerSuffix)),
          ),
        ),
      )),

    floating_constant: ($) =>
      choice(
        seq(
          decimalDigits,
          ".",
          decimalDigits,
          optional(exponent),
          optional(floatingSuffix),
      token(seq(
        optional(/[-\+]/),
        choice(
          seq(
            decimalDigits,
            ".",
            decimalDigits,
            optional(exponent),
            optional(floatingSuffix),
          ),
          seq(decimalDigits, optional(exponent), floatingSuffix),
        ),
        seq(decimalDigits, optional(exponent), floatingSuffix),
      ),
      )),

    rune_constant: ($) =>
      seq(