diff --git a/grammar.js b/grammar.js index 4bef2c1..9863085 100644 --- a/grammar.js +++ b/grammar.js @@ -80,8 +80,8 @@ module.exports = grammar({ field('attr_shortcuts', $.attr_shortcuts), ) ), - optional(field('attrs', $.attrs)), optional($._output_modifiers), + optional(field('attrs', $.attrs)), choice( $._inline, seq( diff --git a/src/grammar.json b/src/grammar.json index 7f1a1ed..59429c5 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -170,12 +170,8 @@ "type": "CHOICE", "members": [ { - "type": "FIELD", - "name": "attrs", - "content": { - "type": "SYMBOL", - "name": "attrs" - } + "type": "SYMBOL", + "name": "_output_modifiers" }, { "type": "BLANK" @@ -186,8 +182,12 @@ "type": "CHOICE", "members": [ { - "type": "SYMBOL", - "name": "_output_modifiers" + "type": "FIELD", + "name": "attrs", + "content": { + "type": "SYMBOL", + "name": "attrs" + } }, { "type": "BLANK" diff --git a/test/corpus/tags.txt b/test/corpus/tags.txt index 56d7f85..15adb81 100644 --- a/test/corpus/tags.txt +++ b/test/corpus/tags.txt @@ -45,6 +45,42 @@ Tag with space before traling space modifier (css_identifier))) (element_text))) +===================================================== +Trailing space modifier with non-delimited attributes +===================================================== + +a< title="example" + +---- + +(source_file + (element + (tag_name) + (output_modifier_leading_whitespace) + (attrs + (attr + (attr_name) + (attr_assignment) + (attr_value))))) + +=============================================================== +Trailing space modifier with delimited attributes without space +=============================================================== + +a<[title="example"] + +---- + +(source_file + (element + (tag_name) + (output_modifier_leading_whitespace) + (attrs + (attr + (attr_name) + (attr_assignment) + (attr_value))))) + ============================= Extension attribute shortcuts =============================