From 615b9310358ff80c81dc549b9c0c7f5060068933 Mon Sep 17 00:00:00 2001 From: Samuel Sieg Date: Wed, 3 Jul 2024 08:37:52 +0200 Subject: [PATCH] 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)