diff --git a/lib/oga/lexer.rl b/lib/oga/lexer.rl index 02d45f3..3f27445 100644 --- a/lib/oga/lexer.rl +++ b/lib/oga/lexer.rl @@ -282,7 +282,7 @@ module Oga action start_doctype { emit_buffer - t(:T_DOCTYPE_START) + add_token(:T_DOCTYPE_START, nil) fcall doctype; } @@ -300,7 +300,7 @@ module Oga whitespace; '>' => { - t(:T_DOCTYPE_END) + add_token(:T_DOCTYPE_END, nil) fret; }; *|; diff --git a/spec/oga/lexer/doctype_spec.rb b/spec/oga/lexer/doctype_spec.rb index d96e59d..757d9a8 100644 --- a/spec/oga/lexer/doctype_spec.rb +++ b/spec/oga/lexer/doctype_spec.rb @@ -4,28 +4,28 @@ describe Oga::Lexer do context 'doctypes' do example 'lex the HTML5 doctype' do lex('').should == [ - [:T_DOCTYPE_START, '', 1] + [:T_DOCTYPE_START, nil, 1], + [:T_DOCTYPE_END, nil, 1] ] end example 'lex a doctype with a public and system ID' do lex('').should == [ - [:T_DOCTYPE_START, '', 1] + [:T_DOCTYPE_END, nil, 1] ] end example 'lex a doctype with a public and system ID using single quotes' do lex("").should == [ - [:T_DOCTYPE_START, '', 1] + [:T_DOCTYPE_END, nil, 1] ] end end diff --git a/spec/oga/lexer/documents_spec.rb b/spec/oga/lexer/documents_spec.rb index 839d993..83d63c0 100644 --- a/spec/oga/lexer/documents_spec.rb +++ b/spec/oga/lexer/documents_spec.rb @@ -14,8 +14,8 @@ describe Oga::Lexer do EOF lex(html).should == [ - [:T_DOCTYPE_START, '', 1], + [:T_DOCTYPE_START, nil, 1], + [:T_DOCTYPE_END, nil, 1], [:T_TEXT, "\n", 1], #