Use a separate machine for closing tags.

This makes it easier to advance column numbers for whitespace as well as
captuing and emitting tokens for the closing tag.
This commit is contained in:
Yorick Peterse committed 2014-03-11 21:55:36 +01:00
1 parent eacd9b88cf
commit 77b40d2e81
1 file changed
+20 -9
+20 -9
View File
@@ -269,6 +269,24 @@ module Oga
};
*|;
element_closing_tag := |*
whitespace => { advance_column };
element_name => {
emit_text_buffer
add_token(:T_ELEM_CLOSE, nil)
# Advance the column for the </
advance_column(2)
# Advance the column for the closing name.
advance_column(@te - p)
fret;
};
'>' => { fret; };
*|;
element := |*
whitespace => { advance_column };
@@ -289,15 +307,8 @@ module Oga
'=' (dquote @string_dquote | squote @string_squote);
# Non self-closing elements.
'</' element_name {
emit_text_buffer
add_token(:T_ELEM_CLOSE, nil)
# Advance the column for the </
advance_column(2)
# Advance the column for the closing name.
advance_column(@te - p)
'</' => {
fcall element_closing_tag;
fret;
};