Skip to content

Commit

Permalink
Merge pull request #499 from aycabta/support-encoding-keyword
Browse files Browse the repository at this point in the history
Support __ENCODING__ as keyword
hsbt authored Aug 23, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 71b01e3 + e2d1e17 commit 8566973
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rdoc/ruby_token.rb
Original file line number Diff line number Diff line change
@@ -322,6 +322,7 @@ def Token(token, value = nil)
[:TklEND, TkKW, "END", :EXPR_END],
[:Tk__LINE__, TkKW, "__LINE__", :EXPR_END],
[:Tk__FILE__, TkKW, "__FILE__", :EXPR_END],
[:Tk__ENCODING__,TkKW, "__ENCODING__", :EXPR_END],

[:TkIDENTIFIER, TkId],
[:TkFID, TkId],
11 changes: 11 additions & 0 deletions test/test_rdoc_ruby_lex.rb
Original file line number Diff line number Diff line change
@@ -62,6 +62,17 @@ def test_class_tokenize___END__
assert_equal expected, tokens
end

def test_class_tokenize___ENCODING__
tokens = RDoc::RubyLex.tokenize '__ENCODING__', nil

expected = [
@TK::Tk__ENCODING__.new( 0, 1, 0, '__ENCODING__'),
@TK::TkNL .new(12, 1, 12, "\n"),
]

assert_equal expected, tokens
end

def test_class_tokenize_character_literal
tokens = RDoc::RubyLex.tokenize "?c", nil

0 comments on commit 8566973

Please sign in to comment.