regexp_parser 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed3e75e40ac66c7485636e6fe3b0c63b8d3d3aa5
4
- data.tar.gz: d72567776c9934caa47fe2ecb503855e3c45b70d
3
+ metadata.gz: 8da248406d9077139763f419cc18d846dc9f9f62
4
+ data.tar.gz: 24a0dd00c5a9e4bddfc9188d1c70ccaf4ec599b5
5
5
  SHA512:
6
- metadata.gz: 624065b3e707c4869ed67012bde66544d6682b577f826f7089090a070c46bc4e7f4895efabb665cd8b797f5616dc2151c7a820a5b84ae3a88ac242a3737f846f
7
- data.tar.gz: 6b745fc5a79f260879e4415077e9754f19cb8db608132a5892833dfe5ba85f56c15b5ba3c33cc7c203ff6277cc8ded82beded0996b6376a065a210a593082583
6
+ metadata.gz: 4feff69d68352e80320d745b9e0162682c15646f7747236b65a7d5cc2f8a82678083449cbb053a8e28f4df57f9bd0974c7c2715d0d7fb6c280acbe49945b9c4c
7
+ data.tar.gz: 5f52cbf231bbf43241526579310a20f2c394b7090f07ffbb5181114f3c2179dce9bb1857743d231dee12d90cb7e699a48c1d0e6df56987b34683e72de7b8bce9
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Wed Jun 8 2016 Ammar Ali <ammarabuali@gmail.com>
2
+
3
+ * Thanks to John Backus (https://github.com/backus):
4
+ - Remove warnings (PR #26)
5
+ * Bumped version to 0.3.6
6
+
1
7
  Mon May 30 2016 Ammar Ali <ammarabuali@gmail.com>
2
8
 
3
9
  * Thanks to John Backus (https://github.com/backus):
data/README.md CHANGED
@@ -399,22 +399,22 @@ _A special task 'test:full' generates the scanner's code from the ragel source f
399
399
  runs all the tests. This task requires ragel to be installed._
400
400
 
401
401
 
402
- The tests use ruby's test/unit, so they can also be run with:
402
+ The tests use ruby's test/unit. They can also be run with:
403
403
 
404
404
  ```
405
- ruby -Ilib test/test_all.rb
405
+ bin/test
406
406
  ```
407
407
 
408
- This is useful when there is a need to focus on specific test files, for example:
408
+ The test runner accepts all arguments accepted by test/unit. You can run a specific test like so:
409
409
 
410
410
  ```
411
- ruby -Ilib test/scanner/test_properties.rb
411
+ bin/test test/scanner/test_properties.rb
412
412
  ```
413
413
 
414
414
  It is sometimes helpful during development to focus on a specific test case, for example:
415
415
 
416
416
  ```
417
- ruby -Ilib test/expression/test_base.rb -n test_expression_to_re
417
+ bin/test test/expression/test_base.rb -n test_expression_to_re
418
418
  ```
419
419
 
420
420
 
data/Rakefile CHANGED
@@ -15,40 +15,14 @@ RAGEL_SOURCE_FILES = %w{scanner} # scanner.rl includes property.rl
15
15
  Bundler::GemHelper.install_tasks
16
16
 
17
17
 
18
- task :default => [:test]
19
-
20
- Rake::TestTask.new('test') do |t|
21
- if t.respond_to?(:description)
22
- t.description = "Run all unit tests under the test directory"
23
- end
24
-
25
- t.libs << "test"
26
- t.test_files = FileList['test/test_all.rb']
27
- end
18
+ task :default => [:'test:full']
28
19
 
29
20
  namespace :test do
30
- %w{scanner lexer parser expression syntax}.each do |component|
31
- Rake::TestTask.new(component) do |t|
32
- if t.respond_to?(:description)
33
- t.description = "Run all #{component} unit tests under the test/#{component} directory"
34
- end
35
-
36
- t.libs << "test"
37
- t.test_files = ["test/#{component}/test_all.rb"]
38
- end
39
- end
40
-
41
- Rake::TestTask.new('full' => 'ragel:rb') do |t|
42
- if t.respond_to?(:description)
43
- t.description = "Regenerate the scanner and run all unit tests under the test directory"
44
- end
45
-
46
- t.libs << "test"
47
- t.test_files = FileList['test/test_all.rb']
21
+ task full: :'ragel:rb' do
22
+ sh 'bin/test'
48
23
  end
49
24
  end
50
25
 
51
-
52
26
  namespace :ragel do
53
27
  desc "Process the ragel source files and output ruby code"
54
28
  task :rb do |t|
@@ -2,7 +2,7 @@
2
2
 
3
3
  # line 1 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
4
4
 
5
- # line 769 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
5
+ # line 768 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
6
6
 
7
7
 
8
8
  # THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY
@@ -1543,7 +1543,7 @@ end
1543
1543
  self.re_scanner_en_main = 138;
1544
1544
 
1545
1545
 
1546
- # line 776 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
1546
+ # line 775 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
1547
1547
 
1548
1548
  # General scanner error (catch all)
1549
1549
  class ScannerError < StandardError; end
@@ -1604,7 +1604,7 @@ self.re_scanner_en_main = 138;
1604
1604
  # This method may raise errors if a syntax error is encountered.
1605
1605
  # --------------------------------------------------------------------------
1606
1606
  def self.scan(input_object, &block)
1607
- top, stack = 0, []
1607
+ @literal, top, stack = nil, 0, []
1608
1608
 
1609
1609
  if input_object.is_a?(Regexp)
1610
1610
  input = input_object.source
@@ -1639,7 +1639,7 @@ begin
1639
1639
  act = 0
1640
1640
  end
1641
1641
 
1642
- # line 860 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
1642
+ # line 859 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
1643
1643
 
1644
1644
  # line 1644 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
1645
1645
  begin
@@ -2229,8 +2229,6 @@ te = p+1
2229
2229
  self.emit(type, :script_unknown, text, ts-1, te)
2230
2230
 
2231
2231
  # Unicode blocks
2232
- when 'inalphabeticpresentationforms'
2233
- self.emit(type, :block_inalphabetic_presentation_forms, text, ts-1, te)
2234
2232
  when 'inalphabeticpresentationforms'
2235
2233
  self.emit(type, :block_inalphabetic_presentation_forms, text, ts-1, te)
2236
2234
  when 'inarabicpresentationforms-a'
@@ -2747,13 +2745,6 @@ te = p+1
2747
2745
  next
2748
2746
  end
2749
2747
 
2750
- begin
2751
- top -= 1
2752
- cs = stack[top]
2753
- _goto_level = _again
2754
- next
2755
- end
2756
-
2757
2748
  end
2758
2749
  end
2759
2750
  when 81 then
@@ -2787,7 +2778,7 @@ p = p - 1; begin
2787
2778
  end
2788
2779
  end
2789
2780
  when 79 then
2790
- # line 292 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2781
+ # line 291 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2791
2782
  begin
2792
2783
  te = p
2793
2784
  p = p - 1; begin
@@ -2854,7 +2845,7 @@ end
2854
2845
  end
2855
2846
  end
2856
2847
  when 87 then
2857
- # line 302 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2848
+ # line 301 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2858
2849
  begin
2859
2850
  te = p+1
2860
2851
  begin
@@ -2870,7 +2861,7 @@ te = p+1
2870
2861
  end
2871
2862
  end
2872
2863
  when 92 then
2873
- # line 308 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2864
+ # line 307 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2874
2865
  begin
2875
2866
  te = p+1
2876
2867
  begin
@@ -2885,7 +2876,7 @@ te = p+1
2885
2876
  end
2886
2877
  end
2887
2878
  when 84 then
2888
- # line 313 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2879
+ # line 312 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2889
2880
  begin
2890
2881
  te = p+1
2891
2882
  begin
@@ -2916,7 +2907,7 @@ te = p+1
2916
2907
  end
2917
2908
  end
2918
2909
  when 89 then
2919
- # line 334 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2910
+ # line 333 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2920
2911
  begin
2921
2912
  te = p+1
2922
2913
  begin
@@ -2942,7 +2933,7 @@ te = p+1
2942
2933
  end
2943
2934
  end
2944
2935
  when 32 then
2945
- # line 350 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2936
+ # line 349 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2946
2937
  begin
2947
2938
  te = p+1
2948
2939
  begin
@@ -2962,7 +2953,7 @@ te = p+1
2962
2953
  end
2963
2954
  end
2964
2955
  when 97 then
2965
- # line 360 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2956
+ # line 359 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2966
2957
  begin
2967
2958
  te = p+1
2968
2959
  begin
@@ -2977,7 +2968,7 @@ te = p+1
2977
2968
  end
2978
2969
  end
2979
2970
  when 100 then
2980
- # line 365 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2971
+ # line 364 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2981
2972
  begin
2982
2973
  te = p+1
2983
2974
  begin
@@ -2992,7 +2983,7 @@ te = p+1
2992
2983
  end
2993
2984
  end
2994
2985
  when 34 then
2995
- # line 374 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2986
+ # line 373 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
2996
2987
  begin
2997
2988
  te = p+1
2998
2989
  begin
@@ -3007,7 +2998,7 @@ te = p+1
3007
2998
  end
3008
2999
  end
3009
3000
  when 28 then
3010
- # line 379 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3001
+ # line 378 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3011
3002
  begin
3012
3003
  te = p+1
3013
3004
  begin
@@ -3032,7 +3023,7 @@ te = p+1
3032
3023
  end
3033
3024
  end
3034
3025
  when 31 then
3035
- # line 394 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3026
+ # line 393 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3036
3027
  begin
3037
3028
  te = p+1
3038
3029
  begin
@@ -3057,7 +3048,7 @@ te = p+1
3057
3048
  end
3058
3049
  end
3059
3050
  when 88 then
3060
- # line 409 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3051
+ # line 408 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3061
3052
  begin
3062
3053
  te = p+1
3063
3054
  begin
@@ -3070,17 +3061,11 @@ te = p+1
3070
3061
  _goto_level = _again
3071
3062
  next
3072
3063
  end
3073
- begin
3074
- top -= 1
3075
- cs = stack[top]
3076
- _goto_level = _again
3077
- next
3078
- end
3079
3064
 
3080
3065
  end
3081
3066
  end
3082
3067
  when 83 then
3083
- # line 415 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3068
+ # line 414 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3084
3069
  begin
3085
3070
  te = p+1
3086
3071
  begin
@@ -3095,7 +3080,7 @@ te = p+1
3095
3080
  end
3096
3081
  end
3097
3082
  when 91 then
3098
- # line 308 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3083
+ # line 307 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3099
3084
  begin
3100
3085
  te = p
3101
3086
  p = p - 1; begin
@@ -3110,7 +3095,7 @@ p = p - 1; begin
3110
3095
  end
3111
3096
  end
3112
3097
  when 96 then
3113
- # line 360 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3098
+ # line 359 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3114
3099
  begin
3115
3100
  te = p
3116
3101
  p = p - 1; begin
@@ -3125,7 +3110,7 @@ p = p - 1; begin
3125
3110
  end
3126
3111
  end
3127
3112
  when 98 then
3128
- # line 374 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3113
+ # line 373 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3129
3114
  begin
3130
3115
  te = p
3131
3116
  p = p - 1; begin
@@ -3140,7 +3125,7 @@ p = p - 1; begin
3140
3125
  end
3141
3126
  end
3142
3127
  when 94 then
3143
- # line 394 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3128
+ # line 393 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3144
3129
  begin
3145
3130
  te = p
3146
3131
  p = p - 1; begin
@@ -3165,7 +3150,7 @@ p = p - 1; begin
3165
3150
  end
3166
3151
  end
3167
3152
  when 35 then
3168
- # line 374 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3153
+ # line 373 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3169
3154
  begin
3170
3155
  begin p = ((te))-1; end
3171
3156
  begin
@@ -3180,7 +3165,7 @@ p = p - 1; begin
3180
3165
  end
3181
3166
  end
3182
3167
  when 30 then
3183
- # line 394 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3168
+ # line 393 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3184
3169
  begin
3185
3170
  begin p = ((te))-1; end
3186
3171
  begin
@@ -3236,7 +3221,7 @@ p = p - 1; begin
3236
3221
  end
3237
3222
  end
3238
3223
  when 37 then
3239
- # line 425 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3224
+ # line 424 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3240
3225
  begin
3241
3226
  te = p+1
3242
3227
  begin
@@ -3246,7 +3231,7 @@ te = p+1
3246
3231
  end
3247
3232
  end
3248
3233
  when 101 then
3249
- # line 431 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3234
+ # line 430 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3250
3235
  begin
3251
3236
  te = p+1
3252
3237
  begin
@@ -3262,7 +3247,7 @@ te = p+1
3262
3247
  end
3263
3248
  end
3264
3249
  when 102 then
3265
- # line 431 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3250
+ # line 430 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3266
3251
  begin
3267
3252
  te = p
3268
3253
  p = p - 1; begin
@@ -3278,7 +3263,7 @@ p = p - 1; begin
3278
3263
  end
3279
3264
  end
3280
3265
  when 36 then
3281
- # line 431 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3266
+ # line 430 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3282
3267
  begin
3283
3268
  begin p = ((te))-1; end
3284
3269
  begin
@@ -3294,7 +3279,7 @@ p = p - 1; begin
3294
3279
  end
3295
3280
  end
3296
3281
  when 43 then
3297
- # line 444 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3282
+ # line 443 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3298
3283
  begin
3299
3284
  te = p+1
3300
3285
  begin
@@ -3302,7 +3287,7 @@ te = p+1
3302
3287
  end
3303
3288
  end
3304
3289
  when 46 then
3305
- # line 448 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3290
+ # line 447 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3306
3291
  begin
3307
3292
  te = p+1
3308
3293
  begin
@@ -3315,7 +3300,7 @@ te = p+1
3315
3300
  end
3316
3301
  end
3317
3302
  when 45 then
3318
- # line 459 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3303
+ # line 458 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3319
3304
  begin
3320
3305
  te = p+1
3321
3306
  begin
@@ -3323,7 +3308,7 @@ te = p+1
3323
3308
  end
3324
3309
  end
3325
3310
  when 40 then
3326
- # line 463 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3311
+ # line 462 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3327
3312
  begin
3328
3313
  te = p+1
3329
3314
  begin
@@ -3331,7 +3316,7 @@ te = p+1
3331
3316
  end
3332
3317
  end
3333
3318
  when 60 then
3334
- # line 467 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3319
+ # line 466 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3335
3320
  begin
3336
3321
  te = p+1
3337
3322
  begin
@@ -3339,7 +3324,7 @@ te = p+1
3339
3324
  end
3340
3325
  end
3341
3326
  when 58 then
3342
- # line 471 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3327
+ # line 470 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3343
3328
  begin
3344
3329
  te = p+1
3345
3330
  begin
@@ -3357,7 +3342,7 @@ te = p+1
3357
3342
  end
3358
3343
  end
3359
3344
  when 59 then
3360
- # line 491 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3345
+ # line 490 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3361
3346
  begin
3362
3347
  te = p+1
3363
3348
  begin
@@ -3377,7 +3362,7 @@ te = p+1
3377
3362
  end
3378
3363
  end
3379
3364
  when 44 then
3380
- # line 510 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3365
+ # line 509 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3381
3366
  begin
3382
3367
  te = p+1
3383
3368
  begin
@@ -3396,7 +3381,7 @@ te = p+1
3396
3381
  end
3397
3382
  end
3398
3383
  when 8 then
3399
- # line 522 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3384
+ # line 521 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3400
3385
  begin
3401
3386
  te = p+1
3402
3387
  begin
@@ -3419,7 +3404,7 @@ te = p+1
3419
3404
  end
3420
3405
  end
3421
3406
  when 9 then
3422
- # line 555 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3407
+ # line 554 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3423
3408
  begin
3424
3409
  te = p+1
3425
3410
  begin
@@ -3427,7 +3412,7 @@ te = p+1
3427
3412
  end
3428
3413
  end
3429
3414
  when 6 then
3430
- # line 565 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3415
+ # line 564 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3431
3416
  begin
3432
3417
  te = p+1
3433
3418
  begin
@@ -3440,7 +3425,7 @@ te = p+1
3440
3425
  end
3441
3426
  end
3442
3427
  when 10 then
3443
- # line 581 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3428
+ # line 580 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3444
3429
  begin
3445
3430
  te = p+1
3446
3431
  begin
@@ -3465,7 +3450,7 @@ te = p+1
3465
3450
  end
3466
3451
  end
3467
3452
  when 13 then
3468
- # line 636 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3453
+ # line 635 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3469
3454
  begin
3470
3455
  te = p+1
3471
3456
  begin
@@ -3537,7 +3522,7 @@ te = p+1
3537
3522
  end
3538
3523
  end
3539
3524
  when 56 then
3540
- # line 707 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3525
+ # line 706 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3541
3526
  begin
3542
3527
  te = p+1
3543
3528
  begin
@@ -3549,7 +3534,7 @@ te = p+1
3549
3534
  end
3550
3535
  end
3551
3536
  when 52 then
3552
- # line 715 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3537
+ # line 714 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3553
3538
  begin
3554
3539
  te = p+1
3555
3540
  begin
@@ -3561,7 +3546,7 @@ te = p+1
3561
3546
  end
3562
3547
  end
3563
3548
  when 54 then
3564
- # line 723 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3549
+ # line 722 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3565
3550
  begin
3566
3551
  te = p+1
3567
3552
  begin
@@ -3573,7 +3558,7 @@ te = p+1
3573
3558
  end
3574
3559
  end
3575
3560
  when 62 then
3576
- # line 731 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3561
+ # line 730 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3577
3562
  begin
3578
3563
  te = p+1
3579
3564
  begin
@@ -3581,7 +3566,7 @@ te = p+1
3581
3566
  end
3582
3567
  end
3583
3568
  when 4 then
3584
- # line 741 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3569
+ # line 740 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3585
3570
  begin
3586
3571
  te = p+1
3587
3572
  begin
@@ -3593,7 +3578,7 @@ te = p+1
3593
3578
  end
3594
3579
  end
3595
3580
  when 49 then
3596
- # line 602 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3581
+ # line 601 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3597
3582
  begin
3598
3583
  te = p
3599
3584
  p = p - 1; begin
@@ -3602,7 +3587,7 @@ p = p - 1; begin
3602
3587
  end
3603
3588
  end
3604
3589
  when 55 then
3605
- # line 707 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3590
+ # line 706 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3606
3591
  begin
3607
3592
  te = p
3608
3593
  p = p - 1; begin
@@ -3614,7 +3599,7 @@ p = p - 1; begin
3614
3599
  end
3615
3600
  end
3616
3601
  when 51 then
3617
- # line 715 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3602
+ # line 714 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3618
3603
  begin
3619
3604
  te = p
3620
3605
  p = p - 1; begin
@@ -3626,7 +3611,7 @@ p = p - 1; begin
3626
3611
  end
3627
3612
  end
3628
3613
  when 53 then
3629
- # line 723 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3614
+ # line 722 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3630
3615
  begin
3631
3616
  te = p
3632
3617
  p = p - 1; begin
@@ -3638,7 +3623,7 @@ p = p - 1; begin
3638
3623
  end
3639
3624
  end
3640
3625
  when 61 then
3641
- # line 731 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3626
+ # line 730 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3642
3627
  begin
3643
3628
  te = p
3644
3629
  p = p - 1; begin
@@ -3646,7 +3631,7 @@ p = p - 1; begin
3646
3631
  end
3647
3632
  end
3648
3633
  when 57 then
3649
- # line 737 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3634
+ # line 736 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3650
3635
  begin
3651
3636
  te = p
3652
3637
  p = p - 1; begin
@@ -3661,7 +3646,7 @@ p = p - 1; begin
3661
3646
  end
3662
3647
  end
3663
3648
  when 48 then
3664
- # line 749 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3649
+ # line 748 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3665
3650
  begin
3666
3651
  te = p
3667
3652
  p = p - 1; begin
@@ -3673,7 +3658,7 @@ p = p - 1; begin
3673
3658
  end
3674
3659
  end
3675
3660
  when 47 then
3676
- # line 764 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3661
+ # line 763 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3677
3662
  begin
3678
3663
  te = p
3679
3664
  p = p - 1; begin
@@ -3681,7 +3666,7 @@ p = p - 1; begin
3681
3666
  end
3682
3667
  end
3683
3668
  when 5 then
3684
- # line 602 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3669
+ # line 601 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3685
3670
  begin
3686
3671
  begin p = ((te))-1; end
3687
3672
  begin
@@ -3690,7 +3675,7 @@ p = p - 1; begin
3690
3675
  end
3691
3676
  end
3692
3677
  when 12 then
3693
- # line 737 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3678
+ # line 736 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3694
3679
  begin
3695
3680
  begin p = ((te))-1; end
3696
3681
  begin
@@ -3705,7 +3690,7 @@ p = p - 1; begin
3705
3690
  end
3706
3691
  end
3707
3692
  when 3 then
3708
- # line 764 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3693
+ # line 763 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3709
3694
  begin
3710
3695
  begin p = ((te))-1; end
3711
3696
  begin
@@ -3787,7 +3772,7 @@ p = p - 1; begin
3787
3772
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
3788
3773
  raise PrematureEndError.new( text )
3789
3774
  end
3790
- # line 360 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3775
+ # line 359 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3791
3776
  begin
3792
3777
  te = p
3793
3778
  p = p - 1; begin
@@ -3808,7 +3793,7 @@ p = p - 1; begin
3808
3793
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
3809
3794
  raise PrematureEndError.new( text )
3810
3795
  end
3811
- # line 374 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3796
+ # line 373 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3812
3797
  begin
3813
3798
  te = p
3814
3799
  p = p - 1; begin
@@ -3829,7 +3814,7 @@ p = p - 1; begin
3829
3814
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
3830
3815
  raise PrematureEndError.new( text )
3831
3816
  end
3832
- # line 394 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3817
+ # line 393 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3833
3818
  begin
3834
3819
  te = p
3835
3820
  p = p - 1; begin
@@ -3860,7 +3845,7 @@ p = p - 1; begin
3860
3845
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
3861
3846
  raise PrematureEndError.new( text )
3862
3847
  end
3863
- # line 394 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3848
+ # line 393 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3864
3849
  begin
3865
3850
  begin p = ((te))-1; end
3866
3851
  begin
@@ -3891,7 +3876,7 @@ p = p - 1; begin
3891
3876
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
3892
3877
  raise InvalidSequenceError.new('sequence', text)
3893
3878
  end
3894
- # line 370 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3879
+ # line 369 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3895
3880
  begin
3896
3881
  te = p+1
3897
3882
  begin
@@ -3915,7 +3900,7 @@ te = p+1
3915
3900
  # line 146 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3916
3901
  begin
3917
3902
  @group_depth -= 1; @in_group = @group_depth > 0 ? true : false end
3918
- # line 540 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3903
+ # line 539 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3919
3904
  begin
3920
3905
  te = p+1
3921
3906
  begin
@@ -3926,7 +3911,7 @@ te = p+1
3926
3911
  # line 146 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3927
3912
  begin
3928
3913
  @group_depth -= 1; @in_group = @group_depth > 0 ? true : false end
3929
- # line 607 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3914
+ # line 606 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3930
3915
  begin
3931
3916
  te = p+1
3932
3917
  begin
@@ -3976,7 +3961,7 @@ act = 18; end
3976
3961
  begin
3977
3962
  te = p+1
3978
3963
  end
3979
- # line 292 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3964
+ # line 291 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3980
3965
  begin
3981
3966
  act = 20; end
3982
3967
  when 86 then
@@ -3984,7 +3969,7 @@ act = 20; end
3984
3969
  begin
3985
3970
  te = p+1
3986
3971
  end
3987
- # line 302 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3972
+ # line 301 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3988
3973
  begin
3989
3974
  act = 21; end
3990
3975
  when 85 then
@@ -3992,7 +3977,7 @@ act = 21; end
3992
3977
  begin
3993
3978
  te = p+1
3994
3979
  end
3995
- # line 308 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3980
+ # line 307 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3996
3981
  begin
3997
3982
  act = 22; end
3998
3983
  when 2 then
@@ -4000,10 +3985,10 @@ act = 22; end
4000
3985
  begin
4001
3986
  te = p+1
4002
3987
  end
4003
- # line 764 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
3988
+ # line 763 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
4004
3989
  begin
4005
3990
  act = 59; end
4006
- # line 4006 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
3991
+ # line 3991 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
4007
3992
  end
4008
3993
  end
4009
3994
  end
@@ -4021,7 +4006,7 @@ ts = nil; end
4021
4006
  begin
4022
4007
  act = 0
4023
4008
  end
4024
- # line 4024 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
4009
+ # line 4009 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
4025
4010
  end
4026
4011
 
4027
4012
  if cs == 0
@@ -4055,7 +4040,7 @@ act = 0
4055
4040
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
4056
4041
  raise PrematureEndError.new( text )
4057
4042
  end
4058
- # line 4058 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
4043
+ # line 4043 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner.rb"
4059
4044
  end
4060
4045
  end
4061
4046
 
@@ -4066,7 +4051,7 @@ act = 0
4066
4051
  end
4067
4052
  end
4068
4053
 
4069
- # line 861 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
4054
+ # line 860 "/Users/ammar/src/code/ruby/projects/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
4070
4055
 
4071
4056
  if cs == re_scanner_error
4072
4057
  text = ts ? copy(data, ts-1..-1) : data.pack('c*')
@@ -579,8 +579,6 @@
579
579
  self.emit(type, :script_unknown, text, ts-1, te)
580
580
 
581
581
  # Unicode blocks
582
- when 'inalphabeticpresentationforms'
583
- self.emit(type, :block_inalphabetic_presentation_forms, text, ts-1, te)
584
582
  when 'inalphabeticpresentationforms'
585
583
  self.emit(type, :block_inalphabetic_presentation_forms, text, ts-1, te)
586
584
  when 'inarabicpresentationforms-a'
@@ -281,7 +281,6 @@
281
281
  fhold;
282
282
  fnext character_set;
283
283
  fcall unicode_property;
284
- fret;
285
284
  };
286
285
 
287
286
  # special case exclusion of escaped dash, could be cleaner.
@@ -409,7 +408,7 @@
409
408
  property_char > (escaped_alpha, 2) {
410
409
  fhold;
411
410
  fnext main;
412
- fcall unicode_property; fret;
411
+ fcall unicode_property;
413
412
  };
414
413
 
415
414
  (any -- non_literal_escape) > (escaped_alpha, 1) {
@@ -833,7 +832,7 @@ module Regexp::Scanner
833
832
  # This method may raise errors if a syntax error is encountered.
834
833
  # --------------------------------------------------------------------------
835
834
  def self.scan(input_object, &block)
836
- top, stack = 0, []
835
+ @literal, top, stack = nil, 0, []
837
836
 
838
837
  if input_object.is_a?(Regexp)
839
838
  input = input_object.source
@@ -12,6 +12,12 @@ class Regexp
12
12
  ].freeze
13
13
 
14
14
  Token = Struct.new(*TOKEN_KEYS) do
15
+ def initialize(*)
16
+ super
17
+
18
+ @previous = @next = nil
19
+ end
20
+
15
21
  def offset
16
22
  [self.ts, self.te]
17
23
  end
@@ -1,5 +1,5 @@
1
1
  class Regexp
2
2
  module Parser
3
- VERSION = '0.3.5'
3
+ VERSION = '0.3.6'
4
4
  end
5
5
  end
@@ -65,7 +65,7 @@ class ExpressionBase < Test::Unit::TestCase
65
65
  assert_equal '@0+12', root.coded_offset
66
66
 
67
67
  # All top level offsets
68
- checks = [
68
+ [
69
69
  [ '@0+1', '^' ],
70
70
  [ '@1+2', 'a*' ],
71
71
  [ '@3+8', '(b+(c?))' ],
@@ -32,7 +32,6 @@ class ExpressionConditionals < Test::Unit::TestCase
32
32
  def test_expression_conditional_level_one
33
33
  condition = @cond_1.condition
34
34
  branch_1 = @cond_1.branches.first
35
- branch_2 = @cond_1.branches.last
36
35
 
37
36
  # Condition
38
37
  assert_equal true, is_conditional_condition?(condition)
@@ -31,7 +31,7 @@ class LexerConditionals < Test::Unit::TestCase
31
31
  regexp = /((?<A>a)(?<B>(?(<A>)b|((?(<B>)[e-g]|[h-j])))))/
32
32
  tokens = RL.lex(regexp)
33
33
 
34
- expected = [
34
+ [
35
35
  [ 0, :group, :capture, '(', 0, 1, 0, 0, 0],
36
36
  [ 1, :group, :named, '(?<A>', 1, 6, 1, 0, 0],
37
37
 
@@ -70,7 +70,7 @@ class LexerConditionals < Test::Unit::TestCase
70
70
  regexp = /(a(b(c)))(?(1)(?(2)(?(3)d|e))|(?(3)(?(2)f|g)|(?(1)f|g)))/
71
71
  tokens = RL.lex(regexp)
72
72
 
73
- expected = [
73
+ [
74
74
  [ 9, :conditional, :open, '(?', 9, 11, 0, 0, 0],
75
75
  [10, :conditional, :condition, '(1)', 11, 14, 0, 0, 1],
76
76
 
@@ -46,7 +46,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
46
46
  assert_equal true, exp.quantified?
47
47
  assert_equal :zero_or_more, exp.quantifier.token
48
48
  assert_equal 0, exp.quantifier.min
49
- assert_equal -1, exp.quantifier.max
49
+ assert_equal(-1, exp.quantifier.max)
50
50
  assert_equal :greedy, exp.quantifier.mode
51
51
  end
52
52
 
@@ -57,7 +57,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
57
57
  assert_equal true, exp.quantified?
58
58
  assert_equal :zero_or_more, exp.quantifier.token
59
59
  assert_equal 0, exp.quantifier.min
60
- assert_equal -1, exp.quantifier.max
60
+ assert_equal(-1, exp.quantifier.max)
61
61
  assert_equal :reluctant, exp.quantifier.mode
62
62
  assert_equal true, exp.reluctant?
63
63
  end
@@ -69,7 +69,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
69
69
  assert_equal true, exp.quantified?
70
70
  assert_equal :zero_or_more, exp.quantifier.token
71
71
  assert_equal 0, exp.quantifier.min
72
- assert_equal -1, exp.quantifier.max
72
+ assert_equal(-1, exp.quantifier.max)
73
73
  assert_equal :possessive, exp.quantifier.mode
74
74
  assert_equal true, exp.possessive?
75
75
  end
@@ -82,7 +82,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
82
82
  assert_equal true, exp.quantified?
83
83
  assert_equal :one_or_more, exp.quantifier.token
84
84
  assert_equal 1, exp.quantifier.min
85
- assert_equal -1, exp.quantifier.max
85
+ assert_equal(-1, exp.quantifier.max)
86
86
  assert_equal :greedy, exp.quantifier.mode
87
87
  end
88
88
 
@@ -93,7 +93,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
93
93
  assert_equal true, exp.quantified?
94
94
  assert_equal :one_or_more, exp.quantifier.token
95
95
  assert_equal 1, exp.quantifier.min
96
- assert_equal -1, exp.quantifier.max
96
+ assert_equal(-1, exp.quantifier.max)
97
97
  assert_equal :reluctant, exp.quantifier.mode
98
98
  assert_equal true, exp.reluctant?
99
99
  end
@@ -105,7 +105,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
105
105
  assert_equal true, exp.quantified?
106
106
  assert_equal :one_or_more, exp.quantifier.token
107
107
  assert_equal 1, exp.quantifier.min
108
- assert_equal -1, exp.quantifier.max
108
+ assert_equal(-1, exp.quantifier.max)
109
109
  assert_equal :possessive, exp.quantifier.mode
110
110
  assert_equal true, exp.possessive?
111
111
  end
@@ -154,7 +154,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
154
154
  assert_equal true, exp.quantified?
155
155
  assert_equal :interval, exp.quantifier.token
156
156
  assert_equal 2, exp.quantifier.min
157
- assert_equal -1, exp.quantifier.max
157
+ assert_equal(-1, exp.quantifier.max)
158
158
  assert_equal :greedy, exp.quantifier.mode
159
159
  end
160
160
 
@@ -166,7 +166,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
166
166
  assert_equal :interval, exp.quantifier.token
167
167
  assert_equal '{2,}?', exp.quantifier.text
168
168
  assert_equal 2, exp.quantifier.min
169
- assert_equal -1, exp.quantifier.max
169
+ assert_equal(-1, exp.quantifier.max)
170
170
  assert_equal :reluctant, exp.quantifier.mode
171
171
  assert_equal true, exp.reluctant?
172
172
  end
@@ -179,7 +179,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
179
179
  assert_equal :interval, exp.quantifier.token
180
180
  assert_equal '{3,}+', exp.quantifier.text
181
181
  assert_equal 3, exp.quantifier.min
182
- assert_equal -1, exp.quantifier.max
182
+ assert_equal(-1, exp.quantifier.max)
183
183
  assert_equal :possessive, exp.quantifier.mode
184
184
  assert_equal true, exp.possessive?
185
185
  end
@@ -11,7 +11,7 @@ class TestParserSets < Test::Unit::TestCase
11
11
 
12
12
  assert_equal true, exp.quantified?
13
13
  assert_equal 1, exp.quantifier.min
14
- assert_equal -1, exp.quantifier.max
14
+ assert_equal(-1, exp.quantifier.max)
15
15
  end
16
16
 
17
17
  def test_parse_set_posix_class
@@ -13,7 +13,7 @@ class ScannerEscapes < Test::Unit::TestCase
13
13
  /c\tt/ => [1, :escape, :tab, '\t', 1, 3],
14
14
  /c\vt/ => [1, :escape, :vertical_tab, '\v', 1, 3],
15
15
 
16
- /c\qt/ => [1, :escape, :literal, '\q', 1, 3],
16
+ 'c\qt' => [1, :escape, :literal, '\q', 1, 3],
17
17
 
18
18
  'a\012c' => [1, :escape, :octal, '\012', 1, 5],
19
19
  'a\0124' => [1, :escape, :octal, '\012', 1, 5],
@@ -0,0 +1,8 @@
1
+ require 'test/unit/autorunner'
2
+
3
+ module Test::Unit
4
+ class AutoRunner
5
+ def self.need_auto_run?
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,41 @@
1
+ require 'pathname'
2
+
3
+ module RegexpParserTest
4
+ class Runner
5
+ def initialize(arguments, warning_whitelist)
6
+ @arguments = arguments
7
+ @warning_whitelist = warning_whitelist
8
+ end
9
+
10
+ def run
11
+ test_status = nil
12
+
13
+ Warning::Filter.new(warning_whitelist).assert_expected_warnings_only do
14
+ setup
15
+ test_status = run_test_unit
16
+ end
17
+
18
+ test_status
19
+ end
20
+
21
+ private
22
+
23
+ def setup
24
+ $VERBOSE = true
25
+
26
+ test_files.each(&method(:require))
27
+ end
28
+
29
+ def run_test_unit
30
+ Test::Unit::AutoRunner.run
31
+ end
32
+
33
+ def test_files
34
+ arguments
35
+ .map { |path| Pathname.new(path).expand_path.freeze }
36
+ .select(&:file?)
37
+ end
38
+
39
+ attr_reader :arguments, :warning_whitelist
40
+ end
41
+ end
@@ -0,0 +1,59 @@
1
+ require 'set'
2
+
3
+ module RegexpParserTest
4
+ class Warning
5
+ class UnexpectedWarnings < StandardError
6
+ MSG = 'Unexpected warnings: %s'.freeze
7
+
8
+ def initialize(warnings)
9
+ super(MSG % warnings.join("\n"))
10
+ end
11
+ end
12
+
13
+ class Filter
14
+ def initialize(whitelist)
15
+ @whitelist = whitelist
16
+ end
17
+
18
+ def assert_expected_warnings_only
19
+ original = $stderr
20
+ $stderr = Extractor.new(original, @whitelist)
21
+
22
+ yield
23
+
24
+ assert_no_warnings($stderr.warnings)
25
+ ensure
26
+ $stderr = original
27
+ end
28
+
29
+ private
30
+
31
+ def assert_no_warnings(warnings)
32
+ fail UnexpectedWarnings, warnings.to_a if warnings.any?
33
+ end
34
+ end
35
+
36
+ class Extractor < DelegateClass(IO)
37
+ PATTERN = /\A(?:.+):(?:\d+): warning: (?:.+)\n\z/.freeze
38
+
39
+ def initialize(io, whitelist)
40
+ @whitelist = whitelist
41
+ @warnings = Set.new
42
+ super(io)
43
+ end
44
+
45
+ def write(message)
46
+ return super if PATTERN !~ message
47
+
48
+ warning = message.chomp
49
+ @warnings << warning if @whitelist.none?(&warning.method(:end_with?))
50
+
51
+ self
52
+ end
53
+
54
+ def warnings
55
+ @warnings.dup.freeze
56
+ end
57
+ end
58
+ end
59
+ end
@@ -20,8 +20,6 @@ class TestSyntaxRuby_V193 < Test::Unit::TestCase
20
20
  }
21
21
 
22
22
  tests.each do |method, types|
23
- expected = method == :excludes ? false : true
24
-
25
23
  types.each do |type, tokens|
26
24
  tokens.each do |token|
27
25
  define_method "test_syntax_ruby_v193_#{method}_#{type}_#{token}" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regexp_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ammar Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-30 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
14
14
  email:
@@ -144,6 +144,9 @@ files:
144
144
  - test/scanner/test_sets.rb
145
145
  - test/scanner/test_types.rb
146
146
  - test/scanner/test_unicode_blocks.rb
147
+ - test/support/disable_autotest.rb
148
+ - test/support/runner.rb
149
+ - test/support/warning_extractor.rb
147
150
  - test/syntax/ruby/test_1.8.rb
148
151
  - test/syntax/ruby/test_1.9.1.rb
149
152
  - test/syntax/ruby/test_1.9.3.rb
@@ -233,6 +236,9 @@ test_files:
233
236
  - test/scanner/test_sets.rb
234
237
  - test/scanner/test_types.rb
235
238
  - test/scanner/test_unicode_blocks.rb
239
+ - test/support/disable_autotest.rb
240
+ - test/support/runner.rb
241
+ - test/support/warning_extractor.rb
236
242
  - test/syntax/ruby/test_1.8.rb
237
243
  - test/syntax/ruby/test_1.9.1.rb
238
244
  - test/syntax/ruby/test_1.9.3.rb