1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/pure_parser.rb
usa e5bc1fea43 merge revision(s) e9bb30d4,a064e467,4d753461: [Backport #16998]
Expect no conflict in the parser

	---
	 parse.y | 1 +
	 1 file changed, 1 insertion(+)

	Support Bison 3

	---
	 common.mk           |  1 +
	 parse.y             |  2 +-
	 tool/pure_parser.rb | 15 +++++++++++++++
	 3 files changed, 17 insertions(+), 1 deletion(-)
	 create mode 100755 tool/pure_parser.rb

	Refine error message

	Highlight failed command and suggest installing the command.
	[Bug #16042]
	---
	 tool/pure_parser.rb | 7 ++++++-
	 1 file changed, 6 insertions(+), 1 deletion(-)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2021-03-01 13:23:20 +00:00

20 lines
481 B
Ruby

#!/usr/bin/ruby -pi
BEGIN {
require_relative 'colorize'
colorize = Colorize.new
file = ARGV.shift
begin
version = IO.popen(ARGV+%w[--version], &:read)
rescue Errno::ENOENT
abort "Failed to run `#{colorize.fail ARGV.join(' ')}'; You may have to install it."
end
unless /\Abison .* (\d+)\.\d+/ =~ version
puts colorize.fail("not bison")
exit
end
exit if $1.to_i >= 3
ARGV.clear
ARGV.push(file)
}
$_.sub!(/^%define\s+api\.pure/, '%pure-parser')