File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -866,21 +866,32 @@ module.exports = grammar({
866
866
seq (
867
867
'"' ,
868
868
repeat ( choice (
869
- token . immediate ( prec ( 1 , / [ ^ " \\ ] + / ) ) ,
869
+ alias ( $ . unescaped_double_string_fragment , $ . string_fragment ) ,
870
870
$ . escape_sequence
871
871
) ) ,
872
872
'"'
873
873
) ,
874
874
seq (
875
875
"'" ,
876
876
repeat ( choice (
877
- token . immediate ( prec ( 1 , / [ ^ ' \\ ] + / ) ) ,
877
+ alias ( $ . unescaped_single_string_fragment , $ . string_fragment ) ,
878
878
$ . escape_sequence
879
879
) ) ,
880
880
"'"
881
881
)
882
882
) ,
883
883
884
+ // Workaround to https://github.com/tree-sitter/tree-sitter/issues/1156
885
+ // We give names to the token() constructs containing a regexp
886
+ // so as to obtain a node in the CST.
887
+ //
888
+ unescaped_double_string_fragment : $ =>
889
+ token . immediate ( prec ( 1 , / [ ^ " \\ ] + / ) ) ,
890
+
891
+ // same here
892
+ unescaped_single_string_fragment : $ =>
893
+ token . immediate ( prec ( 1 , / [ ^ ' \\ ] + / ) ) ,
894
+
884
895
escape_sequence : $ => token . immediate ( seq (
885
896
'\\' ,
886
897
choice (
You can’t perform that action at this time.
0 commit comments