diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-03-01 13:23:20 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-03-01 13:23:20 +0000 |
commit | e5bc1fea43b6694893d7cb6550401f7dcfd2b924 (patch) | |
tree | 352e113b6fb119471b3bfad3f4374363450d62f8 /tool/pure_parser.rb | |
parent | a7133b05718f59eccc95e67781f0d6e109bf3023 (diff) | |
download | ruby-e5bc1fea43b6694893d7cb6550401f7dcfd2b924.tar.gz |
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/pure_parser.rb')
-rw-r--r-- | tool/pure_parser.rb | 20 |
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') |