ruby_parser
Advanced tools
+12
-0
@@ -0,1 +1,13 @@ | ||
| === 3.20.3 / 2023-07-11 | ||
| * 2 minor enhancements: | ||
| * Added Parser#in_argdef and integrated into 3.x parsers. | ||
| * Improved tools/munge.rb to handler MRI 3.2 output | ||
| * 2 bug fixes: | ||
| * Fixed process_dots to properly deal with paren-less forward_args. (eric1234) | ||
| * Fixed tools/ripper.rb to properly print ripper sexp at the end | ||
| === 3.20.2 / 2023-06-06 | ||
@@ -2,0 +14,0 @@ |
+13
-7
@@ -120,3 +120,3 @@ # frozen_string_literal: true | ||
| @lex_state = nil # remove one warning under $DEBUG | ||
| self.lex_state = EXPR_NONE | ||
| @lex_state = EXPR_NONE | ||
@@ -359,5 +359,11 @@ self.cond = RubyParserStuff::StackState.new(:cond, $DEBUG) | ||
| def process_dots text | ||
| tokens = ruby27plus? && is_beg? ? BTOKENS : TOKENS | ||
| def process_dots text # parse32.y:10216 | ||
| is_beg = self.is_beg? | ||
| self.lex_state = EXPR_BEG | ||
| return result EXPR_ENDARG, :tBDOT3, text if | ||
| parser.in_argdef && text == "..." # TODO: version check? | ||
| tokens = ruby27plus? && is_beg ? BTOKENS : TOKENS | ||
| result EXPR_BEG, tokens[text], text | ||
@@ -694,3 +700,3 @@ end | ||
| # matching: compare/parse30.y:9039 | ||
| # matching: compare/parse32.y:9031 | ||
| state = if lex_state =~ EXPR_BEG_ANY|EXPR_ARG_ANY|EXPR_DOT then | ||
@@ -717,3 +723,3 @@ cmd_state ? EXPR_CMDARG : EXPR_ARG | ||
| def process_token_keyword keyword | ||
| # matching MIDDLE of parse_ident in compare/parse23.y:8046 | ||
| # matching MIDDLE of parse_ident in compare/parse32.y:9695 | ||
| state = lex_state | ||
@@ -727,3 +733,3 @@ | ||
| case | ||
| when keyword.id0 == :kDO then # parse26.y line 7591 | ||
| when keyword.id0 == :kDO then # parse32.y line 9712 | ||
| case | ||
@@ -900,3 +906,3 @@ when lambda_beginning? then | ||
| def inspect | ||
| return "Value(0)" if n.zero? # HACK? | ||
| return "EXPR_NONE" if n.zero? # HACK? | ||
@@ -903,0 +909,0 @@ names.map { |v, k| k if self =~ v }. |
@@ -33,5 +33,5 @@ # encoding: ASCII-8BIT | ||
| module RubyParserStuff | ||
| VERSION = "3.20.2" | ||
| VERSION = "3.20.3" | ||
| attr_accessor :lexer, :in_def, :in_single, :file | ||
| attr_accessor :lexer, :in_def, :in_single, :file, :in_argdef | ||
| attr_accessor :in_kwarg | ||
@@ -126,2 +126,3 @@ attr_reader :env, :comments | ||
| self.in_kwarg = false | ||
| self.in_argdef = false | ||
@@ -128,0 +129,0 @@ @env = RubyParserStuff::Environment.new |
+8
-2
@@ -177,2 +177,6 @@ #!/usr/bin/env ruby -ws | ||
| next # skip | ||
| when /^Reading a token$/ then # wtf? | ||
| next # skip | ||
| when /^(?:add_delayed_token|parser_dispatch)/ then # dunno what this is yet | ||
| next # skip | ||
| when /^read\s+:(\w+)/ then # read :tNL(tNL) nil | ||
@@ -216,3 +220,5 @@ token = munge $1 | ||
| when /^reduce/ then # ruby_parser side | ||
| puts munge line.chomp | ||
| s = munge line.chomp | ||
| next if s =~ /reduce\s+(\w+) --> \1/ | ||
| puts s | ||
| puts | ||
@@ -228,3 +234,3 @@ when /^(\w+_stack)\.(\w+)/ then | ||
| puts line.gsub("true", "1").gsub("false", "0") | ||
| when /^lex_state: :?([\w|]+) -> :?([\w|]+)(?: (?:at|from) (.*))?/ then | ||
| when /^lex_state: :?([\w|()]+) -> :?([\w|]+)(?: (?:at|from) (.*))?/ then | ||
| a, b, c = $1.upcase, $2.upcase, $3 | ||
@@ -231,0 +237,0 @@ a.gsub!(/EXPR_/, "") |
+13
-11
@@ -24,15 +24,17 @@ #!/usr/bin/env ruby -ws | ||
| sexp = if $b then | ||
| Ripper.sexp src | ||
| else | ||
| rip = MySexpBuilder.new src | ||
| rip.yydebug = $d | ||
| rip.parse | ||
| sexp = nil | ||
| if rip.error? then | ||
| warn "skipping" | ||
| next | ||
| end | ||
| end | ||
| if $b then | ||
| sexp = Ripper.sexp src | ||
| else | ||
| rip = MySexpBuilder.new src | ||
| rip.yydebug = $d | ||
| sexp = rip.parse | ||
| if rip.error? then | ||
| warn "skipping" | ||
| next | ||
| end | ||
| end | ||
| puts "accept" | ||
@@ -39,0 +41,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display