ruby_parser 3.17.0 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
data/tools/munge.rb CHANGED
@@ -76,12 +76,31 @@ def munge s
76
76
 
77
77
  # other
78
78
 
79
+ 'kTERMINATOR', "tSTRING_END",
80
+ '"kTERMINATOR"', "tSTRING_END",
81
+ 'kTRCURLY', "tSTRING_DEND",
82
+
83
+ '"symbol literal"', "tSYMBEG",
84
+ '"string literal"', "tSTRING_BEG",
85
+ '"backtick literal"', "tXSTRING_BEG",
86
+ '"regexp literal"', "tREGEXP_BEG",
87
+ '"word list"', "tWORDS_BEG",
88
+ '"verbatim word list"', "tQWORDS_BEG",
89
+ '"symbol list"', "tSYMBOLS_BEG",
90
+ '"verbatim symbol list"', "tQSYMBOLS_BEG",
91
+ '"terminator"', "tSTRING_END",
92
+ '"\'}\'"', "tSTRING_DEND",
93
+
94
+ '"string literal"',"tSTRING_BEG",
95
+ '"literal content"', "tSTRING_CONTENT",
96
+ /\$/, "", # try to remove these lumps?
97
+
79
98
  'tLBRACK2', "tLBRACK", # HACK
80
99
 
81
100
  "' '", "tSPACE", # needs to be later to avoid bad hits
82
101
 
83
102
  "/* empty */", "none",
84
- /^\s*$/, "none",
103
+ /^\s*$/, "",
85
104
 
86
105
  "keyword_BEGIN", "klBEGIN",
87
106
  "keyword_END", "klEND",
@@ -89,6 +108,7 @@ def munge s
89
108
  /\bk_([a-z_]+)/, proc { "k#{$1.upcase}" },
90
109
  /modifier_(\w+)/, proc { "k#{$1.upcase}_MOD" },
91
110
  "kVARIABLE", "keyword_variable", # ugh
111
+ "tCONST", "kCONST",
92
112
 
93
113
  # 2.6 collapses klBEGIN to kBEGIN
94
114
  "klBEGIN", "kBEGIN",
@@ -112,9 +132,11 @@ def munge s
112
132
  '"do (for condition)"', "kDO_COND",
113
133
  '"do (for lambda)"', "kDO_LAMBDA",
114
134
  '"do (for block)"', "kDO_BLOCK",
135
+ '"local variable or method"', "tIDENTIFIER",
115
136
 
116
137
  /\"(\w+) \(modifier\)\"/, proc { |x| "k#{$1.upcase}_MOD" },
117
138
  /\"(\w+)\"/, proc { |x| "k#{$1.upcase}" },
139
+ /\"`(\w+)'\"/, proc { |x| "k#{$1.upcase}" },
118
140
 
119
141
  /@(\d+)(\s+|$)/, "",
120
142
  /\$?@(\d+) */, "", # TODO: remove?
@@ -130,7 +152,11 @@ def munge s
130
152
  end
131
153
  end
132
154
 
133
- s.strip.squeeze " "
155
+ if s.empty? then
156
+ nil
157
+ else
158
+ s.strip.squeeze " "
159
+ end
134
160
  end
135
161
 
136
162
  ARGF.each_line do |line|
@@ -144,19 +170,19 @@ ARGF.each_line do |line|
144
170
  when /^Reading a token: Next token is token (.*?) \(\)/ then
145
171
  token = munge $1
146
172
  next if last_token == token
147
- puts "next token is %p (%p)" % [token, last_token]
173
+ puts "next token is %p" % [token]
148
174
  last_token = token
149
175
  when /^Reading a token: / then
150
176
  next # skip
151
177
  when /^read\s+:(\w+)/ then # read :tNL(tNL) nil
152
178
  token = munge $1
153
179
  next if last_token == token
154
- puts "next token is %p (%p)" % [token, last_token]
180
+ puts "next token is %p" % [token]
155
181
  last_token = token
156
182
  when /^Next token is token ("[^"]+"|\S+)/ then
157
183
  token = munge $1
158
184
  next if last_token == token
159
- puts "next token is %p (%p)" % [token, last_token]
185
+ puts "next token is %p" % [token]
160
186
  last_token = token
161
187
  when /^read\s+false/ then # read false($end) "$end"
162
188
  puts "next token is EOF"
@@ -164,6 +190,8 @@ ARGF.each_line do |line|
164
190
  # do nothing
165
191
  when /^.:scan=>\["([^"]+)"/ then
166
192
  puts "scan = %p" % [$1]
193
+ when /^.:getch=>\["([^"]+)/ then
194
+ puts "SCAN = %p" % [$1]
167
195
  when /^Reducing stack by rule (\d+) \(line (\d+)\):/ then
168
196
  reduce_line = $2.to_i
169
197
  when /^ \$\d+ = (?:token|nterm) (.+) \(.*\)/ then
@@ -172,7 +200,7 @@ ARGF.each_line do |line|
172
200
  when /^-> \$\$ = (?:token|nterm) (.+) \(.*\)/ then
173
201
  stack << "none" if stack.empty?
174
202
  item = munge $1
175
- x = stack.map { |s| s.strip }.join " "
203
+ x = stack.compact.map { |s| munge s.strip }.compact.join " "
176
204
  if x != item then # prevent kdef -> kdef
177
205
  if $v && reduce_line then
178
206
  puts "reduce #{x} --> #{item} at #{reduce_line}".squeeze " "
data/tools/ripper.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby -ws
2
2
 
3
- $d ||= false
4
- $p ||= false
3
+ $b ||= false # bug mode -- ripper is buggy, use Ripper.sexp
4
+ $d ||= false # debug -- turn on yydebug
5
+ $p ||= false # Use pp
5
6
 
6
7
  require "ripper/sexp"
7
8
  require "pp" if $p
@@ -19,15 +20,19 @@ end
19
20
 
20
21
  ARGV.each do |path|
21
22
  src = path == "-" ? $stdin.read : File.read(path)
22
- rip = MySexpBuilder.new src
23
- rip.yydebug = $d
24
23
 
25
- sexp = rip.parse
26
-
27
- if rip.error? then
28
- warn "skipping"
29
- next
30
- end
24
+ sexp = if $b then
25
+ Ripper.sexp src
26
+ else
27
+ rip = MySexpBuilder.new src
28
+ rip.yydebug = $d
29
+ rip.parse
30
+
31
+ if rip.error? then
32
+ warn "skipping"
33
+ next
34
+ end
35
+ end
31
36
 
32
37
  puts "accept"
33
38
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.0
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  d/AHw/kcnU6iuMUoJEcGiJd4gVCTn1l3cDcIvxakGslCA88Jubw0Sqatan0TnC9g
30
30
  KToW560QIey7SPfHWduzFJnV
31
31
  -----END CERTIFICATE-----
32
- date: 2021-08-04 00:00:00.000000000 Z
32
+ date: 2021-10-28 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -37,20 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.15'
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 4.15.1
40
+ version: '4.16'
44
41
  type: :runtime
45
42
  prerelease: false
46
43
  version_requirements: !ruby/object:Gem::Requirement
47
44
  requirements:
48
45
  - - "~>"
49
46
  - !ruby/object:Gem::Version
50
- version: '4.15'
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 4.15.1
47
+ version: '4.16'
54
48
  - !ruby/object:Gem::Dependency
55
49
  name: rake
56
50
  requirement: !ruby/object:Gem::Requirement
@@ -77,14 +71,14 @@ dependencies:
77
71
  requirements:
78
72
  - - "~>"
79
73
  - !ruby/object:Gem::Version
80
- version: '2.5'
74
+ version: '2.6'
81
75
  type: :development
82
76
  prerelease: false
83
77
  version_requirements: !ruby/object:Gem::Requirement
84
78
  requirements:
85
79
  - - "~>"
86
80
  - !ruby/object:Gem::Version
87
- version: '2.5'
81
+ version: '2.6'
88
82
  - !ruby/object:Gem::Dependency
89
83
  name: racc
90
84
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +154,7 @@ description: |-
160
154
  * 1.8 parser is at 99.9739% accuracy, 3.651 sigma
161
155
  * 1.9 parser is at 99.9940% accuracy, 4.013 sigma
162
156
  * 2.0 parser is at 99.9939% accuracy, 4.008 sigma
157
+ * 2.6 parser is at 99.9972% accuracy, 4.191 sigma
163
158
  email:
164
159
  - ryand-ruby@zenspider.com
165
160
  executables:
@@ -171,6 +166,7 @@ extra_rdoc_files:
171
166
  - Manifest.txt
172
167
  - README.rdoc
173
168
  - debugging.md
169
+ - gauntlet.md
174
170
  files:
175
171
  - ".autotest"
176
172
  - History.rdoc
@@ -181,6 +177,7 @@ files:
181
177
  - bin/ruby_parse_extract_error
182
178
  - compare/normalize.rb
183
179
  - debugging.md
180
+ - gauntlet.md
184
181
  - lib/.document
185
182
  - lib/rp_extensions.rb
186
183
  - lib/rp_stringscanner.rb
@@ -202,9 +199,11 @@ files:
202
199
  - lib/ruby27_parser.y
203
200
  - lib/ruby30_parser.rb
204
201
  - lib/ruby30_parser.y
202
+ - lib/ruby3_parser.yy
205
203
  - lib/ruby_lexer.rb
206
204
  - lib/ruby_lexer.rex
207
205
  - lib/ruby_lexer.rex.rb
206
+ - lib/ruby_lexer_strings.rb
208
207
  - lib/ruby_parser.rb
209
208
  - lib/ruby_parser.yy
210
209
  - lib/ruby_parser_extras.rb
metadata.gz.sig CHANGED
Binary file