[前][次][番号順一覧][スレッド一覧]

ruby-changes:65370

From: usa <ko1@a...>
Date: Mon, 1 Mar 2021 22:23:45 +0900 (JST)
Subject: [ruby-changes:65370] e5bc1fea43 (ruby_2_6): merge revision(s) e9bb30d4, a064e467, 4d753461: [Backport #16998]

https://git.ruby-lang.org/ruby.git/commit/?id=e5bc1fea43

From e5bc1fea43b6694893d7cb6550401f7dcfd2b924 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon, 1 Mar 2021 13:23:20 +0000
Subject: 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
---
 common.mk           |  1 +
 parse.y             |  3 ++-
 tool/pure_parser.rb | 20 ++++++++++++++++++++
 version.h           |  2 +-
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 tool/pure_parser.rb

diff --git a/common.mk b/common.mk
index 4f72928..705a102 100644
--- a/common.mk
+++ b/common.mk
@@ -845,6 +845,7 @@ PHONY: https://github.com/ruby/ruby/blob/trunk/common.mk#L845
 {$(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 bf73fb1..3338dcd 100644
--- a/parse.y
+++ b/parse.y
@@ -758,7 +758,8 @@ static void token_info_pop(struct parser_params*, const char *token, const rb_co https://github.com/ruby/ruby/blob/trunk/parse.y#L758
 static void token_info_warn(struct parser_params *p, const char *token, token_info *ptinfo_beg, int same, const rb_code_location_t *loc);
 %}
 
-%pure-parser
+%expect 0
+%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 100644
index 0000000..aa00a2d
--- /dev/null
+++ b/tool/pure_parser.rb
@@ -0,0 +1,20 @@ 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
+  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')
diff --git a/version.h b/version.h
index 45e5a0b..3b12402 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.7"
 #define RUBY_RELEASE_DATE "2021-03-01"
-#define RUBY_PATCHLEVEL 164
+#define RUBY_PATCHLEVEL 165
 
 #define RUBY_RELEASE_YEAR 2021
 #define RUBY_RELEASE_MONTH 3
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]