Skip to content

Commit 8566973

Browse files
authored
Merge pull request #499 from aycabta/support-encoding-keyword
Support __ENCODING__ as keyword
2 parents 71b01e3 + e2d1e17 commit 8566973

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/rdoc/ruby_token.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ def Token(token, value = nil)
322322
[:TklEND, TkKW, "END", :EXPR_END],
323323
[:Tk__LINE__, TkKW, "__LINE__", :EXPR_END],
324324
[:Tk__FILE__, TkKW, "__FILE__", :EXPR_END],
325+
[:Tk__ENCODING__,TkKW, "__ENCODING__", :EXPR_END],
325326

326327
[:TkIDENTIFIER, TkId],
327328
[:TkFID, TkId],

test/test_rdoc_ruby_lex.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ def test_class_tokenize___END__
6262
assert_equal expected, tokens
6363
end
6464

65+
def test_class_tokenize___ENCODING__
66+
tokens = RDoc::RubyLex.tokenize '__ENCODING__', nil
67+
68+
expected = [
69+
@TK::Tk__ENCODING__.new( 0, 1, 0, '__ENCODING__'),
70+
@TK::TkNL .new(12, 1, 12, "\n"),
71+
]
72+
73+
assert_equal expected, tokens
74+
end
75+
6576
def test_class_tokenize_character_literal
6677
tokens = RDoc::RubyLex.tokenize "?c", nil
6778

0 commit comments

Comments
 (0)