ruby-changes:56126
From: Nobuyoshi <ko1@a...>
Date: Mon, 17 Jun 2019 19:56:32 +0900 (JST)
Subject: [ruby-changes:56126] Nobuyoshi Nakada: a064e46762 (trunk): Support Bison 3
https://git.ruby-lang.org/ruby.git/commit/?id=a064e46762 From a064e46762ec0bfd40e6a04242d9e62fdd21e1f0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 17 Jun 2019 03:09:52 +0900 Subject: Support Bison 3 diff --git a/common.mk b/common.mk index d6e4d6a..f740f93 100755 --- a/common.mk +++ b/common.mk @@ -851,6 +851,7 @@ PHONY: https://github.com/ruby/ruby/blob/trunk/common.mk#L851 {$(srcdir)}.y.c: $(ECHO) generating $@ $(Q)$(BASERUBY) $(srcdir)/tool/id2token.rb --path-separator=.$(PATH_SEPARATOR)./ --vpath=$(VPATH) id.h $(SRC_FILE) > parse.tmp.y + $(Q)$(BASERUBY) $(srcdir)/tool/pure_parser.rb parse.tmp.y $(YACC) $(Q)$(YACC) -d $(YFLAGS) -o y.tab.c parse.tmp.y $(Q)$(RM) parse.tmp.y $(Q)sed -f $(srcdir)/tool/ytab.sed -e "/^#/s|parse\.tmp\.[iy]|$(SRC_FILE)|" -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@.new diff --git a/parse.y b/parse.y index d76d3b2..665067d 100644 --- a/parse.y +++ b/parse.y @@ -910,7 +910,7 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in https://github.com/ruby/ruby/blob/trunk/parse.y#L910 %} %expect 0 -%pure-parser +%define api.pure %lex-param {struct parser_params *p} %parse-param {struct parser_params *p} %initial-action diff --git a/tool/pure_parser.rb b/tool/pure_parser.rb new file mode 100755 index 0000000..20d7107 --- /dev/null +++ b/tool/pure_parser.rb @@ -0,0 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/tool/pure_parser.rb#L1 +#!/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') -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/