feat: add escaped newlines to extras
3 files changed, 25 insertions(+), 2 deletions(-)

M tcl/corpus/terminators.txt
M tcl/grammar.js
M types/tree-sitter-dsl.d.ts
M tcl/corpus/terminators.txt +23 -0
@@ 29,3 29,26 @@ puts Jessie!; puts James!;
  (command
   name: (word)
   arguments: (word_list (word))))
+
+===
+Escaped newlines
+===
+
+set \
+  aList \
+  [list \
+    one \
+    two \
+  ]
+
+---
+
+(source_file
+ (command
+  name: (word)
+  arguments: (word_list
+              (word)
+              (command_substitution
+               (command
+                name: (word)
+                arguments: (word_list (word) (word)))))))

          
M tcl/grammar.js +1 -1
@@ 12,7 12,7 @@ module.exports = grammar({
 
   word: $ => $._word_content,
 
-  extras: _ => [' '],
+  extras: _ => [/\s/, /\\\n/],
 
   inline: $ => [$._terminator],
 

          
M types/tree-sitter-dsl.d.ts +1 -1
@@ 56,7 56,7 @@ interface GrammarDescription<
   extras?: (
     $: RuleProxy<TRules | TExternalRules>,
     baseExtras: SymbolRule<TRules | TExternalRules>[],
-  ) => (SymbolRule<TRules | TExternalRules> | string)[]
+  ) => (SymbolRule<TRules | TExternalRules> | string | RegExp)[]
   conflicts?: (
     $: RuleProxy<TRules | TExternalRules>,
     baseConflicts: SymbolRule<TRules | TExternalRules>[][],