parser 2.1.0.pre1 → 2.1.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ class TestDiagnostic < Minitest::Test
11
11
 
12
12
  def test_verifies_levels
13
13
  assert_raises ArgumentError, /level/ do
14
- Parser::Diagnostic.new(:foobar, 'foo', @range1)
14
+ Parser::Diagnostic.new(:foobar, :escape_eof, @range1)
15
15
  end
16
16
  end
17
17
 
@@ -19,9 +19,9 @@ class TestDiagnostic < Minitest::Test
19
19
  string = 'foo'
20
20
  highlights = [@range2]
21
21
 
22
- diag = Parser::Diagnostic.new(:error, string, @range1, highlights)
22
+ diag = Parser::Diagnostic.new(:error, :escape_eof, @range1, highlights)
23
23
  assert diag.frozen?
24
- assert diag.message.frozen?
24
+ assert diag.arguments.frozen?
25
25
  assert diag.highlights.frozen?
26
26
 
27
27
  refute string.frozen?
@@ -36,10 +36,10 @@ class TestDiagnostic < Minitest::Test
36
36
  Parser::Source::Range.new(@buffer, 28, 32)
37
37
  ]
38
38
 
39
- diag = Parser::Diagnostic.new(:error, 'code far too bad',
39
+ diag = Parser::Diagnostic.new(:error, :unexpected, { :character => '+' },
40
40
  location, highlights)
41
41
  assert_equal([
42
- '(string):1:27: error: code far too bad',
42
+ "(string):1:27: error: unexpected `+'",
43
43
  'if (this is some bad code + bugs)',
44
44
  ' ~~~~ ^ ~~~~ '
45
45
  ], diag.render)
@@ -12,7 +12,7 @@ class TestDiagnosticEngine < Minitest::Test
12
12
  end
13
13
 
14
14
  def test_process_warnings
15
- warn = Parser::Diagnostic.new(:warning, 'foo', @buffer, 1..2)
15
+ warn = Parser::Diagnostic.new(:warning, :invalid_escape, @buffer, 1..2)
16
16
  @engine.process(warn)
17
17
 
18
18
  assert_equal [warn], @queue
@@ -21,7 +21,7 @@ class TestDiagnosticEngine < Minitest::Test
21
21
  def test_ignore_warnings
22
22
  @engine.ignore_warnings = true
23
23
 
24
- warn = Parser::Diagnostic.new(:warning, 'foo', @buffer, 1..2)
24
+ warn = Parser::Diagnostic.new(:warning, :invalid_escape, @buffer, 1..2)
25
25
  @engine.process(warn)
26
26
 
27
27
  assert_equal [], @queue
@@ -30,9 +30,9 @@ class TestDiagnosticEngine < Minitest::Test
30
30
  def test_all_errors_are_fatal
31
31
  @engine.all_errors_are_fatal = true
32
32
 
33
- error = Parser::Diagnostic.new(:error, 'foo', @buffer, 1..2)
33
+ error = Parser::Diagnostic.new(:error, :invalid_escape, @buffer, 1..2)
34
34
 
35
- err = assert_raises Parser::SyntaxError, "foo" do
35
+ err = assert_raises Parser::SyntaxError, error.message do
36
36
  @engine.process(error)
37
37
  end
38
38
 
@@ -42,14 +42,14 @@ class TestDiagnosticEngine < Minitest::Test
42
42
  end
43
43
 
44
44
  def test_all_errors_are_collected
45
- error = Parser::Diagnostic.new(:error, 'foo', @buffer, 1..2)
45
+ error = Parser::Diagnostic.new(:error, :invalid_escape, @buffer, 1..2)
46
46
  @engine.process(error)
47
47
 
48
48
  assert_equal [error], @queue
49
49
  end
50
50
 
51
51
  def test_fatal_error
52
- fatal = Parser::Diagnostic.new(:fatal, 'foo', @buffer, 1..2)
52
+ fatal = Parser::Diagnostic.new(:fatal, :invalid_escape, @buffer, 1..2)
53
53
 
54
54
  assert_raises Parser::SyntaxError do
55
55
  @engine.process(fatal)
@@ -3030,6 +3030,14 @@ class TestLexer < Minitest::Test
3030
3030
  :kIF_MOD, 'if')
3031
3031
  end
3032
3032
 
3033
+ if defined?(Encoding)
3034
+ def test_bug_unicode_in_literal
3035
+ setup_lexer(19)
3036
+ assert_scanned('"\u00a4"',
3037
+ :tSTRING, "\u00a4")
3038
+ end
3039
+ end
3040
+
3033
3041
  def test_bug_ragel_stack
3034
3042
  assert_scanned("\"\#{$2 ? $2 : 1}\"",
3035
3043
  :tSTRING_BEG, "\"",
metadata CHANGED
@@ -1,75 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre1
4
+ version: 2.1.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.4'
34
- - - ">="
34
+ - - '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: 3.4.5
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: '3.4'
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 3.4.5
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.2'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.2'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ~>
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0.9'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ~>
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0.9'
75
75
  - !ruby/object:Gem::Dependency
@@ -90,140 +90,140 @@ dependencies:
90
90
  name: cliver
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - ~>
94
94
  - !ruby/object:Gem::Version
95
95
  version: 0.3.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ~>
101
101
  - !ruby/object:Gem::Version
102
102
  version: 0.3.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: yard
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - '>='
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: kramdown
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
121
+ - - '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ">="
128
+ - - '>='
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: minitest
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - "~>"
135
+ - - ~>
136
136
  - !ruby/object:Gem::Version
137
137
  version: '5.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - "~>"
142
+ - - ~>
143
143
  - !ruby/object:Gem::Version
144
144
  version: '5.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: simplecov
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - "~>"
149
+ - - ~>
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0.7'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - "~>"
156
+ - - ~>
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0.7'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: coveralls
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ">="
163
+ - - '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - ">="
170
+ - - '>='
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: json_pure
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
- - - ">="
177
+ - - '>='
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0'
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">="
184
+ - - '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: mime-types
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - "~>"
191
+ - - ~>
192
192
  - !ruby/object:Gem::Version
193
193
  version: '1.25'
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
- - - "~>"
198
+ - - ~>
199
199
  - !ruby/object:Gem::Version
200
200
  version: '1.25'
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: simplecov-sublime-ruby-coverage
203
203
  requirement: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - ">="
205
+ - - '>='
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
- - - ">="
212
+ - - '>='
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: gauntlet
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
- - - ">="
219
+ - - '>='
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  type: :development
223
223
  prerelease: false
224
224
  version_requirements: !ruby/object:Gem::Requirement
225
225
  requirements:
226
- - - ">="
226
+ - - '>='
227
227
  - !ruby/object:Gem::Version
228
228
  version: '0'
229
229
  description: A Ruby parser written in pure Ruby.
@@ -235,10 +235,10 @@ executables:
235
235
  extensions: []
236
236
  extra_rdoc_files: []
237
237
  files:
238
- - ".gitignore"
239
- - ".rubocop.yml"
240
- - ".travis.yml"
241
- - ".yardopts"
238
+ - .gitignore
239
+ - .rubocop.yml
240
+ - .travis.yml
241
+ - .yardopts
242
242
  - CHANGELOG.md
243
243
  - CONTRIBUTING.md
244
244
  - Gemfile
@@ -264,19 +264,15 @@ files:
264
264
  - lib/parser/current.rb
265
265
  - lib/parser/diagnostic.rb
266
266
  - lib/parser/diagnostic/engine.rb
267
- - lib/parser/lexer.rb
268
267
  - lib/parser/lexer.rl
269
268
  - lib/parser/lexer/explanation.rb
270
269
  - lib/parser/lexer/literal.rb
271
270
  - lib/parser/lexer/stack_state.rb
271
+ - lib/parser/messages.rb
272
272
  - lib/parser/rewriter.rb
273
- - lib/parser/ruby18.rb
274
273
  - lib/parser/ruby18.y
275
- - lib/parser/ruby19.rb
276
274
  - lib/parser/ruby19.y
277
- - lib/parser/ruby20.rb
278
275
  - lib/parser/ruby20.y
279
- - lib/parser/ruby21.rb
280
276
  - lib/parser/ruby21.y
281
277
  - lib/parser/runner.rb
282
278
  - lib/parser/runner/ruby_parse.rb
@@ -321,6 +317,11 @@ files:
321
317
  - test/test_source_rewriter.rb
322
318
  - test/test_source_rewriter_action.rb
323
319
  - test/test_static_environment.rb
320
+ - lib/parser/lexer.rb
321
+ - lib/parser/ruby18.rb
322
+ - lib/parser/ruby19.rb
323
+ - lib/parser/ruby20.rb
324
+ - lib/parser/ruby21.rb
324
325
  homepage: http://github.com/whitequark/parser
325
326
  licenses:
326
327
  - MIT
@@ -331,17 +332,17 @@ require_paths:
331
332
  - lib
332
333
  required_ruby_version: !ruby/object:Gem::Requirement
333
334
  requirements:
334
- - - ">="
335
+ - - '>='
335
336
  - !ruby/object:Gem::Version
336
337
  version: '0'
337
338
  required_rubygems_version: !ruby/object:Gem::Requirement
338
339
  requirements:
339
- - - ">"
340
+ - - '>'
340
341
  - !ruby/object:Gem::Version
341
342
  version: 1.3.1
342
343
  requirements: []
343
344
  rubyforge_project:
344
- rubygems_version: 2.2.0.preview.1
345
+ rubygems_version: 2.0.0
345
346
  signing_key:
346
347
  specification_version: 4
347
348
  summary: A Ruby parser written in pure Ruby.