diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-06-17 03:09:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-06-17 03:09:52 +0900 |
commit | a064e46762ec0bfd40e6a04242d9e62fdd21e1f0 (patch) | |
tree | aaeca83e2bd8175641978f24d520a2f9b10bde8e /tool/pure_parser.rb | |
parent | 53e9908d8afc7f03109b0aafd1698ab35f512b05 (diff) |
Support Bison 3
Diffstat (limited to 'tool/pure_parser.rb')
-rwxr-xr-x | tool/pure_parser.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tool/pure_parser.rb b/tool/pure_parser.rb new file mode 100755 index 0000000000..20d71079a0 --- /dev/null +++ b/tool/pure_parser.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby -pi +BEGIN { + require_relative 'colorize' + + colorize = Colorize.new + file = ARGV.shift + unless /\Abison .* (\d+)\.\d+/ =~ IO.popen(ARGV+%w[--version], &:read) + 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') |