~rockorager/tree-sitter-hare

b4b38b556853a4f76277fbce457b327a38fb34a4 — Tim Culverhouse 1 year, 5 months ago 690c3e9 master
strings: fix raw-string-literal

Raw string literal used "'" instead of "`". Fix this

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2 files changed, 25 insertions(+), 1 deletions(-)

M corpus/types.txt
M grammar.js
M corpus/types.txt => corpus/types.txt +24 -0
@@ 60,6 60,30 @@ let a: str = "foo\n";
      (escape_sequence))))

================================================================================
Strings: raw literal
================================================================================

let a: str = `[{"json": "value"}]`;
--------------------------------------------------------------------------------
(unit
  (global_declaration
    (identifier)
    (string_type)
    (string_literal)))

================================================================================
Strings: raw literal v2
================================================================================

let a: str = `{"json": 2}`;
--------------------------------------------------------------------------------
(unit
  (global_declaration
    (identifier)
    (string_type)
    (string_literal)))

================================================================================
Strings: format sequence
================================================================================


M grammar.js => grammar.js +1 -1
@@ 392,7 392,7 @@ module.exports = grammar({
          repeat(choice(/[^"\\]/, $.escape_sequence, $.format_sequence)),
          '"',
        ),
        seq("'", repeat(choice(/[^']/)), "'"),
        token(seq("`", repeat(/[^`]/), "`")),
      ),

    array_literal: ($) => seq("[", optional($.array_members), "]"),