ruby_parser 3.15.1 → 3.18.1

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 " "
@@ -197,8 +225,8 @@ ARGF.each_line do |line|
197
225
  puts line.gsub("true", "1").gsub("false", "0")
198
226
  when /^lex_state: :?([\w|]+) -> :?([\w|]+)(?: (?:at|from) (.*))?/ then
199
227
  a, b, c = $1.upcase, $2.upcase, $3
200
- a.gsub! /EXPR_/, ""
201
- b.gsub! /EXPR_/, ""
228
+ a.gsub!(/EXPR_/, "")
229
+ b.gsub!(/EXPR_/, "")
202
230
  if c && $v then
203
231
  puts "lex_state: #{a} -> #{b} at #{c}"
204
232
  else
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.15.1
4
+ version: 3.18.1
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-01-11 00:00:00.000000000 Z
32
+ date: 2021-11-10 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -37,42 +37,62 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.9'
40
+ version: '4.16'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.9'
47
+ version: '4.16'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rake
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '10'
52
55
  - - "<"
53
56
  - !ruby/object:Gem::Version
54
- version: '11'
57
+ version: '15'
55
58
  type: :development
56
59
  prerelease: false
57
60
  version_requirements: !ruby/object:Gem::Requirement
58
61
  requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '10'
59
65
  - - "<"
60
66
  - !ruby/object:Gem::Version
61
- version: '11'
67
+ version: '15'
62
68
  - !ruby/object:Gem::Dependency
63
69
  name: oedipus_lex
64
70
  requirement: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '2.5'
74
+ version: '2.6'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.6'
82
+ - !ruby/object:Gem::Dependency
83
+ name: racc
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.5'
69
89
  type: :development
70
90
  prerelease: false
71
91
  version_requirements: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: '2.5'
95
+ version: '1.5'
76
96
  - !ruby/object:Gem::Dependency
77
97
  name: rdoc
78
98
  requirement: !ruby/object:Gem::Requirement
@@ -93,20 +113,6 @@ dependencies:
93
113
  - - "<"
94
114
  - !ruby/object:Gem::Version
95
115
  version: '7'
96
- - !ruby/object:Gem::Dependency
97
- name: racc
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 1.4.6
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: 1.4.6
110
116
  - !ruby/object:Gem::Dependency
111
117
  name: hoe
112
118
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +154,7 @@ description: |-
148
154
  * 1.8 parser is at 99.9739% accuracy, 3.651 sigma
149
155
  * 1.9 parser is at 99.9940% accuracy, 4.013 sigma
150
156
  * 2.0 parser is at 99.9939% accuracy, 4.008 sigma
157
+ * 2.6 parser is at 99.9972% accuracy, 4.191 sigma
151
158
  email:
152
159
  - ryand-ruby@zenspider.com
153
160
  executables:
@@ -159,6 +166,7 @@ extra_rdoc_files:
159
166
  - Manifest.txt
160
167
  - README.rdoc
161
168
  - debugging.md
169
+ - gauntlet.md
162
170
  files:
163
171
  - ".autotest"
164
172
  - History.rdoc
@@ -169,6 +177,7 @@ files:
169
177
  - bin/ruby_parse_extract_error
170
178
  - compare/normalize.rb
171
179
  - debugging.md
180
+ - gauntlet.md
172
181
  - lib/.document
173
182
  - lib/rp_extensions.rb
174
183
  - lib/rp_stringscanner.rb
@@ -188,9 +197,13 @@ files:
188
197
  - lib/ruby26_parser.y
189
198
  - lib/ruby27_parser.rb
190
199
  - lib/ruby27_parser.y
200
+ - lib/ruby30_parser.rb
201
+ - lib/ruby30_parser.y
202
+ - lib/ruby3_parser.yy
191
203
  - lib/ruby_lexer.rb
192
204
  - lib/ruby_lexer.rex
193
205
  - lib/ruby_lexer.rex.rb
206
+ - lib/ruby_lexer_strings.rb
194
207
  - lib/ruby_parser.rb
195
208
  - lib/ruby_parser.yy
196
209
  - lib/ruby_parser_extras.rb
@@ -225,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
238
  - !ruby/object:Gem::Version
226
239
  version: '0'
227
240
  requirements: []
228
- rubygems_version: 3.1.4
241
+ rubygems_version: 3.2.16
229
242
  signing_key:
230
243
  specification_version: 4
231
244
  summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which
metadata.gz.sig CHANGED
Binary file