diff --git a/lib/oga/lexer.rl b/lib/oga/lexer.rl index eaeef07..a24bbcd 100644 --- a/lib/oga/lexer.rl +++ b/lib/oga/lexer.rl @@ -73,19 +73,19 @@ module Oga any_escaped = /\\./; - smaller = '<'; - greater = '>'; - slash = '/'; - exclamation = '!'; - equals = '='; - colon = ':'; - dash = '-'; + smaller = '<'; + greater = '>'; + slash = '/'; + bang = '!'; + equals = '='; + colon = ':'; + dash = '-'; s_quote = "'"; d_quote = '"'; # FIXME: there really should be a better way of doing this. - text = (any - s_quote - d_quote - equals - exclamation - slash - + text = (any - s_quote - d_quote - equals - bang - slash - greater - smaller - whitespace - newline - colon - dash)+; # Unicode characters, taken from whitequark's wonderful parser library. @@ -95,18 +95,18 @@ module Oga unicode = any - ascii; main := |* - whitespace => { t(:T_SPACE) }; - newline => { t(:T_NEWLINE); advance_line }; - smaller => { t(:T_SMALLER) }; - greater => { t(:T_GREATER) }; - slash => { t(:T_SLASH) }; - d_quote => { t(:T_DQUOTE) }; - s_quote => { t(:T_SQUOTE) }; - dash => { t(:T_DASH) }; - colon => { t(:T_COLON) }; - exclamation => { t(:T_EXCLAMATION) }; - equals => { t(:T_EQUALS) }; - text => { t(:T_TEXT) }; + whitespace => { t(:T_SPACE) }; + newline => { t(:T_NEWLINE); advance_line }; + smaller => { t(:T_SMALLER) }; + greater => { t(:T_GREATER) }; + slash => { t(:T_SLASH) }; + d_quote => { t(:T_DQUOTE) }; + s_quote => { t(:T_SQUOTE) }; + dash => { t(:T_DASH) }; + colon => { t(:T_COLON) }; + bang => { t(:T_BANG) }; + equals => { t(:T_EQUALS) }; + text => { t(:T_TEXT) }; *|; }%% end # Lexer diff --git a/spec/oga/lexer_spec.rb b/spec/oga/lexer_spec.rb index ce36481..40e0548 100644 --- a/spec/oga/lexer_spec.rb +++ b/spec/oga/lexer_spec.rb @@ -104,7 +104,7 @@ describe Oga::Lexer do example 'lex a comment' do lex('').should == [ [:T_SMALLER, '<', 1, 1], - [:T_EXCLAMATION, '!', 1, 2], + [:T_BANG, '!', 1, 2], [:T_DASH, '-', 1, 3], [:T_DASH, '-', 1, 4], [:T_SPACE, ' ', 1, 5],