Skip to content
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
8 changes: 4 additions & 4 deletions lib/rdoc/parser/ripper_state_lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ def get_squashed_tk
when :on_tstring_beg then
tk = get_string_tk(tk)
when :on_backtick then
if ((EXPR_FNAME | EXPR_ENDFN) & tk[:state]) != 0
if (tk[:state] & (EXPR_FNAME | EXPR_ENDFN)) != 0
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
tk[:kind] = :on_ident
tk[:state] = EXPR_ARG
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
else
tk = get_string_tk(tk)
end
Expand Down Expand Up @@ -558,9 +558,9 @@ def get_squashed_tk

private def get_op_tk(tk)
redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~]
if redefinable_operators.include?(tk[:text]) and EXPR_ARG == tk[:state] then
if redefinable_operators.include?(tk[:text]) and tk[:state] == EXPR_ARG then
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
tk[:state] = EXPR_ARG
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
tk[:kind] = :on_ident
elsif tk[:text] =~ /^[-+]$/ then
tk_ahead = get_squashed_tk
Expand Down
8 changes: 4 additions & 4 deletions lib/rdoc/parser/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc:
elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
nest += 1
elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
nest += 1
end
elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
Expand Down Expand Up @@ -1538,7 +1538,7 @@ def parse_method_or_yield_parameters(method = nil,
when :on_comment, :on_embdoc then
@read.pop
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
(!continue or (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) != 0) then
(!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then
if method && method.block_params.nil? then
unget_tk tk
read_documentation_modifiers method, modifiers
Expand Down Expand Up @@ -1743,7 +1743,7 @@ def parse_statements(container, single = NORMAL, current_method = nil,
end

when 'until', 'while' then
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
nest += 1
skip_optional_do_after_expression
end
Expand All @@ -1759,7 +1759,7 @@ def parse_statements(container, single = NORMAL, current_method = nil,
skip_optional_do_after_expression

when 'case', 'do', 'if', 'unless', 'begin' then
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
nest += 1
end

Expand Down