Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support __ENCODING__ as keyword #499

Merged
merged 3 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rdoc/ruby_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
11 changes: 11 additions & 0 deletions test/test_rdoc_ruby_lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down