summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-01 13:23:20 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-01 13:23:20 +0000
commite5bc1fea43b6694893d7cb6550401f7dcfd2b924 (patch)
tree352e113b6fb119471b3bfad3f4374363450d62f8 /tool
parenta7133b05718f59eccc95e67781f0d6e109bf3023 (diff)
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
Diffstat (limited to 'tool')
-rw-r--r--tool/pure_parser.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/tool/pure_parser.rb b/tool/pure_parser.rb
new file mode 100644
index 0000000000..aa00a2defa
--- /dev/null
+++ b/tool/pure_parser.rb
@@ -0,0 +1,20 @@
+#!/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')