rbx-trepanning 0.0.7-universal-rubinius-1.2 → 0.0.8-universal-rubinius-1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/ChangeLog +236 -0
  2. data/NEWS +16 -0
  3. data/Rakefile +60 -11
  4. data/app/breakpoint.rb +5 -1
  5. data/app/brkptmgr.rb +5 -0
  6. data/app/cmd_parse.kpeg +225 -0
  7. data/app/cmd_parse.rb +209 -0
  8. data/app/cmd_parser.rb +1894 -0
  9. data/app/default.rb +0 -1
  10. data/app/method.rb +12 -8
  11. data/app/options.rb +2 -9
  12. data/app/validate.rb +2 -2
  13. data/bin/trepanx +3 -3
  14. data/lib/trepanning.rb +9 -6
  15. data/processor/breakpoint.rb +5 -19
  16. data/processor/command/alias.rb +4 -5
  17. data/processor/command/base/submgr.rb +2 -2
  18. data/processor/command/break.rb +44 -66
  19. data/processor/command/condition.rb +2 -0
  20. data/processor/command/continue.rb +11 -41
  21. data/processor/command/disassemble.rb +2 -0
  22. data/processor/command/eval.rb +20 -8
  23. data/processor/command/exit.rb +3 -2
  24. data/{doc → processor/command/help}/.gitignore +0 -0
  25. data/processor/command/help/command.txt +48 -0
  26. data/processor/command/help/filename.txt +40 -0
  27. data/processor/command/help/location.txt +37 -0
  28. data/processor/command/help.rb +52 -73
  29. data/processor/command/info_subcmd/breakpoints.rb +35 -13
  30. data/processor/command/info_subcmd/files.rb +34 -25
  31. data/processor/command/info_subcmd/frame.rb +67 -0
  32. data/processor/command/kill.rb +0 -1
  33. data/processor/command/restart.rb +8 -8
  34. data/processor/command/save.rb +58 -0
  35. data/processor/command/set_subcmd/trace_subcmd/buffer.rb +1 -1
  36. data/processor/command/set_subcmd/trace_subcmd/print.rb +1 -1
  37. data/processor/command/show.rb +7 -6
  38. data/processor/command/step.rb +16 -3
  39. data/processor/command/tbreak.rb +1 -1
  40. data/processor/disassemble.rb +1 -1
  41. data/processor/help.rb +20 -0
  42. data/processor/load_cmds.rb +53 -4
  43. data/processor/location.rb +47 -1
  44. data/processor/main.rb +4 -9
  45. data/processor/mock.rb +3 -3
  46. data/processor/running.rb +16 -17
  47. data/processor/validate.rb +171 -159
  48. data/rbx-trepanning.gemspec +1 -1
  49. data/test/example/debugger-stop.rb +16 -0
  50. data/test/functional/test-break-name.rb +1 -1
  51. data/test/functional/test-eval.rb +115 -0
  52. data/test/functional/test-tbreak.rb +1 -1
  53. data/test/integration/helper.rb +5 -2
  54. data/test/unit/cmd-helper.rb +1 -1
  55. data/test/unit/test-app-cmd_parse.rb +97 -0
  56. data/test/unit/test-app-cmd_parser.rb +22 -0
  57. data/test/unit/test-app-options.rb +1 -0
  58. data/test/unit/test-app-validate.rb +2 -2
  59. data/test/unit/test-cmd-break.rb +47 -5
  60. data/test/unit/test-completion.rb +2 -1
  61. data/test/unit/test-proc-location.rb +11 -0
  62. data/test/unit/test-proc-validate.rb +68 -30
  63. metadata +26 -11
  64. data/doc/debugger.html +0 -108
data/app/cmd_parser.rb ADDED
@@ -0,0 +1,1894 @@
1
+ class CmdParse
2
+ # STANDALONE START
3
+ def setup_parser(str, debug=false)
4
+ @string = str
5
+ @pos = 0
6
+ @memoizations = Hash.new { |h,k| h[k] = {} }
7
+ @result = nil
8
+ @failing_offset = -1
9
+ @expected_string = []
10
+
11
+ enhance_errors! if debug
12
+ end
13
+
14
+ # This is distinct from setup_parser so that a standalone parser
15
+ # can redefine #initialize and still have access to the proper
16
+ # parser setup code.
17
+ #
18
+ def initialize(str, debug=false)
19
+ setup_parser(str, debug)
20
+ end
21
+
22
+ attr_reader :string
23
+ attr_reader :result, :failing_offset, :expected_string
24
+ attr_accessor :pos
25
+
26
+ # STANDALONE START
27
+ def current_column(target=pos)
28
+ offset = 0
29
+ string.each_line do |line|
30
+ len = line.size
31
+ return (target - offset) if offset + len >= target
32
+ offset += len
33
+ end
34
+
35
+ -1
36
+ end
37
+
38
+ def current_line(target=pos)
39
+ cur_offset = 0
40
+ cur_line = 0
41
+
42
+ string.each_line do |line|
43
+ cur_line += 1
44
+ cur_offset += line.size
45
+ return cur_line if cur_offset >= target
46
+ end
47
+
48
+ -1
49
+ end
50
+
51
+ def lines
52
+ lines = []
53
+ string.each_line { |l| lines << l }
54
+ lines
55
+ end
56
+
57
+ def error_expectation
58
+ error_pos = failing_offset()
59
+ line_no = current_line(error_pos)
60
+ col_no = current_column(error_pos)
61
+
62
+ expected = expected_string()
63
+
64
+ prefix = nil
65
+
66
+ case expected
67
+ when String
68
+ prefix = expected.inspect
69
+ when Range
70
+ prefix = "to be between #{expected.begin} and #{expected.end}"
71
+ when Array
72
+ prefix = "to be one of #{expected.inspect}"
73
+ when nil
74
+ prefix = "anything (no more input)"
75
+ else
76
+ prefix = "unknown"
77
+ end
78
+
79
+ return "Expected #{prefix} at line #{line_no}, column #{col_no} (offset #{error_pos})"
80
+ end
81
+
82
+ def show_error(io=STDOUT)
83
+ error_pos = failing_offset()
84
+ line_no = current_line(error_pos)
85
+ col_no = current_column(error_pos)
86
+
87
+ io.puts error_expectation()
88
+ io.puts "Got: #{string[error_pos,1].inspect}"
89
+ line = lines[line_no-1]
90
+ io.puts "=> #{line}"
91
+ io.print(" " * (col_no + 3))
92
+ io.puts "^"
93
+ end
94
+
95
+ #
96
+
97
+ def get_text(start)
98
+ @string[start..@pos-1]
99
+ end
100
+
101
+ def show_pos
102
+ width = 10
103
+ if @pos < width
104
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
105
+ else
106
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
107
+ end
108
+ end
109
+
110
+ def add_failure(obj)
111
+ @expected_string = obj
112
+ @failing_offset = @pos if @pos > @failing_offset
113
+ end
114
+
115
+ def match_string(str)
116
+ len = str.size
117
+ if @string[pos,len] == str
118
+ @pos += len
119
+ return str
120
+ end
121
+
122
+ add_failure(str)
123
+
124
+ return nil
125
+ end
126
+
127
+ def fail_range(start,fin)
128
+ @pos -= 1
129
+
130
+ add_failure Range.new(start, fin)
131
+ end
132
+
133
+ def scan(reg)
134
+ if m = reg.match(@string[@pos..-1])
135
+ width = m.end(0)
136
+ @pos += width
137
+ return true
138
+ end
139
+
140
+ add_failure reg
141
+
142
+ return nil
143
+ end
144
+
145
+ if "".respond_to? :getbyte
146
+ def get_byte
147
+ if @pos >= @string.size
148
+ add_failure nil
149
+ return nil
150
+ end
151
+
152
+ s = @string.getbyte @pos
153
+ @pos += 1
154
+ s
155
+ end
156
+ else
157
+ def get_byte
158
+ if @pos >= @string.size
159
+ add_failure nil
160
+ return nil
161
+ end
162
+
163
+ s = @string[@pos]
164
+ @pos += 1
165
+ s
166
+ end
167
+ end
168
+
169
+ module EnhancedErrors
170
+ def add_failure(obj)
171
+ @expected_string << obj
172
+ @failing_offset = @pos if @pos > @failing_offset
173
+ end
174
+
175
+ def match_string(str)
176
+ if ans = super
177
+ @expected_string.clear
178
+ end
179
+
180
+ ans
181
+ end
182
+
183
+ def scan(reg)
184
+ if ans = super
185
+ @expected_string.clear
186
+ end
187
+
188
+ ans
189
+ end
190
+
191
+ def get_byte
192
+ if ans = super
193
+ @expected_string.clear
194
+ end
195
+
196
+ ans
197
+ end
198
+ end
199
+
200
+ def enhance_errors!
201
+ extend EnhancedErrors
202
+ end
203
+
204
+ def parse
205
+ _root ? true : false
206
+ end
207
+
208
+ class LeftRecursive
209
+ def initialize(detected=false)
210
+ @detected = detected
211
+ end
212
+
213
+ attr_accessor :detected
214
+ end
215
+
216
+ class MemoEntry
217
+ def initialize(ans, pos)
218
+ @ans = ans
219
+ @pos = pos
220
+ @uses = 1
221
+ @result = nil
222
+ end
223
+
224
+ attr_reader :ans, :pos, :uses, :result
225
+
226
+ def inc!
227
+ @uses += 1
228
+ end
229
+
230
+ def move!(ans, pos, result)
231
+ @ans = ans
232
+ @pos = pos
233
+ @result = result
234
+ end
235
+ end
236
+
237
+ def apply(rule)
238
+ if m = @memoizations[rule][@pos]
239
+ m.inc!
240
+
241
+ prev = @pos
242
+ @pos = m.pos
243
+ if m.ans.kind_of? LeftRecursive
244
+ m.ans.detected = true
245
+ return nil
246
+ end
247
+
248
+ @result = m.result
249
+
250
+ return m.ans
251
+ else
252
+ lr = LeftRecursive.new(false)
253
+ m = MemoEntry.new(lr, @pos)
254
+ @memoizations[rule][@pos] = m
255
+ start_pos = @pos
256
+
257
+ ans = __send__ rule
258
+
259
+ m.move! ans, @pos, @result
260
+
261
+ # Don't bother trying to grow the left recursion
262
+ # if it's failing straight away (thus there is no seed)
263
+ if ans and lr.detected
264
+ return grow_lr(rule, start_pos, m)
265
+ else
266
+ return ans
267
+ end
268
+
269
+ return ans
270
+ end
271
+ end
272
+
273
+ def grow_lr(rule, start_pos, m)
274
+ while true
275
+ @pos = start_pos
276
+ @result = m.result
277
+
278
+ ans = __send__ rule
279
+ return nil unless ans
280
+
281
+ break if @pos <= m.pos
282
+
283
+ m.move! ans, @pos, @result
284
+ end
285
+
286
+ @result = m.result
287
+ @pos = m.pos
288
+ return m.ans
289
+ end
290
+
291
+ #
292
+
293
+
294
+ #####################################################
295
+ # Structure to hold composite method names
296
+ SymbolEntry = Struct.new(:type, :name, :chain)
297
+
298
+
299
+ # Structure to hold position information
300
+ Position = Struct.new(:container_type, :container,
301
+ :position_type, :position)
302
+
303
+ # Structure to hold breakpoint information
304
+ Breakpoint = Struct.new(:position, :negate, :condition)
305
+
306
+ # Structure to hold list information
307
+ List = Struct.new(:position, :num)
308
+
309
+
310
+
311
+
312
+ # upcase_letter = /[A-Z]/
313
+ def _upcase_letter
314
+ _tmp = scan(/\A(?-mix:[A-Z])/)
315
+ return _tmp
316
+ end
317
+
318
+ # downcase_letter = /[a-z]/
319
+ def _downcase_letter
320
+ _tmp = scan(/\A(?-mix:[a-z])/)
321
+ return _tmp
322
+ end
323
+
324
+ # suffix_letter = /[=!?]/
325
+ def _suffix_letter
326
+ _tmp = scan(/\A(?-mix:[=!?])/)
327
+ return _tmp
328
+ end
329
+
330
+ # letter = (upcase_letter | downcase_letter)
331
+ def _letter
332
+
333
+ _save = self.pos
334
+ while true # choice
335
+ _tmp = apply(:_upcase_letter)
336
+ break if _tmp
337
+ self.pos = _save
338
+ _tmp = apply(:_downcase_letter)
339
+ break if _tmp
340
+ self.pos = _save
341
+ break
342
+ end # end choice
343
+
344
+ return _tmp
345
+ end
346
+
347
+ # id_symbol = (letter | "_" | [0-9])
348
+ def _id_symbol
349
+
350
+ _save = self.pos
351
+ while true # choice
352
+ _tmp = apply(:_letter)
353
+ break if _tmp
354
+ self.pos = _save
355
+ _tmp = match_string("_")
356
+ break if _tmp
357
+ self.pos = _save
358
+ _tmp = get_byte
359
+ if _tmp
360
+ unless _tmp >= 48 and _tmp <= 57
361
+ fail_range('0', '9')
362
+ _tmp = nil
363
+ end
364
+ end
365
+ break if _tmp
366
+ self.pos = _save
367
+ break
368
+ end # end choice
369
+
370
+ return _tmp
371
+ end
372
+
373
+ # vm_identifier = < (downcase_letter | "_") id_symbol* suffix_letter? > { SymbolEntry.new(:variable, text) }
374
+ def _vm_identifier
375
+
376
+ _save = self.pos
377
+ while true # sequence
378
+ _text_start = self.pos
379
+
380
+ _save1 = self.pos
381
+ while true # sequence
382
+
383
+ _save2 = self.pos
384
+ while true # choice
385
+ _tmp = apply(:_downcase_letter)
386
+ break if _tmp
387
+ self.pos = _save2
388
+ _tmp = match_string("_")
389
+ break if _tmp
390
+ self.pos = _save2
391
+ break
392
+ end # end choice
393
+
394
+ unless _tmp
395
+ self.pos = _save1
396
+ break
397
+ end
398
+ while true
399
+ _tmp = apply(:_id_symbol)
400
+ break unless _tmp
401
+ end
402
+ _tmp = true
403
+ unless _tmp
404
+ self.pos = _save1
405
+ break
406
+ end
407
+ _save4 = self.pos
408
+ _tmp = apply(:_suffix_letter)
409
+ unless _tmp
410
+ _tmp = true
411
+ self.pos = _save4
412
+ end
413
+ unless _tmp
414
+ self.pos = _save1
415
+ end
416
+ break
417
+ end # end sequence
418
+
419
+ if _tmp
420
+ text = get_text(_text_start)
421
+ end
422
+ unless _tmp
423
+ self.pos = _save
424
+ break
425
+ end
426
+ @result = begin;
427
+ SymbolEntry.new(:variable, text)
428
+ ; end
429
+ _tmp = true
430
+ unless _tmp
431
+ self.pos = _save
432
+ end
433
+ break
434
+ end # end sequence
435
+
436
+ return _tmp
437
+ end
438
+
439
+ # variable_identifier = < (downcase_letter | "_") id_symbol* > { SymbolEntry.new(:variable, text) }
440
+ def _variable_identifier
441
+
442
+ _save = self.pos
443
+ while true # sequence
444
+ _text_start = self.pos
445
+
446
+ _save1 = self.pos
447
+ while true # sequence
448
+
449
+ _save2 = self.pos
450
+ while true # choice
451
+ _tmp = apply(:_downcase_letter)
452
+ break if _tmp
453
+ self.pos = _save2
454
+ _tmp = match_string("_")
455
+ break if _tmp
456
+ self.pos = _save2
457
+ break
458
+ end # end choice
459
+
460
+ unless _tmp
461
+ self.pos = _save1
462
+ break
463
+ end
464
+ while true
465
+ _tmp = apply(:_id_symbol)
466
+ break unless _tmp
467
+ end
468
+ _tmp = true
469
+ unless _tmp
470
+ self.pos = _save1
471
+ end
472
+ break
473
+ end # end sequence
474
+
475
+ if _tmp
476
+ text = get_text(_text_start)
477
+ end
478
+ unless _tmp
479
+ self.pos = _save
480
+ break
481
+ end
482
+ @result = begin;
483
+ SymbolEntry.new(:variable, text)
484
+ ; end
485
+ _tmp = true
486
+ unless _tmp
487
+ self.pos = _save
488
+ end
489
+ break
490
+ end # end sequence
491
+
492
+ return _tmp
493
+ end
494
+
495
+ # constant_identifier = < upcase_letter id_symbol* > { SymbolEntry.new(:constant, text) }
496
+ def _constant_identifier
497
+
498
+ _save = self.pos
499
+ while true # sequence
500
+ _text_start = self.pos
501
+
502
+ _save1 = self.pos
503
+ while true # sequence
504
+ _tmp = apply(:_upcase_letter)
505
+ unless _tmp
506
+ self.pos = _save1
507
+ break
508
+ end
509
+ while true
510
+ _tmp = apply(:_id_symbol)
511
+ break unless _tmp
512
+ end
513
+ _tmp = true
514
+ unless _tmp
515
+ self.pos = _save1
516
+ end
517
+ break
518
+ end # end sequence
519
+
520
+ if _tmp
521
+ text = get_text(_text_start)
522
+ end
523
+ unless _tmp
524
+ self.pos = _save
525
+ break
526
+ end
527
+ @result = begin;
528
+ SymbolEntry.new(:constant, text)
529
+ ; end
530
+ _tmp = true
531
+ unless _tmp
532
+ self.pos = _save
533
+ end
534
+ break
535
+ end # end sequence
536
+
537
+ return _tmp
538
+ end
539
+
540
+ # global_identifier = < "$" (constant_identifier | variable_identifier) > { SymbolEntry.new(:global, text) }
541
+ def _global_identifier
542
+
543
+ _save = self.pos
544
+ while true # sequence
545
+ _text_start = self.pos
546
+
547
+ _save1 = self.pos
548
+ while true # sequence
549
+ _tmp = match_string("$")
550
+ unless _tmp
551
+ self.pos = _save1
552
+ break
553
+ end
554
+
555
+ _save2 = self.pos
556
+ while true # choice
557
+ _tmp = apply(:_constant_identifier)
558
+ break if _tmp
559
+ self.pos = _save2
560
+ _tmp = apply(:_variable_identifier)
561
+ break if _tmp
562
+ self.pos = _save2
563
+ break
564
+ end # end choice
565
+
566
+ unless _tmp
567
+ self.pos = _save1
568
+ end
569
+ break
570
+ end # end sequence
571
+
572
+ if _tmp
573
+ text = get_text(_text_start)
574
+ end
575
+ unless _tmp
576
+ self.pos = _save
577
+ break
578
+ end
579
+ @result = begin;
580
+ SymbolEntry.new(:global, text)
581
+ ; end
582
+ _tmp = true
583
+ unless _tmp
584
+ self.pos = _save
585
+ end
586
+ break
587
+ end # end sequence
588
+
589
+ return _tmp
590
+ end
591
+
592
+ # local_internal_identifier = (constant_identifier | variable_identifier)
593
+ def _local_internal_identifier
594
+
595
+ _save = self.pos
596
+ while true # choice
597
+ _tmp = apply(:_constant_identifier)
598
+ break if _tmp
599
+ self.pos = _save
600
+ _tmp = apply(:_variable_identifier)
601
+ break if _tmp
602
+ self.pos = _save
603
+ break
604
+ end # end choice
605
+
606
+ return _tmp
607
+ end
608
+
609
+ # local_identifier = (constant_identifier | vm_identifier)
610
+ def _local_identifier
611
+
612
+ _save = self.pos
613
+ while true # choice
614
+ _tmp = apply(:_constant_identifier)
615
+ break if _tmp
616
+ self.pos = _save
617
+ _tmp = apply(:_vm_identifier)
618
+ break if _tmp
619
+ self.pos = _save
620
+ break
621
+ end # end choice
622
+
623
+ return _tmp
624
+ end
625
+
626
+ # instance_identifier = < "@" local_identifier > { SymbolEntry.new(:instance, text) }
627
+ def _instance_identifier
628
+
629
+ _save = self.pos
630
+ while true # sequence
631
+ _text_start = self.pos
632
+
633
+ _save1 = self.pos
634
+ while true # sequence
635
+ _tmp = match_string("@")
636
+ unless _tmp
637
+ self.pos = _save1
638
+ break
639
+ end
640
+ _tmp = apply(:_local_identifier)
641
+ unless _tmp
642
+ self.pos = _save1
643
+ end
644
+ break
645
+ end # end sequence
646
+
647
+ if _tmp
648
+ text = get_text(_text_start)
649
+ end
650
+ unless _tmp
651
+ self.pos = _save
652
+ break
653
+ end
654
+ @result = begin;
655
+ SymbolEntry.new(:instance, text)
656
+ ; end
657
+ _tmp = true
658
+ unless _tmp
659
+ self.pos = _save
660
+ end
661
+ break
662
+ end # end sequence
663
+
664
+ return _tmp
665
+ end
666
+
667
+ # classvar_identifier = "@@" local_identifier:id { SymbolEntry.new(:classvar, id) }
668
+ def _classvar_identifier
669
+
670
+ _save = self.pos
671
+ while true # sequence
672
+ _tmp = match_string("@@")
673
+ unless _tmp
674
+ self.pos = _save
675
+ break
676
+ end
677
+ _tmp = apply(:_local_identifier)
678
+ id = @result
679
+ unless _tmp
680
+ self.pos = _save
681
+ break
682
+ end
683
+ @result = begin;
684
+ SymbolEntry.new(:classvar, id)
685
+ ; end
686
+ _tmp = true
687
+ unless _tmp
688
+ self.pos = _save
689
+ end
690
+ break
691
+ end # end sequence
692
+
693
+ return _tmp
694
+ end
695
+
696
+ # identifier = (global_identifier | instance_identifier | classvar_identifier | local_identifier)
697
+ def _identifier
698
+
699
+ _save = self.pos
700
+ while true # choice
701
+ _tmp = apply(:_global_identifier)
702
+ break if _tmp
703
+ self.pos = _save
704
+ _tmp = apply(:_instance_identifier)
705
+ break if _tmp
706
+ self.pos = _save
707
+ _tmp = apply(:_classvar_identifier)
708
+ break if _tmp
709
+ self.pos = _save
710
+ _tmp = apply(:_local_identifier)
711
+ break if _tmp
712
+ self.pos = _save
713
+ break
714
+ end # end choice
715
+
716
+ return _tmp
717
+ end
718
+
719
+ # id_separator = < ("::" | ".") > { text }
720
+ def _id_separator
721
+
722
+ _save = self.pos
723
+ while true # sequence
724
+ _text_start = self.pos
725
+
726
+ _save1 = self.pos
727
+ while true # choice
728
+ _tmp = match_string("::")
729
+ break if _tmp
730
+ self.pos = _save1
731
+ _tmp = match_string(".")
732
+ break if _tmp
733
+ self.pos = _save1
734
+ break
735
+ end # end choice
736
+
737
+ if _tmp
738
+ text = get_text(_text_start)
739
+ end
740
+ unless _tmp
741
+ self.pos = _save
742
+ break
743
+ end
744
+ @result = begin; text ; end
745
+ _tmp = true
746
+ unless _tmp
747
+ self.pos = _save
748
+ end
749
+ break
750
+ end # end sequence
751
+
752
+ return _tmp
753
+ end
754
+
755
+ # internal_class_module_chain = (< local_internal_identifier:parent id_separator:sep internal_class_module_chain:child > { SymbolEntry.new(parent.type, text, [parent, child, sep]) } | local_identifier)
756
+ def _internal_class_module_chain
757
+
758
+ _save = self.pos
759
+ while true # choice
760
+
761
+ _save1 = self.pos
762
+ while true # sequence
763
+ _text_start = self.pos
764
+
765
+ _save2 = self.pos
766
+ while true # sequence
767
+ _tmp = apply(:_local_internal_identifier)
768
+ parent = @result
769
+ unless _tmp
770
+ self.pos = _save2
771
+ break
772
+ end
773
+ _tmp = apply(:_id_separator)
774
+ sep = @result
775
+ unless _tmp
776
+ self.pos = _save2
777
+ break
778
+ end
779
+ _tmp = apply(:_internal_class_module_chain)
780
+ child = @result
781
+ unless _tmp
782
+ self.pos = _save2
783
+ end
784
+ break
785
+ end # end sequence
786
+
787
+ if _tmp
788
+ text = get_text(_text_start)
789
+ end
790
+ unless _tmp
791
+ self.pos = _save1
792
+ break
793
+ end
794
+ @result = begin;
795
+ SymbolEntry.new(parent.type, text, [parent, child, sep])
796
+ ; end
797
+ _tmp = true
798
+ unless _tmp
799
+ self.pos = _save1
800
+ end
801
+ break
802
+ end # end sequence
803
+
804
+ break if _tmp
805
+ self.pos = _save
806
+ _tmp = apply(:_local_identifier)
807
+ break if _tmp
808
+ self.pos = _save
809
+ break
810
+ end # end choice
811
+
812
+ return _tmp
813
+ end
814
+
815
+ # class_module_chain = (< identifier:parent id_separator:sep internal_class_module_chain:child > { SymbolEntry.new(parent.type, text, [parent, child, sep]) } | identifier)
816
+ def _class_module_chain
817
+
818
+ _save = self.pos
819
+ while true # choice
820
+
821
+ _save1 = self.pos
822
+ while true # sequence
823
+ _text_start = self.pos
824
+
825
+ _save2 = self.pos
826
+ while true # sequence
827
+ _tmp = apply(:_identifier)
828
+ parent = @result
829
+ unless _tmp
830
+ self.pos = _save2
831
+ break
832
+ end
833
+ _tmp = apply(:_id_separator)
834
+ sep = @result
835
+ unless _tmp
836
+ self.pos = _save2
837
+ break
838
+ end
839
+ _tmp = apply(:_internal_class_module_chain)
840
+ child = @result
841
+ unless _tmp
842
+ self.pos = _save2
843
+ end
844
+ break
845
+ end # end sequence
846
+
847
+ if _tmp
848
+ text = get_text(_text_start)
849
+ end
850
+ unless _tmp
851
+ self.pos = _save1
852
+ break
853
+ end
854
+ @result = begin;
855
+ SymbolEntry.new(parent.type, text, [parent, child, sep])
856
+ ; end
857
+ _tmp = true
858
+ unless _tmp
859
+ self.pos = _save1
860
+ end
861
+ break
862
+ end # end sequence
863
+
864
+ break if _tmp
865
+ self.pos = _save
866
+ _tmp = apply(:_identifier)
867
+ break if _tmp
868
+ self.pos = _save
869
+ break
870
+ end # end choice
871
+
872
+ return _tmp
873
+ end
874
+
875
+ # sp = /[ \t]/
876
+ def _sp
877
+ _tmp = scan(/\A(?-mix:[ \t])/)
878
+ return _tmp
879
+ end
880
+
881
+ # - = sp+
882
+ def __hyphen_
883
+ _save = self.pos
884
+ _tmp = apply(:_sp)
885
+ if _tmp
886
+ while true
887
+ _tmp = apply(:_sp)
888
+ break unless _tmp
889
+ end
890
+ _tmp = true
891
+ else
892
+ self.pos = _save
893
+ end
894
+ return _tmp
895
+ end
896
+
897
+ # dbl_escapes = ("\\\"" { '"' } | "\\n" { "\n" } | "\\t" { "\t" } | "\\\\" { "\\" })
898
+ def _dbl_escapes
899
+
900
+ _save = self.pos
901
+ while true # choice
902
+
903
+ _save1 = self.pos
904
+ while true # sequence
905
+ _tmp = match_string("\\\"")
906
+ unless _tmp
907
+ self.pos = _save1
908
+ break
909
+ end
910
+ @result = begin; '"' ; end
911
+ _tmp = true
912
+ unless _tmp
913
+ self.pos = _save1
914
+ end
915
+ break
916
+ end # end sequence
917
+
918
+ break if _tmp
919
+ self.pos = _save
920
+
921
+ _save2 = self.pos
922
+ while true # sequence
923
+ _tmp = match_string("\\n")
924
+ unless _tmp
925
+ self.pos = _save2
926
+ break
927
+ end
928
+ @result = begin; "\n" ; end
929
+ _tmp = true
930
+ unless _tmp
931
+ self.pos = _save2
932
+ end
933
+ break
934
+ end # end sequence
935
+
936
+ break if _tmp
937
+ self.pos = _save
938
+
939
+ _save3 = self.pos
940
+ while true # sequence
941
+ _tmp = match_string("\\t")
942
+ unless _tmp
943
+ self.pos = _save3
944
+ break
945
+ end
946
+ @result = begin; "\t" ; end
947
+ _tmp = true
948
+ unless _tmp
949
+ self.pos = _save3
950
+ end
951
+ break
952
+ end # end sequence
953
+
954
+ break if _tmp
955
+ self.pos = _save
956
+
957
+ _save4 = self.pos
958
+ while true # sequence
959
+ _tmp = match_string("\\\\")
960
+ unless _tmp
961
+ self.pos = _save4
962
+ break
963
+ end
964
+ @result = begin; "\\" ; end
965
+ _tmp = true
966
+ unless _tmp
967
+ self.pos = _save4
968
+ end
969
+ break
970
+ end # end sequence
971
+
972
+ break if _tmp
973
+ self.pos = _save
974
+ break
975
+ end # end choice
976
+
977
+ return _tmp
978
+ end
979
+
980
+ # escapes = ("\\\"" { '"' } | "\\n" { "\n" } | "\\t" { "\t" } | "\\ " { " " } | "\\:" { ":" } | "\\\\" { "\\" })
981
+ def _escapes
982
+
983
+ _save = self.pos
984
+ while true # choice
985
+
986
+ _save1 = self.pos
987
+ while true # sequence
988
+ _tmp = match_string("\\\"")
989
+ unless _tmp
990
+ self.pos = _save1
991
+ break
992
+ end
993
+ @result = begin; '"' ; end
994
+ _tmp = true
995
+ unless _tmp
996
+ self.pos = _save1
997
+ end
998
+ break
999
+ end # end sequence
1000
+
1001
+ break if _tmp
1002
+ self.pos = _save
1003
+
1004
+ _save2 = self.pos
1005
+ while true # sequence
1006
+ _tmp = match_string("\\n")
1007
+ unless _tmp
1008
+ self.pos = _save2
1009
+ break
1010
+ end
1011
+ @result = begin; "\n" ; end
1012
+ _tmp = true
1013
+ unless _tmp
1014
+ self.pos = _save2
1015
+ end
1016
+ break
1017
+ end # end sequence
1018
+
1019
+ break if _tmp
1020
+ self.pos = _save
1021
+
1022
+ _save3 = self.pos
1023
+ while true # sequence
1024
+ _tmp = match_string("\\t")
1025
+ unless _tmp
1026
+ self.pos = _save3
1027
+ break
1028
+ end
1029
+ @result = begin; "\t" ; end
1030
+ _tmp = true
1031
+ unless _tmp
1032
+ self.pos = _save3
1033
+ end
1034
+ break
1035
+ end # end sequence
1036
+
1037
+ break if _tmp
1038
+ self.pos = _save
1039
+
1040
+ _save4 = self.pos
1041
+ while true # sequence
1042
+ _tmp = match_string("\\ ")
1043
+ unless _tmp
1044
+ self.pos = _save4
1045
+ break
1046
+ end
1047
+ @result = begin; " " ; end
1048
+ _tmp = true
1049
+ unless _tmp
1050
+ self.pos = _save4
1051
+ end
1052
+ break
1053
+ end # end sequence
1054
+
1055
+ break if _tmp
1056
+ self.pos = _save
1057
+
1058
+ _save5 = self.pos
1059
+ while true # sequence
1060
+ _tmp = match_string("\\:")
1061
+ unless _tmp
1062
+ self.pos = _save5
1063
+ break
1064
+ end
1065
+ @result = begin; ":" ; end
1066
+ _tmp = true
1067
+ unless _tmp
1068
+ self.pos = _save5
1069
+ end
1070
+ break
1071
+ end # end sequence
1072
+
1073
+ break if _tmp
1074
+ self.pos = _save
1075
+
1076
+ _save6 = self.pos
1077
+ while true # sequence
1078
+ _tmp = match_string("\\\\")
1079
+ unless _tmp
1080
+ self.pos = _save6
1081
+ break
1082
+ end
1083
+ @result = begin; "\\" ; end
1084
+ _tmp = true
1085
+ unless _tmp
1086
+ self.pos = _save6
1087
+ end
1088
+ break
1089
+ end # end sequence
1090
+
1091
+ break if _tmp
1092
+ self.pos = _save
1093
+ break
1094
+ end # end choice
1095
+
1096
+ return _tmp
1097
+ end
1098
+
1099
+ # dbl_seq = < /[^\\"]+/ > { text }
1100
+ def _dbl_seq
1101
+
1102
+ _save = self.pos
1103
+ while true # sequence
1104
+ _text_start = self.pos
1105
+ _tmp = scan(/\A(?-mix:[^\\"]+)/)
1106
+ if _tmp
1107
+ text = get_text(_text_start)
1108
+ end
1109
+ unless _tmp
1110
+ self.pos = _save
1111
+ break
1112
+ end
1113
+ @result = begin; text ; end
1114
+ _tmp = true
1115
+ unless _tmp
1116
+ self.pos = _save
1117
+ end
1118
+ break
1119
+ end # end sequence
1120
+
1121
+ return _tmp
1122
+ end
1123
+
1124
+ # dbl_not_quote = (dbl_escapes | dbl_seq)+:ary { ary }
1125
+ def _dbl_not_quote
1126
+
1127
+ _save = self.pos
1128
+ while true # sequence
1129
+ _save1 = self.pos
1130
+ _ary = []
1131
+
1132
+ _save2 = self.pos
1133
+ while true # choice
1134
+ _tmp = apply(:_dbl_escapes)
1135
+ break if _tmp
1136
+ self.pos = _save2
1137
+ _tmp = apply(:_dbl_seq)
1138
+ break if _tmp
1139
+ self.pos = _save2
1140
+ break
1141
+ end # end choice
1142
+
1143
+ if _tmp
1144
+ _ary << @result
1145
+ while true
1146
+
1147
+ _save3 = self.pos
1148
+ while true # choice
1149
+ _tmp = apply(:_dbl_escapes)
1150
+ break if _tmp
1151
+ self.pos = _save3
1152
+ _tmp = apply(:_dbl_seq)
1153
+ break if _tmp
1154
+ self.pos = _save3
1155
+ break
1156
+ end # end choice
1157
+
1158
+ _ary << @result if _tmp
1159
+ break unless _tmp
1160
+ end
1161
+ _tmp = true
1162
+ @result = _ary
1163
+ else
1164
+ self.pos = _save1
1165
+ end
1166
+ ary = @result
1167
+ unless _tmp
1168
+ self.pos = _save
1169
+ break
1170
+ end
1171
+ @result = begin; ary ; end
1172
+ _tmp = true
1173
+ unless _tmp
1174
+ self.pos = _save
1175
+ end
1176
+ break
1177
+ end # end sequence
1178
+
1179
+ return _tmp
1180
+ end
1181
+
1182
+ # dbl_string = "\"" dbl_not_quote:ary "\"" { ary.join }
1183
+ def _dbl_string
1184
+
1185
+ _save = self.pos
1186
+ while true # sequence
1187
+ _tmp = match_string("\"")
1188
+ unless _tmp
1189
+ self.pos = _save
1190
+ break
1191
+ end
1192
+ _tmp = apply(:_dbl_not_quote)
1193
+ ary = @result
1194
+ unless _tmp
1195
+ self.pos = _save
1196
+ break
1197
+ end
1198
+ _tmp = match_string("\"")
1199
+ unless _tmp
1200
+ self.pos = _save
1201
+ break
1202
+ end
1203
+ @result = begin; ary.join ; end
1204
+ _tmp = true
1205
+ unless _tmp
1206
+ self.pos = _save
1207
+ end
1208
+ break
1209
+ end # end sequence
1210
+
1211
+ return _tmp
1212
+ end
1213
+
1214
+ # not_space_colon = (escapes | < /[^ \t\n:]/ > { text })
1215
+ def _not_space_colon
1216
+
1217
+ _save = self.pos
1218
+ while true # choice
1219
+ _tmp = apply(:_escapes)
1220
+ break if _tmp
1221
+ self.pos = _save
1222
+
1223
+ _save1 = self.pos
1224
+ while true # sequence
1225
+ _text_start = self.pos
1226
+ _tmp = scan(/\A(?-mix:[^ \t\n:])/)
1227
+ if _tmp
1228
+ text = get_text(_text_start)
1229
+ end
1230
+ unless _tmp
1231
+ self.pos = _save1
1232
+ break
1233
+ end
1234
+ @result = begin; text ; end
1235
+ _tmp = true
1236
+ unless _tmp
1237
+ self.pos = _save1
1238
+ end
1239
+ break
1240
+ end # end sequence
1241
+
1242
+ break if _tmp
1243
+ self.pos = _save
1244
+ break
1245
+ end # end choice
1246
+
1247
+ return _tmp
1248
+ end
1249
+
1250
+ # not_space_colons = not_space_colon+:ary { ary.join }
1251
+ def _not_space_colons
1252
+
1253
+ _save = self.pos
1254
+ while true # sequence
1255
+ _save1 = self.pos
1256
+ _ary = []
1257
+ _tmp = apply(:_not_space_colon)
1258
+ if _tmp
1259
+ _ary << @result
1260
+ while true
1261
+ _tmp = apply(:_not_space_colon)
1262
+ _ary << @result if _tmp
1263
+ break unless _tmp
1264
+ end
1265
+ _tmp = true
1266
+ @result = _ary
1267
+ else
1268
+ self.pos = _save1
1269
+ end
1270
+ ary = @result
1271
+ unless _tmp
1272
+ self.pos = _save
1273
+ break
1274
+ end
1275
+ @result = begin; ary.join ; end
1276
+ _tmp = true
1277
+ unless _tmp
1278
+ self.pos = _save
1279
+ end
1280
+ break
1281
+ end # end sequence
1282
+
1283
+ return _tmp
1284
+ end
1285
+
1286
+ # filename = (dbl_string | not_space_colons)
1287
+ def _filename
1288
+
1289
+ _save = self.pos
1290
+ while true # choice
1291
+ _tmp = apply(:_dbl_string)
1292
+ break if _tmp
1293
+ self.pos = _save
1294
+ _tmp = apply(:_not_space_colons)
1295
+ break if _tmp
1296
+ self.pos = _save
1297
+ break
1298
+ end # end choice
1299
+
1300
+ return _tmp
1301
+ end
1302
+
1303
+ # file_pos_sep = (sp+ | ":")
1304
+ def _file_pos_sep
1305
+
1306
+ _save = self.pos
1307
+ while true # choice
1308
+ _save1 = self.pos
1309
+ _tmp = apply(:_sp)
1310
+ if _tmp
1311
+ while true
1312
+ _tmp = apply(:_sp)
1313
+ break unless _tmp
1314
+ end
1315
+ _tmp = true
1316
+ else
1317
+ self.pos = _save1
1318
+ end
1319
+ break if _tmp
1320
+ self.pos = _save
1321
+ _tmp = match_string(":")
1322
+ break if _tmp
1323
+ self.pos = _save
1324
+ break
1325
+ end # end choice
1326
+
1327
+ return _tmp
1328
+ end
1329
+
1330
+ # integer = < /[0-9]+/ > { text.to_i }
1331
+ def _integer
1332
+
1333
+ _save = self.pos
1334
+ while true # sequence
1335
+ _text_start = self.pos
1336
+ _tmp = scan(/\A(?-mix:[0-9]+)/)
1337
+ if _tmp
1338
+ text = get_text(_text_start)
1339
+ end
1340
+ unless _tmp
1341
+ self.pos = _save
1342
+ break
1343
+ end
1344
+ @result = begin; text.to_i ; end
1345
+ _tmp = true
1346
+ unless _tmp
1347
+ self.pos = _save
1348
+ end
1349
+ break
1350
+ end # end sequence
1351
+
1352
+ return _tmp
1353
+ end
1354
+
1355
+ # line_number = integer
1356
+ def _line_number
1357
+ _tmp = apply(:_integer)
1358
+ return _tmp
1359
+ end
1360
+
1361
+ # vm_offset = "@" integer:int { Position.new(nil, nil, :offset, int) }
1362
+ def _vm_offset
1363
+
1364
+ _save = self.pos
1365
+ while true # sequence
1366
+ _tmp = match_string("@")
1367
+ unless _tmp
1368
+ self.pos = _save
1369
+ break
1370
+ end
1371
+ _tmp = apply(:_integer)
1372
+ int = @result
1373
+ unless _tmp
1374
+ self.pos = _save
1375
+ break
1376
+ end
1377
+ @result = begin;
1378
+ Position.new(nil, nil, :offset, int)
1379
+ ; end
1380
+ _tmp = true
1381
+ unless _tmp
1382
+ self.pos = _save
1383
+ end
1384
+ break
1385
+ end # end sequence
1386
+
1387
+ return _tmp
1388
+ end
1389
+
1390
+ # position = (vm_offset | line_number:l { Position.new(nil, nil, :line, l) })
1391
+ def _position
1392
+
1393
+ _save = self.pos
1394
+ while true # choice
1395
+ _tmp = apply(:_vm_offset)
1396
+ break if _tmp
1397
+ self.pos = _save
1398
+
1399
+ _save1 = self.pos
1400
+ while true # sequence
1401
+ _tmp = apply(:_line_number)
1402
+ l = @result
1403
+ unless _tmp
1404
+ self.pos = _save1
1405
+ break
1406
+ end
1407
+ @result = begin;
1408
+ Position.new(nil, nil, :line, l)
1409
+ ; end
1410
+ _tmp = true
1411
+ unless _tmp
1412
+ self.pos = _save1
1413
+ end
1414
+ break
1415
+ end # end sequence
1416
+
1417
+ break if _tmp
1418
+ self.pos = _save
1419
+ break
1420
+ end # end choice
1421
+
1422
+ return _tmp
1423
+ end
1424
+
1425
+ # file_colon_line = file_no_colon:file &{ File.exist?(file) } ":" position:pos { Position.new(:file, file, pos.position_type, pos.position) }
1426
+ def _file_colon_line
1427
+
1428
+ _save = self.pos
1429
+ while true # sequence
1430
+ _tmp = apply(:_file_no_colon)
1431
+ file = @result
1432
+ unless _tmp
1433
+ self.pos = _save
1434
+ break
1435
+ end
1436
+ _save1 = self.pos
1437
+ _tmp = begin; File.exist?(file) ; end
1438
+ self.pos = _save1
1439
+ unless _tmp
1440
+ self.pos = _save
1441
+ break
1442
+ end
1443
+ _tmp = match_string(":")
1444
+ unless _tmp
1445
+ self.pos = _save
1446
+ break
1447
+ end
1448
+ _tmp = apply(:_position)
1449
+ pos = @result
1450
+ unless _tmp
1451
+ self.pos = _save
1452
+ break
1453
+ end
1454
+ @result = begin;
1455
+ Position.new(:file, file, pos.position_type, pos.position)
1456
+ ; end
1457
+ _tmp = true
1458
+ unless _tmp
1459
+ self.pos = _save
1460
+ end
1461
+ break
1462
+ end # end sequence
1463
+
1464
+ return _tmp
1465
+ end
1466
+
1467
+ # location = (position | < filename >:file &{ File.exist?(file) } file_pos_sep position:pos { Position.new(:file, file, pos.position_type, pos.position) } | < filename >:file &{ File.exist?(file) } { Position.new(:file, file, nil, nil) } | class_module_chain?:fn file_pos_sep position:pos { Position.new(:fn, fn, pos.position_type, pos.position) } | class_module_chain?:fn { Position.new(:fn, fn, nil, nil) })
1468
+ def _location
1469
+
1470
+ _save = self.pos
1471
+ while true # choice
1472
+ _tmp = apply(:_position)
1473
+ break if _tmp
1474
+ self.pos = _save
1475
+
1476
+ _save1 = self.pos
1477
+ while true # sequence
1478
+ _text_start = self.pos
1479
+ _tmp = apply(:_filename)
1480
+ if _tmp
1481
+ text = get_text(_text_start)
1482
+ end
1483
+ file = @result
1484
+ unless _tmp
1485
+ self.pos = _save1
1486
+ break
1487
+ end
1488
+ _save2 = self.pos
1489
+ _tmp = begin; File.exist?(file) ; end
1490
+ self.pos = _save2
1491
+ unless _tmp
1492
+ self.pos = _save1
1493
+ break
1494
+ end
1495
+ _tmp = apply(:_file_pos_sep)
1496
+ unless _tmp
1497
+ self.pos = _save1
1498
+ break
1499
+ end
1500
+ _tmp = apply(:_position)
1501
+ pos = @result
1502
+ unless _tmp
1503
+ self.pos = _save1
1504
+ break
1505
+ end
1506
+ @result = begin;
1507
+ Position.new(:file, file, pos.position_type, pos.position)
1508
+ ; end
1509
+ _tmp = true
1510
+ unless _tmp
1511
+ self.pos = _save1
1512
+ end
1513
+ break
1514
+ end # end sequence
1515
+
1516
+ break if _tmp
1517
+ self.pos = _save
1518
+
1519
+ _save3 = self.pos
1520
+ while true # sequence
1521
+ _text_start = self.pos
1522
+ _tmp = apply(:_filename)
1523
+ if _tmp
1524
+ text = get_text(_text_start)
1525
+ end
1526
+ file = @result
1527
+ unless _tmp
1528
+ self.pos = _save3
1529
+ break
1530
+ end
1531
+ _save4 = self.pos
1532
+ _tmp = begin; File.exist?(file) ; end
1533
+ self.pos = _save4
1534
+ unless _tmp
1535
+ self.pos = _save3
1536
+ break
1537
+ end
1538
+ @result = begin;
1539
+ Position.new(:file, file, nil, nil)
1540
+ ; end
1541
+ _tmp = true
1542
+ unless _tmp
1543
+ self.pos = _save3
1544
+ end
1545
+ break
1546
+ end # end sequence
1547
+
1548
+ break if _tmp
1549
+ self.pos = _save
1550
+
1551
+ _save5 = self.pos
1552
+ while true # sequence
1553
+ _save6 = self.pos
1554
+ _tmp = apply(:_class_module_chain)
1555
+ @result = nil unless _tmp
1556
+ unless _tmp
1557
+ _tmp = true
1558
+ self.pos = _save6
1559
+ end
1560
+ fn = @result
1561
+ unless _tmp
1562
+ self.pos = _save5
1563
+ break
1564
+ end
1565
+ _tmp = apply(:_file_pos_sep)
1566
+ unless _tmp
1567
+ self.pos = _save5
1568
+ break
1569
+ end
1570
+ _tmp = apply(:_position)
1571
+ pos = @result
1572
+ unless _tmp
1573
+ self.pos = _save5
1574
+ break
1575
+ end
1576
+ @result = begin;
1577
+ Position.new(:fn, fn, pos.position_type, pos.position)
1578
+ ; end
1579
+ _tmp = true
1580
+ unless _tmp
1581
+ self.pos = _save5
1582
+ end
1583
+ break
1584
+ end # end sequence
1585
+
1586
+ break if _tmp
1587
+ self.pos = _save
1588
+
1589
+ _save7 = self.pos
1590
+ while true # sequence
1591
+ _save8 = self.pos
1592
+ _tmp = apply(:_class_module_chain)
1593
+ @result = nil unless _tmp
1594
+ unless _tmp
1595
+ _tmp = true
1596
+ self.pos = _save8
1597
+ end
1598
+ fn = @result
1599
+ unless _tmp
1600
+ self.pos = _save7
1601
+ break
1602
+ end
1603
+ @result = begin;
1604
+ Position.new(:fn, fn, nil, nil)
1605
+ ; end
1606
+ _tmp = true
1607
+ unless _tmp
1608
+ self.pos = _save7
1609
+ end
1610
+ break
1611
+ end # end sequence
1612
+
1613
+ break if _tmp
1614
+ self.pos = _save
1615
+ break
1616
+ end # end choice
1617
+
1618
+ return _tmp
1619
+ end
1620
+
1621
+ # if_unless = < ("if" | "unless") > { text }
1622
+ def _if_unless
1623
+
1624
+ _save = self.pos
1625
+ while true # sequence
1626
+ _text_start = self.pos
1627
+
1628
+ _save1 = self.pos
1629
+ while true # choice
1630
+ _tmp = match_string("if")
1631
+ break if _tmp
1632
+ self.pos = _save1
1633
+ _tmp = match_string("unless")
1634
+ break if _tmp
1635
+ self.pos = _save1
1636
+ break
1637
+ end # end choice
1638
+
1639
+ if _tmp
1640
+ text = get_text(_text_start)
1641
+ end
1642
+ unless _tmp
1643
+ self.pos = _save
1644
+ break
1645
+ end
1646
+ @result = begin; text ; end
1647
+ _tmp = true
1648
+ unless _tmp
1649
+ self.pos = _save
1650
+ end
1651
+ break
1652
+ end # end sequence
1653
+
1654
+ return _tmp
1655
+ end
1656
+
1657
+ # condition = < /.+/ > { text}
1658
+ def _condition
1659
+
1660
+ _save = self.pos
1661
+ while true # sequence
1662
+ _text_start = self.pos
1663
+ _tmp = scan(/\A(?-mix:.+)/)
1664
+ if _tmp
1665
+ text = get_text(_text_start)
1666
+ end
1667
+ unless _tmp
1668
+ self.pos = _save
1669
+ break
1670
+ end
1671
+ @result = begin; text; end
1672
+ _tmp = true
1673
+ unless _tmp
1674
+ self.pos = _save
1675
+ end
1676
+ break
1677
+ end # end sequence
1678
+
1679
+ return _tmp
1680
+ end
1681
+
1682
+ # breakpoint_stmt_no_condition = location:loc { Breakpoint.new(loc, false, 'true') }
1683
+ def _breakpoint_stmt_no_condition
1684
+
1685
+ _save = self.pos
1686
+ while true # sequence
1687
+ _tmp = apply(:_location)
1688
+ loc = @result
1689
+ unless _tmp
1690
+ self.pos = _save
1691
+ break
1692
+ end
1693
+ @result = begin;
1694
+ Breakpoint.new(loc, false, 'true')
1695
+ ; end
1696
+ _tmp = true
1697
+ unless _tmp
1698
+ self.pos = _save
1699
+ end
1700
+ break
1701
+ end # end sequence
1702
+
1703
+ return _tmp
1704
+ end
1705
+
1706
+ # breakpoint_stmt = (location:loc - if_unless:iu - condition:cond { Breakpoint.new(loc, iu == 'unless', cond) } | breakpoint_stmt_no_condition)
1707
+ def _breakpoint_stmt
1708
+
1709
+ _save = self.pos
1710
+ while true # choice
1711
+
1712
+ _save1 = self.pos
1713
+ while true # sequence
1714
+ _tmp = apply(:_location)
1715
+ loc = @result
1716
+ unless _tmp
1717
+ self.pos = _save1
1718
+ break
1719
+ end
1720
+ _tmp = apply(:__hyphen_)
1721
+ unless _tmp
1722
+ self.pos = _save1
1723
+ break
1724
+ end
1725
+ _tmp = apply(:_if_unless)
1726
+ iu = @result
1727
+ unless _tmp
1728
+ self.pos = _save1
1729
+ break
1730
+ end
1731
+ _tmp = apply(:__hyphen_)
1732
+ unless _tmp
1733
+ self.pos = _save1
1734
+ break
1735
+ end
1736
+ _tmp = apply(:_condition)
1737
+ cond = @result
1738
+ unless _tmp
1739
+ self.pos = _save1
1740
+ break
1741
+ end
1742
+ @result = begin;
1743
+ Breakpoint.new(loc, iu == 'unless', cond)
1744
+ ; end
1745
+ _tmp = true
1746
+ unless _tmp
1747
+ self.pos = _save1
1748
+ end
1749
+ break
1750
+ end # end sequence
1751
+
1752
+ break if _tmp
1753
+ self.pos = _save
1754
+ _tmp = apply(:_breakpoint_stmt_no_condition)
1755
+ break if _tmp
1756
+ self.pos = _save
1757
+ break
1758
+ end # end choice
1759
+
1760
+ return _tmp
1761
+ end
1762
+
1763
+ # list_special_targets = < "." "-" > { text }
1764
+ def _list_special_targets
1765
+
1766
+ _save = self.pos
1767
+ while true # sequence
1768
+ _text_start = self.pos
1769
+
1770
+ _save1 = self.pos
1771
+ while true # sequence
1772
+ _tmp = match_string(".")
1773
+ unless _tmp
1774
+ self.pos = _save1
1775
+ break
1776
+ end
1777
+ _tmp = match_string("-")
1778
+ unless _tmp
1779
+ self.pos = _save1
1780
+ end
1781
+ break
1782
+ end # end sequence
1783
+
1784
+ if _tmp
1785
+ text = get_text(_text_start)
1786
+ end
1787
+ unless _tmp
1788
+ self.pos = _save
1789
+ break
1790
+ end
1791
+ @result = begin; text ; end
1792
+ _tmp = true
1793
+ unless _tmp
1794
+ self.pos = _save
1795
+ end
1796
+ break
1797
+ end # end sequence
1798
+
1799
+ return _tmp
1800
+ end
1801
+
1802
+ # list_stmt = (list_special_target | location):loc - integer:int? { List.new(loc, int) }
1803
+ def _list_stmt
1804
+
1805
+ _save = self.pos
1806
+ while true # sequence
1807
+
1808
+ _save1 = self.pos
1809
+ while true # choice
1810
+ _tmp = apply(:_list_special_target)
1811
+ break if _tmp
1812
+ self.pos = _save1
1813
+ _tmp = apply(:_location)
1814
+ break if _tmp
1815
+ self.pos = _save1
1816
+ break
1817
+ end # end choice
1818
+
1819
+ loc = @result
1820
+ unless _tmp
1821
+ self.pos = _save
1822
+ break
1823
+ end
1824
+ _tmp = apply(:__hyphen_)
1825
+ unless _tmp
1826
+ self.pos = _save
1827
+ break
1828
+ end
1829
+ _save2 = self.pos
1830
+ _tmp = apply(:_integer)
1831
+ int = @result
1832
+ unless _tmp
1833
+ _tmp = true
1834
+ self.pos = _save2
1835
+ end
1836
+ unless _tmp
1837
+ self.pos = _save
1838
+ break
1839
+ end
1840
+ @result = begin;
1841
+ List.new(loc, int)
1842
+ ; end
1843
+ _tmp = true
1844
+ unless _tmp
1845
+ self.pos = _save
1846
+ end
1847
+ break
1848
+ end # end sequence
1849
+
1850
+ return _tmp
1851
+ end
1852
+ end
1853
+ if __FILE__ == $0
1854
+ # require 'rubygems'; require_relative '../lib/trepanning';
1855
+
1856
+ cp = CmdParse.new('', true)
1857
+ %w(A::B @@classvar abc01! @ivar @ivar.meth
1858
+ Object A::B::C A::B::C::D A::B.c A.b.c.d).each do |name|
1859
+ cp.setup_parser(name, true)
1860
+ # debugger if name == '@ivar.meth'
1861
+ res = cp._class_module_chain
1862
+ p res
1863
+ p cp.string
1864
+ p cp.result
1865
+ end
1866
+ %w(A::B:5 A::B:@5 @@classvar abc01!:10 @ivar).each do |name|
1867
+ cp.setup_parser(name, true)
1868
+ res = cp._location
1869
+ p res
1870
+ p cp.string
1871
+ p cp.result
1872
+ end
1873
+ # require 'trepanning';
1874
+ ["#{__FILE__}:10", 'A::B 5',
1875
+ "#{__FILE__} 20"].each do |name|
1876
+ cp.setup_parser(name, true)
1877
+ res = cp._location
1878
+ p res
1879
+ p cp.string
1880
+ p cp.result
1881
+ end
1882
+
1883
+ ['filename', '"this is a filename"',
1884
+ 'this\ is\ another\ filename',
1885
+ 'C\:filename'
1886
+ ].each do |name|
1887
+ puts '-' * 10
1888
+ cp.setup_parser(name, true)
1889
+ res = cp._filename
1890
+ p res
1891
+ puts cp.string
1892
+ puts cp.result
1893
+ end
1894
+ end