Skip to content

Commit

Permalink
Rake: accept symbols defined with single and double quote characters
Browse files Browse the repository at this point in the history
Close #3474.

A symbol defined with single and double quote characters like :'name'
and :"name" caused a crash of the Rake prser.

The original code handled the initial character, <:> of a name like
<:name> in the Rake parser side. The Rake passed the rest of string
(<name>) to rubyParseMethodName() exported from the Ruby parser.

However, rubyParseMethodName() itself has an ability to handle the initial
character. So this commit makes the Rake parser pass whole <:name> to
rubyParseMethodName(). The single and double quote characters after <:>
is handled in rubyParseMethodName().

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Sep 4, 2022
1 parent aaa391f commit 57a52a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Units/parser-rake.r/xtasks.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ verify_private_key_present input.rake /^task :verify_private_key_present do$/;"
build input.rake /^task :build => :verify_private_key_present$/;" task
default input-0.rake /^task :default => :test$/;" task
test input-0.rake /^Rake::TestTask.new 'test' do |t|$/;" xtask typeref:typename:Rake::TestTask.new
spec:rcovSingle input-1.rake /^RSpec::Core::RakeTask.new(:'spec:rcovSingle') do |t|$/;" xtask typeref:typename:RSpec::Core::RakeTask.new
spec:rcovDouble input-1.rake /^RSpec::Core::RakeTask.new(:"spec:rcovDouble") do |t|$/;" xtask typeref:typename:RSpec::Core::RakeTask.new
19 changes: 19 additions & 0 deletions Units/parser-rake.r/xtasks.d/input-1.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://raw.githubusercontent.com/apache/thrift/master/lib/rb/Rakefile
RSpec::Core::RakeTask.new(:'spec:rcovSingle') do |t|
t.rspec_opts = ['--color', '--format d']
t.rcov = true
t.rcov_opts = ['--exclude', '^spec,/gems/']
end

RSpec::Core::RakeTask.new(:"spec:rcovDouble") do |t|
t.rspec_opts = ['--color', '--format d']
t.rcov = true
t.rcov_opts = ['--exclude', '^spec,/gems/']
end

# The next one may be extracted.
RSpec::Core::RakeTask.new(:) do |t|
t.rspec_opts = ['--color', '--format d']
t.rcov = true
t.rcov_opts = ['--exclude', '^spec,/gems/']
end
1 change: 0 additions & 1 deletion parsers/rake.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ static vString *readTask (const unsigned char **cp, bool *variable)
}
break;
case ':':
++*cp;
vstr = vStringNew ();
if (!rubyParseMethodName (cp, vstr))
{
Expand Down

0 comments on commit 57a52a7

Please sign in to comment.