ruby_parser
Advanced tools
+6
-0
@@ -0,1 +1,7 @@ | ||
| === 3.20.1 / 2023-05-16 | ||
| * 1 minor enhancement: | ||
| * Fixes Sexp#line_max in parser for many constructs: paren_args, arrays of various sorts, calls, classes, modules, etc. | ||
| === 3.20.0 / 2023-03-04 | ||
@@ -2,0 +8,0 @@ |
@@ -21,3 +21,3 @@ # encoding: ASCII-8BIT | ||
| ## | ||
| # Returns the maximum line number of the children of self. | ||
| # Returns the minimum line number of the children of self. | ||
@@ -34,3 +34,3 @@ def line_min | ||
| module RubyParserStuff | ||
| VERSION = "3.20.0" | ||
| VERSION = "3.20.1" | ||
@@ -158,2 +158,3 @@ attr_accessor :lexer, :in_def, :in_single, :file | ||
| result.line ss.first.line | ||
| result.line_max = ss.first.line_max | ||
| end | ||
@@ -336,5 +337,4 @@ | ||
| args.each do |arg| | ||
| if arg.instance_of? Array and arg.size == 2 and arg.last.is_a? Numeric then | ||
| arg = arg.first | ||
| end | ||
| # ruby 3.0+ TODO: next if arg in [String, Integer] # eg ["(", 1] | ||
| next if arg.class == Array && arg.map(&:class) == [String, Integer] | ||
@@ -801,2 +801,3 @@ case arg | ||
| lhs << rhs | ||
| lhs.line_max = rhs.line_max | ||
| when :const then | ||
@@ -893,3 +894,3 @@ lhs.sexp_type = :cdecl | ||
| if args | ||
| if args then | ||
| if ARG_TYPES[args.sexp_type] then | ||
@@ -900,2 +901,3 @@ result.concat args.sexp_body | ||
| end | ||
| result.line_max = args.line_max | ||
| end | ||
@@ -937,3 +939,3 @@ | ||
| # TODO: get line from class keyword | ||
| line, path, superclass, body = val[1], val[2], val[3], val[5] | ||
| _, line, path, superclass, _, body, (_, line_max) = val | ||
@@ -953,2 +955,3 @@ path = path.first if path.instance_of? Array | ||
| result.line = line | ||
| result.line_max = line_max | ||
| result.comments = self.comments.pop | ||
@@ -982,3 +985,3 @@ result | ||
| def new_defn val | ||
| _, (name, line), in_def, args, body, _ = val | ||
| _, (name, line), in_def, args, body, (_, line_max) = val | ||
@@ -990,2 +993,3 @@ body ||= s(:nil).line line | ||
| result = s(:defn, name.to_sym, args).line line | ||
| result.line_max = line_max | ||
@@ -1047,3 +1051,3 @@ if body.sexp_type == :block then | ||
| def new_defs val | ||
| _, recv, (name, line), in_def, args, body, _ = val | ||
| _, recv, (name, line), in_def, args, body, (_, line_max) = val | ||
@@ -1055,2 +1059,3 @@ body ||= s(:nil).line line | ||
| result = s(:defs, recv, name.to_sym, args).line line | ||
| result.line_max = line_max | ||
@@ -1220,8 +1225,8 @@ # TODO: remove_begin | ||
| def new_module val | ||
| # TODO: get line from module keyword | ||
| line, path, body = val[1], val[2], val[4] | ||
| (_, line_min), _, path, _, body, (_, line_max) = val | ||
| path = path.first if path.instance_of? Array | ||
| result = s(:module, path).line line | ||
| result = s(:module, path).line line_min | ||
| result.line_max = line_max | ||
@@ -1308,5 +1313,6 @@ if body then # REFACTOR? | ||
| def new_regexp val | ||
| (_, line), node, (options, _) = val | ||
| (_, line), node, (options, line_max) = val | ||
| node ||= s(:str, "").line line | ||
| node.line_max = line_max | ||
@@ -1313,0 +1319,0 @@ o, k = 0, nil |
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
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
Sorry, the diff of this file is not supported yet
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