mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix the current parser detection
Since `RUBY_DESCRIPTION` contains the branch name, `/prism/i` can match unexpectedly. Extract the feature lists between revision and platform infos.
This commit is contained in:
parent
7ee127d2d1
commit
a6914c089d
2 changed files with 9 additions and 2 deletions
4
.github/workflows/parse_y.yml
vendored
4
.github/workflows/parse_y.yml
vendored
|
@ -78,7 +78,9 @@ jobs:
|
|||
|
||||
- run: make
|
||||
|
||||
- run: make TESTRUN_SCRIPT='-e "exit !RUBY_DESCRIPTION.include?(%[+PRISM])"' run
|
||||
- run: make TESTRUN_SCRIPT='-renvutil -v -e "exit EnvUtil.current_parser == %[parse.y]"' run
|
||||
env:
|
||||
RUNOPT0: -I$(tooldir)/lib
|
||||
|
||||
- name: make ${{ matrix.test_task }}
|
||||
run: make -s ${{ matrix.test_task }} RUN_OPTS="$RUN_OPTS" SPECOPTS="$SPECOPTS"
|
||||
|
|
|
@ -226,7 +226,6 @@ module EnvUtil
|
|||
args = [args] if args.kind_of?(String)
|
||||
# use the same parser as current ruby
|
||||
if args.none? { |arg| arg.start_with?("--parser=") }
|
||||
current_parser = RUBY_DESCRIPTION =~ /prism/i ? "prism" : "parse.y"
|
||||
args = ["--parser=#{current_parser}"] + args
|
||||
end
|
||||
pid = spawn(child_env, *precommand, rubybin, *args, opt)
|
||||
|
@ -276,6 +275,12 @@ module EnvUtil
|
|||
end
|
||||
module_function :invoke_ruby
|
||||
|
||||
def current_parser
|
||||
features = RUBY_DESCRIPTION[%r{\)\K [-+*/%._0-9a-zA-Z ]*(?=\[[-+*/%._0-9a-zA-Z]+\]\z)}]
|
||||
features&.split&.include?("+PRISM") ? "prism" : "parse.y"
|
||||
end
|
||||
module_function :current_parser
|
||||
|
||||
def verbose_warning
|
||||
class << (stderr = "".dup)
|
||||
alias write concat
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue