Skip to content

Commit

Permalink
Merge pull request #3676 from masatake/ruby--skip-data-1
Browse files Browse the repository at this point in the history
Ruby: skip if __DATA__ is found
  • Loading branch information
masatake authored Mar 24, 2023
2 parents af30abc + 73b2be6 commit a55d97f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions Units/parser-ruby.r/ruby-skip-data.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sort=no
1 change: 1 addition & 0 deletions Units/parser-ruby.r/ruby-skip-data.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a input.rb /^def a()$/;" f
5 changes: 5 additions & 0 deletions Units/parser-ruby.r/ruby-skip-data.d/input.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def a()
end
__END__
def b()
end
12 changes: 9 additions & 3 deletions parsers/ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,10 +1011,16 @@ static void findRubyTags (void)
* separators are "do", ";" or newline */
bool expect_separator = false;

if (found_rdoc == false && strncmp ((const char*)cp, "# =", 3) == 0)
if (found_rdoc == false)
{
found_rdoc = true;
makePromise ("RDoc", 0, 0, 0, 0, 0);
if (strncmp ((const char*)cp, "__END__", 7) == 0)
break;

if (strncmp ((const char*)cp, "# =", 3) == 0)
{
found_rdoc = true;
makePromise ("RDoc", 0, 0, 0, 0, 0);
}
}

if (canMatch (&cp, "=begin", isWhitespace))
Expand Down

0 comments on commit a55d97f

Please sign in to comment.