Skip to content

Commit 48f124a

Browse files
authored
fix(tolk/grammar): support triple quotes strings (#41)
1 parent 939016f commit 48f124a

File tree

5 files changed

+730
-644
lines changed

5 files changed

+730
-644
lines changed

server/src/languages/tolk/tree-sitter-tolk/grammar.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,13 @@ const TOLK_GRAMMAR = {
611611
// common constructions
612612

613613
number_literal: $ => token(choice(seq("0x", /[0-9a-fA-F]+/), seq("0b", /[01]+/), /[0-9]+/)),
614-
string_literal: $ => /"[^"]*"\w?/,
614+
string_literal: $ =>
615+
token(
616+
choice(
617+
/"""\s*[\s\S]*?"""/, // triple quotes
618+
/"(?:[^"\\\n]|\\.)*"/, // sing quote
619+
),
620+
),
615621
boolean_literal: $ => choice("true", "false"),
616622
null_literal: $ => "null",
617623
underscore: $ => "_",

server/src/languages/tolk/tree-sitter-tolk/src/grammar.json

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)