From 32b1fa5555639dd8fa34064851041b5405f32581 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 5 Jan 2023 16:53:09 +0300 Subject: [PATCH] grammar: add escape sequence for label and attr value --- grammar.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/grammar.js b/grammar.js index 1b886cf..114b847 100644 --- a/grammar.js +++ b/grammar.js @@ -293,7 +293,17 @@ module.exports = grammar({ dot: ($) => token("."), _unquoted_string: ($) => - token(prec(PREC.UNQUOTED_STRING, /[^'"`|\n\s;{}]([^\n;{}]*[^\n\s;{}])?/)), + repeat1( + choice( + $.escape_sequence, + token( + prec( + PREC.UNQUOTED_STRING, + /[^'"`\\|\n\s;{}]([^\\\n;{}]*[^\\\n\s;{}])?/ + ) + ) + ) + ), string: ($) => choice(