From 95b8b772d565318b0ae1022286d606bcc640df09 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 12 Jun 2018 14:06:16 -0700 Subject: [PATCH] Handle void tags at EOF --- corpus/main.txt | 12 ++++++++++++ src/scanner.cc | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/corpus/main.txt b/corpus/main.txt index 0fc0aa8..10ad92c 100644 --- a/corpus/main.txt +++ b/corpus/main.txt @@ -77,6 +77,18 @@ Void tags (attribute (attribute_name) (attribute_value)))) (end_tag (tag_name)))) +================================== +Void tags at EOF +================================== + +--- + +(fragment + (element + (start_tag + (tag_name) + (attribute (attribute_name) (quoted_attribute_value (attribute_value)))))) + ================================== Custom tags ================================== diff --git a/src/scanner.cc b/src/scanner.cc index ff159b6..ad8dab7 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -223,6 +223,12 @@ struct Scanner { } break; + case '\0': + if (valid_symbols[IMPLICIT_END_TAG]) { + return scan_implicit_end_tag(lexer); + } + break; + case '/': if (valid_symbols[SELF_CLOSING_TAG_DELIMITER]) { return scan_self_closing_tag_delimiter(lexer);