From 615b9310358ff80c81dc549b9c0c7f5060068933 Mon Sep 17 00:00:00 2001 From: Samuel Sieg Date: Wed, 3 Jul 2024 08:37:52 +0200 Subject: [PATCH 1/2] Allows space before the attr delimiter --- grammar.js | 1 + test/corpus/attributes.txt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/grammar.js b/grammar.js index b19ba95..f4bbaea 100644 --- a/grammar.js +++ b/grammar.js @@ -149,6 +149,7 @@ module.exports = grammar({ ), [`_attrs_delimited_${suffix}`]: $ => seq( + optional($._space), delim_open, repeat(seq( optional($._space_or_newline), alias($[`_attr_delimited_${suffix}`], $.attr) diff --git a/test/corpus/attributes.txt b/test/corpus/attributes.txt index 3110bb0..6db05a4 100644 --- a/test/corpus/attributes.txt +++ b/test/corpus/attributes.txt @@ -131,6 +131,25 @@ a[ ----- +(source_file + (element + (tag_name) + (attrs + (attr + (attr_name) + (attr_assignment) + (attr_value))))) + +=============================================== +String attributes - delimited multiline variant +=============================================== + +a { + href="/" + } + +----- + (source_file (element (tag_name) From 497720c82cf6b7691cc1228d415ead2d530dd8b5 Mon Sep 17 00:00:00 2001 From: Samuel Sieg Date: Wed, 3 Jul 2024 08:48:04 +0200 Subject: [PATCH 2/2] Update test --- test/corpus/attributes.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/corpus/attributes.txt b/test/corpus/attributes.txt index 6db05a4..4e5bd6a 100644 --- a/test/corpus/attributes.txt +++ b/test/corpus/attributes.txt @@ -140,13 +140,13 @@ a[ (attr_assignment) (attr_value))))) -=============================================== -String attributes - delimited multiline variant -=============================================== +=================================================================== +String attributes - delimited multiline with space before delimiter +=================================================================== a { - href="/" - } + href="/" +} -----