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 | |
parent | a7133b05718f59eccc95e67781f0d6e109bf3023 (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
-rw-r--r-- | common.mk | 1 | ||||
-rw-r--r-- | parse.y | 3 | ||||
-rw-r--r-- | tool/pure_parser.rb | 20 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 24 insertions, 2 deletions
@@ -845,6 +845,7 @@ PHONY: {$(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 @@ -758,7 +758,8 @@ static void token_info_pop(struct parser_params*, const char *token, const rb_co 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 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') @@ -1,6 +1,6 @@ #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 |