ruby_parser
Advanced tools
+12
-0
@@ -0,1 +1,13 @@ | ||
| === 3.12.0 / 2018-12-04 | ||
| * 3 minor enhancements: | ||
| * 2.5: Allow rescue/ensure/else in normal do blocks. (presidentbeef) | ||
| * Added stabby proc with do/end as block call argument. (presidentbeef) | ||
| * Holy cow levels of optimization from presidentbeef. I write slow bad code. | ||
| * 1 bug fix: | ||
| * Improve handling of single-quoted symbols and labels. (mvz) | ||
| === 3.11.0 / 2018-02-14 | ||
@@ -2,0 +14,0 @@ |
+16
-3
@@ -0,1 +1,2 @@ | ||
| # frozen_string_literal: true | ||
| # encoding: UTF-8 | ||
@@ -747,4 +748,14 @@ | ||
| def possibly_escape_string text, check | ||
| content = match[1] | ||
| if text =~ check then | ||
| content.gsub(ESC) { unescape $1 } | ||
| else | ||
| content.gsub(/\\\\/, "\\").gsub(/\\'/, "'") | ||
| end | ||
| end | ||
| def process_symbol text | ||
| symbol = match[1].gsub(ESC) { unescape $1 } | ||
| symbol = possibly_escape_string text, /^:"/ | ||
@@ -775,3 +786,3 @@ rb_compile_error "symbol cannot contain '\\0'" if | ||
| def process_label text | ||
| symbol = text[1..-3].gsub(ESC) { unescape $1 } | ||
| symbol = possibly_escape_string text, /^"/ | ||
@@ -860,2 +871,4 @@ result(:expr_labelarg, :tLABEL, [symbol, self.lineno]) | ||
| result(state, :kDO_BLOCK, value) | ||
| when lex_state == :expr_end # eg: a -> do end do end | ||
| result(state, :kDO_BLOCK, value) | ||
| else | ||
@@ -943,3 +956,3 @@ result(state, :kDO, value) | ||
| ss.getch | ||
| end | ||
| end.dup | ||
| end | ||
@@ -946,0 +959,0 @@ |
@@ -16,4 +16,4 @@ # encoding: UTF-8 | ||
| ESC = /\\((?>[0-7]{1,3}|x[0-9a-fA-F]{1,2}|M-[^\\]|(C-|c)[^\\]|u[0-9a-fA-F]+|u\{[0-9a-fA-F]+\}|[^0-7xMCc]))/ | ||
| SIMPLE_STRING = /(#{ESC}|\#(#{ESC}|[^\{\#\@\$\"\\])|[^\"\\\#])*/o | ||
| SSTRING = /(\\.|[^\'])*/ | ||
| SIMPLE_STRING = /((#{ESC}|\#(#{ESC}|[^\{\#\@\$\"\\])|[^\"\\\#])*)/o | ||
| SSTRING = /((\\.|[^\'])*)/ | ||
| INT_DEC = /[+]?(?:(?:[1-9][\d_]*|0)(?!\.\d)(ri|r|i)?\b|0d[0-9_]+)(ri|r|i)?/i | ||
@@ -20,0 +20,0 @@ INT_HEX = /[+]?0x[a-f0-9_]+(ri|r|i)?/i |
@@ -10,3 +10,3 @@ # encoding: ASCII-8BIT | ||
| module RubyParserStuff | ||
| VERSION = "3.11.0" | ||
| VERSION = "3.12.0" | ||
@@ -1016,3 +1016,3 @@ attr_accessor :lexer, :in_def, :in_single, :file | ||
| header = str.lines.first(2) | ||
| header = str.each_line.first(2) | ||
| header.map! { |s| s.force_encoding "ASCII-8BIT" } if has_enc | ||
@@ -1363,5 +1363,6 @@ | ||
| @stack.push val | ||
| return unless debug | ||
| c = caller.first | ||
| c = caller[1] if c =~ /expr_result/ | ||
| warn "#{name}_stack(push): #{val} at line #{c.clean_caller}" if debug | ||
| warn "#{name}_stack(push): #{val} at line #{c.clean_caller}" | ||
| nil | ||
@@ -1368,0 +1369,0 @@ end |
@@ -19,4 +19,8 @@ require "ruby_parser_extras" | ||
| def self.version= v | ||
| @version = v | ||
| end | ||
| def self.version | ||
| Parser > self and self.name[/(?:V|Ruby)(\d+)/, 1].to_i | ||
| @version ||= Parser > self && self.name[/(?:V|Ruby)(\d+)/, 1].to_i | ||
| end | ||
@@ -23,0 +27,0 @@ end |
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 too big to display
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 too big to display