rbx-trepanning 0.2.0-universal-rubinius-2.0 → 0.2.1-universal-rubinius-2.0

Sign up to get free protection for your applications and to get access to all the features.
data/app/cmd_parse.rb CHANGED
@@ -1,11 +1,16 @@
1
1
  # use_grammar.rb
2
2
  require 'rubygems'
3
+ require 'redcard/rubinius'
3
4
  require 'require_relative'
4
5
  require_relative 'cmd_parser'
5
6
 
6
7
  class Trepan
7
8
  module CmdParser
8
9
 
10
+ def name_fix(name)
11
+ RedCard.check('1.9') ? name.to_sym : name
12
+ end
13
+
9
14
  # Given a KPeg parse object, return the method of that parse or raise a
10
15
  # Name error if we can't find a method. parent_class is the parent class of
11
16
  # the object we've found so far and "binding" is used if we need
@@ -27,24 +32,24 @@ class Trepan
27
32
  raise NameError, errmsg unless
28
33
  klass.kind_of?(Class) or klass.kind_of?(Module)
29
34
  m = m.chain[1]
30
- if klass.instance_methods.member?('binding')
35
+ if klass.instance_methods.member?(name_fix('binding'))
31
36
  bind = klass.bind
32
- elsif klass.private_instance_methods.member?('binding')
37
+ elsif klass.private_instance_methods.member?(name_fix('binding'))
33
38
  bind = klass.send(:binding)
34
39
  else
35
40
  bind = nil
36
41
  end
37
42
  resolve_method(m, bind, klass)
38
- rescue NameError
43
+ rescue NameError
39
44
  errmsg ||= "Can't resolve constant #{name}"
40
45
  raise NameError, errmsg
41
46
  end
42
47
  else
43
- is_class =
48
+ is_class =
44
49
  begin
45
- m.chain && m.chain[0] &&
46
- Class == eval("#{m.chain[0].name}.class", bind)
47
- rescue
50
+ m.chain && m.chain[0] &&
51
+ Class == eval("#{m.chain[0].name}.class", bind)
52
+ rescue
48
53
  false
49
54
  end
50
55
  if is_class
@@ -62,15 +67,15 @@ class Trepan
62
67
  parent_obj = eval("#{m.chain[0].name}", bind) if !parent_class && bind
63
68
  end
64
69
  parent = parent_class || parent_obj
65
- meth =
70
+ meth =
66
71
  if parent
67
72
  errmsg << "in #{parent}"
68
73
  lookup_name = m.chain && m.chain[1] ? m.chain[1].name : name
69
- if parent.respond_to?('instance_methods') &&
70
- parent.instance_methods.member?(lookup_name)
71
- parent.instance_method(lookup_name)
74
+ if parent.respond_to?('instance_methods') &&
75
+ parent.instance_methods.member?(name_fix(lookup_name))
76
+ parent.instance_method(name_fix(lookup_name))
72
77
  elsif parent.respond_to?('methods')
73
- parent.method(lookup_name)
78
+ parent.method(name_fix(lookup_name))
74
79
  end
75
80
  elsif m.chain && m.chain[1]
76
81
  eval("#{m.chain[0].name}.method(#{lookup_name.name.inspect})", bind)
@@ -95,16 +100,17 @@ class Trepan
95
100
  # nil is returned if we can't parse str
96
101
  def meth_for_string(str, start_binding)
97
102
  @cp ? @cp.setup_parser(str) : @cp = CmdParse.new(str)
98
- begin
103
+ begin
99
104
  if @cp._class_module_chain
100
105
  # Did we match all of it?
101
106
  if @cp.result.name == str.strip
107
+ # require 'trepanning'; debugger
102
108
  meth_for_parse_struct(@cp.result, start_binding)
103
109
  else
104
110
  nil
105
111
  end
106
112
  else
107
- # FIXME: change to raise ParseError?
113
+ # FIXME: change to raise ParseError?
108
114
  nil
109
115
  end
110
116
  rescue NameError
@@ -149,7 +155,7 @@ if __FILE__ == $0
149
155
  puts "#{name} failed"
150
156
  end
151
157
  end
152
-
158
+
153
159
  %w(Object A::B A::B::C A::B::C::D A::B.c A.b.c.d A(5)
154
160
  Rubinius::VariableScope::method_visibility
155
161
  ).each do |name|
@@ -177,14 +183,14 @@ if __FILE__ == $0
177
183
  def testing; 5 end
178
184
  module_function :testing
179
185
  end
180
- p meth_for_string('Testing.testing', binding)
181
- p meth_for_string('File.basename', binding)
186
+ p meth_for_string('Testing.testing', binding)
187
+ p meth_for_string('File.basename', binding)
182
188
  x = File
183
189
  # require_relative '../lib/trepanning'
184
190
  # debugger
185
- p meth_for_string('x.basename', binding)
191
+ p meth_for_string('x.basename', binding)
186
192
  def x.five; 5; end
187
- p meth_for_string('x.five', binding)
193
+ p meth_for_string('x.five', binding)
188
194
  p x.five
189
195
 
190
196
  p parse_terminal(:_line_number, '5').result
@@ -206,4 +212,3 @@ if __FILE__ == $0
206
212
 
207
213
 
208
214
  end
209
-
data/app/cmd_parser.rb CHANGED
@@ -1,5 +1,17 @@
1
1
  class CmdParse
2
- # STANDALONE START
2
+ # :stopdoc:
3
+
4
+ # This is distinct from setup_parser so that a standalone parser
5
+ # can redefine #initialize and still have access to the proper
6
+ # parser setup code.
7
+ def initialize(str, debug=false)
8
+ setup_parser(str, debug)
9
+ end
10
+
11
+
12
+
13
+ # Prepares for parsing +str+. If you define a custom initialize you must
14
+ # call this method before #parse
3
15
  def setup_parser(str, debug=false)
4
16
  @string = str
5
17
  @pos = 0
@@ -7,21 +19,15 @@ class CmdParse
7
19
  @result = nil
8
20
  @failed_rule = nil
9
21
  @failing_rule_offset = -1
10
- end
11
22
 
12
- # This is distinct from setup_parser so that a standalone parser
13
- # can redefine #initialize and still have access to the proper
14
- # parser setup code.
15
- #
16
- def initialize(str, debug=false)
17
- setup_parser(str, debug)
23
+ setup_foreign_grammar
18
24
  end
19
25
 
20
26
  attr_reader :string
21
- attr_reader :result, :failing_rule_offset
22
- attr_accessor :pos
27
+ attr_reader :failing_rule_offset
28
+ attr_accessor :result, :pos
23
29
 
24
- # STANDALONE START
30
+
25
31
  def current_column(target=pos)
26
32
  if c = string.rindex("\n", target-1)
27
33
  return target - c - 1
@@ -49,7 +55,7 @@ class CmdParse
49
55
  lines
50
56
  end
51
57
 
52
- #
58
+
53
59
 
54
60
  def get_text(start)
55
61
  @string[start..@pos-1]
@@ -67,9 +73,13 @@ class CmdParse
67
73
  def failure_info
68
74
  l = current_line @failing_rule_offset
69
75
  c = current_column @failing_rule_offset
70
- info = self.class::Rules[@failed_rule]
71
76
 
72
- "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
77
+ if @failed_rule.kind_of? Symbol
78
+ info = self.class::Rules[@failed_rule]
79
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
80
+ else
81
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
82
+ end
73
83
  end
74
84
 
75
85
  def failure_caret
@@ -90,10 +100,14 @@ class CmdParse
90
100
  l = current_line @failing_rule_offset
91
101
  c = current_column @failing_rule_offset
92
102
 
93
- info = self.class::Rules[@failed_rule]
94
103
  char = lines[l-1][c-1, 1]
95
104
 
96
- "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
105
+ if @failed_rule.kind_of? Symbol
106
+ info = self.class::Rules[@failed_rule]
107
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
108
+ else
109
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
110
+ end
97
111
  end
98
112
 
99
113
  class ParseError < RuntimeError
@@ -108,9 +122,15 @@ class CmdParse
108
122
  line_no = current_line(error_pos)
109
123
  col_no = current_column(error_pos)
110
124
 
111
- info = self.class::Rules[@failed_rule]
112
125
  io.puts "On line #{line_no}, column #{col_no}:"
113
- io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
126
+
127
+ if @failed_rule.kind_of? Symbol
128
+ info = self.class::Rules[@failed_rule]
129
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
130
+ else
131
+ io.puts "Failed to match rule '#{@failed_rule}'"
132
+ end
133
+
114
134
  io.puts "Got: #{string[error_pos,1].inspect}"
115
135
  line = lines[line_no-1]
116
136
  io.puts "=> #{line}"
@@ -169,47 +189,102 @@ class CmdParse
169
189
  end
170
190
  end
171
191
 
172
- def parse
173
- _root ? true : false
174
- end
192
+ def parse(rule=nil)
193
+ # We invoke the rules indirectly via apply
194
+ # instead of by just calling them as methods because
195
+ # if the rules use left recursion, apply needs to
196
+ # manage that.
175
197
 
176
- class LeftRecursive
177
- def initialize(detected=false)
178
- @detected = detected
198
+ if !rule
199
+ apply(:_root)
200
+ else
201
+ method = rule.gsub("-","_hyphen_")
202
+ apply :"_#{method}"
179
203
  end
180
-
181
- attr_accessor :detected
182
204
  end
183
205
 
184
206
  class MemoEntry
185
207
  def initialize(ans, pos)
186
208
  @ans = ans
187
209
  @pos = pos
188
- @uses = 1
189
210
  @result = nil
211
+ @set = false
212
+ @left_rec = false
190
213
  end
191
214
 
192
- attr_reader :ans, :pos, :uses, :result
193
-
194
- def inc!
195
- @uses += 1
196
- end
215
+ attr_reader :ans, :pos, :result, :set
216
+ attr_accessor :left_rec
197
217
 
198
218
  def move!(ans, pos, result)
199
219
  @ans = ans
200
220
  @pos = pos
201
221
  @result = result
222
+ @set = true
223
+ @left_rec = false
224
+ end
225
+ end
226
+
227
+ def external_invoke(other, rule, *args)
228
+ old_pos = @pos
229
+ old_string = @string
230
+
231
+ @pos = other.pos
232
+ @string = other.string
233
+
234
+ begin
235
+ if val = __send__(rule, *args)
236
+ other.pos = @pos
237
+ other.result = @result
238
+ else
239
+ other.set_failed_rule "#{self.class}##{rule}"
240
+ end
241
+ val
242
+ ensure
243
+ @pos = old_pos
244
+ @string = old_string
245
+ end
246
+ end
247
+
248
+ def apply_with_args(rule, *args)
249
+ memo_key = [rule, args]
250
+ if m = @memoizations[memo_key][@pos]
251
+ @pos = m.pos
252
+ if !m.set
253
+ m.left_rec = true
254
+ return nil
255
+ end
256
+
257
+ @result = m.result
258
+
259
+ return m.ans
260
+ else
261
+ m = MemoEntry.new(nil, @pos)
262
+ @memoizations[memo_key][@pos] = m
263
+ start_pos = @pos
264
+
265
+ ans = __send__ rule, *args
266
+
267
+ lr = m.left_rec
268
+
269
+ m.move! ans, @pos, @result
270
+
271
+ # Don't bother trying to grow the left recursion
272
+ # if it's failing straight away (thus there is no seed)
273
+ if ans and lr
274
+ return grow_lr(rule, args, start_pos, m)
275
+ else
276
+ return ans
277
+ end
278
+
279
+ return ans
202
280
  end
203
281
  end
204
282
 
205
283
  def apply(rule)
206
284
  if m = @memoizations[rule][@pos]
207
- m.inc!
208
-
209
- prev = @pos
210
285
  @pos = m.pos
211
- if m.ans.kind_of? LeftRecursive
212
- m.ans.detected = true
286
+ if !m.set
287
+ m.left_rec = true
213
288
  return nil
214
289
  end
215
290
 
@@ -217,19 +292,20 @@ class CmdParse
217
292
 
218
293
  return m.ans
219
294
  else
220
- lr = LeftRecursive.new(false)
221
- m = MemoEntry.new(lr, @pos)
295
+ m = MemoEntry.new(nil, @pos)
222
296
  @memoizations[rule][@pos] = m
223
297
  start_pos = @pos
224
298
 
225
299
  ans = __send__ rule
226
300
 
301
+ lr = m.left_rec
302
+
227
303
  m.move! ans, @pos, @result
228
304
 
229
305
  # Don't bother trying to grow the left recursion
230
306
  # if it's failing straight away (thus there is no seed)
231
- if ans and lr.detected
232
- return grow_lr(rule, start_pos, m)
307
+ if ans and lr
308
+ return grow_lr(rule, nil, start_pos, m)
233
309
  else
234
310
  return ans
235
311
  end
@@ -238,12 +314,16 @@ class CmdParse
238
314
  end
239
315
  end
240
316
 
241
- def grow_lr(rule, start_pos, m)
317
+ def grow_lr(rule, args, start_pos, m)
242
318
  while true
243
319
  @pos = start_pos
244
320
  @result = m.result
245
321
 
246
- ans = __send__ rule
322
+ if args
323
+ ans = __send__ rule, *args
324
+ else
325
+ ans = __send__ rule
326
+ end
247
327
  return nil unless ans
248
328
 
249
329
  break if @pos <= m.pos
@@ -269,10 +349,11 @@ class CmdParse
269
349
  RuleInfo.new(name, rendered)
270
350
  end
271
351
 
272
- #
352
+
353
+ # :startdoc:
273
354
 
274
355
 
275
- #####################################################
356
+ #####################################################
276
357
  # Structure to hold composite method names
277
358
  SymbolEntry = Struct.new(:type, :name, :chain)
278
359
 
@@ -288,7 +369,7 @@ class CmdParse
288
369
  List = Struct.new(:position, :num)
289
370
 
290
371
  DEFAULT_OPTS = {
291
- :debug=>false,
372
+ :debug=>false,
292
373
  :file_exists_proc => Proc.new{|filename|
293
374
  File.readable?(filename) && !File.directory?(filename)
294
375
  }
@@ -302,6 +383,8 @@ class CmdParse
302
383
 
303
384
 
304
385
 
386
+ # :stopdoc:
387
+ def setup_foreign_grammar; end
305
388
 
306
389
  # upcase_letter = /[A-Z]/
307
390
  def _upcase_letter
@@ -370,17 +453,17 @@ class CmdParse
370
453
  return _tmp
371
454
  end
372
455
 
373
- # vm_identifier = < (downcase_letter | "_") id_symbol* suffix_letter? > { SymbolEntry.new(:variable, text) }
456
+ # vm_identifier = < (downcase_letter | "_") id_symbol* suffix_letter? > { SymbolEntry.new(:variable, text) }
374
457
  def _vm_identifier
375
458
 
376
459
  _save = self.pos
377
460
  while true # sequence
378
461
  _text_start = self.pos
379
-
380
- _save1 = self.pos
462
+
463
+ _save1 = self.pos
381
464
  while true # sequence
382
-
383
- _save2 = self.pos
465
+
466
+ _save2 = self.pos
384
467
  while true # choice
385
468
  _tmp = apply(:_downcase_letter)
386
469
  break if _tmp
@@ -423,7 +506,7 @@ class CmdParse
423
506
  self.pos = _save
424
507
  break
425
508
  end
426
- @result = begin;
509
+ @result = begin;
427
510
  SymbolEntry.new(:variable, text)
428
511
  ; end
429
512
  _tmp = true
@@ -437,17 +520,17 @@ class CmdParse
437
520
  return _tmp
438
521
  end
439
522
 
440
- # variable_identifier = < (downcase_letter | "_") id_symbol* > { SymbolEntry.new(:variable, text) }
523
+ # variable_identifier = < (downcase_letter | "_") id_symbol* > { SymbolEntry.new(:variable, text) }
441
524
  def _variable_identifier
442
525
 
443
526
  _save = self.pos
444
527
  while true # sequence
445
528
  _text_start = self.pos
446
-
447
- _save1 = self.pos
529
+
530
+ _save1 = self.pos
448
531
  while true # sequence
449
-
450
- _save2 = self.pos
532
+
533
+ _save2 = self.pos
451
534
  while true # choice
452
535
  _tmp = apply(:_downcase_letter)
453
536
  break if _tmp
@@ -480,7 +563,7 @@ class CmdParse
480
563
  self.pos = _save
481
564
  break
482
565
  end
483
- @result = begin;
566
+ @result = begin;
484
567
  SymbolEntry.new(:variable, text)
485
568
  ; end
486
569
  _tmp = true
@@ -494,14 +577,14 @@ class CmdParse
494
577
  return _tmp
495
578
  end
496
579
 
497
- # constant_identifier = < upcase_letter id_symbol* > { SymbolEntry.new(:constant, text) }
580
+ # constant_identifier = < upcase_letter id_symbol* > { SymbolEntry.new(:constant, text) }
498
581
  def _constant_identifier
499
582
 
500
583
  _save = self.pos
501
584
  while true # sequence
502
585
  _text_start = self.pos
503
-
504
- _save1 = self.pos
586
+
587
+ _save1 = self.pos
505
588
  while true # sequence
506
589
  _tmp = apply(:_upcase_letter)
507
590
  unless _tmp
@@ -526,7 +609,7 @@ class CmdParse
526
609
  self.pos = _save
527
610
  break
528
611
  end
529
- @result = begin;
612
+ @result = begin;
530
613
  SymbolEntry.new(:constant, text)
531
614
  ; end
532
615
  _tmp = true
@@ -546,16 +629,16 @@ class CmdParse
546
629
  _save = self.pos
547
630
  while true # sequence
548
631
  _text_start = self.pos
549
-
550
- _save1 = self.pos
632
+
633
+ _save1 = self.pos
551
634
  while true # sequence
552
635
  _tmp = match_string("$")
553
636
  unless _tmp
554
637
  self.pos = _save1
555
638
  break
556
639
  end
557
-
558
- _save2 = self.pos
640
+
641
+ _save2 = self.pos
559
642
  while true # choice
560
643
  _tmp = apply(:_constant_identifier)
561
644
  break if _tmp
@@ -579,7 +662,7 @@ class CmdParse
579
662
  self.pos = _save
580
663
  break
581
664
  end
582
- @result = begin;
665
+ @result = begin;
583
666
  SymbolEntry.new(:global, text)
584
667
  ; end
585
668
  _tmp = true
@@ -635,8 +718,8 @@ class CmdParse
635
718
  _save = self.pos
636
719
  while true # sequence
637
720
  _text_start = self.pos
638
-
639
- _save1 = self.pos
721
+
722
+ _save1 = self.pos
640
723
  while true # sequence
641
724
  _tmp = match_string("@")
642
725
  unless _tmp
@@ -657,7 +740,7 @@ class CmdParse
657
740
  self.pos = _save
658
741
  break
659
742
  end
660
- @result = begin;
743
+ @result = begin;
661
744
  SymbolEntry.new(:instance, text)
662
745
  ; end
663
746
  _tmp = true
@@ -687,7 +770,7 @@ class CmdParse
687
770
  self.pos = _save
688
771
  break
689
772
  end
690
- @result = begin;
773
+ @result = begin;
691
774
  SymbolEntry.new(:classvar, id)
692
775
  ; end
693
776
  _tmp = true
@@ -731,8 +814,8 @@ class CmdParse
731
814
  _save = self.pos
732
815
  while true # sequence
733
816
  _text_start = self.pos
734
-
735
- _save1 = self.pos
817
+
818
+ _save1 = self.pos
736
819
  while true # choice
737
820
  _tmp = match_string("::")
738
821
  break if _tmp
@@ -750,7 +833,7 @@ class CmdParse
750
833
  self.pos = _save
751
834
  break
752
835
  end
753
- @result = begin; text ; end
836
+ @result = begin; text ; end
754
837
  _tmp = true
755
838
  unless _tmp
756
839
  self.pos = _save
@@ -767,12 +850,12 @@ class CmdParse
767
850
 
768
851
  _save = self.pos
769
852
  while true # choice
770
-
771
- _save1 = self.pos
853
+
854
+ _save1 = self.pos
772
855
  while true # sequence
773
856
  _text_start = self.pos
774
-
775
- _save2 = self.pos
857
+
858
+ _save2 = self.pos
776
859
  while true # sequence
777
860
  _tmp = apply(:_local_internal_identifier)
778
861
  parent = @result
@@ -801,7 +884,7 @@ class CmdParse
801
884
  self.pos = _save1
802
885
  break
803
886
  end
804
- @result = begin;
887
+ @result = begin;
805
888
  SymbolEntry.new(parent.type, text, [parent, child, sep])
806
889
  ; end
807
890
  _tmp = true
@@ -828,12 +911,12 @@ class CmdParse
828
911
 
829
912
  _save = self.pos
830
913
  while true # choice
831
-
832
- _save1 = self.pos
914
+
915
+ _save1 = self.pos
833
916
  while true # sequence
834
917
  _text_start = self.pos
835
-
836
- _save2 = self.pos
918
+
919
+ _save2 = self.pos
837
920
  while true # sequence
838
921
  _tmp = apply(:_identifier)
839
922
  parent = @result
@@ -862,7 +945,7 @@ class CmdParse
862
945
  self.pos = _save1
863
946
  break
864
947
  end
865
- @result = begin;
948
+ @result = begin;
866
949
  SymbolEntry.new(parent.type, text, [parent, child, sep])
867
950
  ; end
868
951
  _tmp = true
@@ -910,83 +993,83 @@ class CmdParse
910
993
 
911
994
  # dbl_escapes = ("\\\"" { '"' } | "\\n" { "\n" } | "\\t" { "\t" } | "\\\\" { "\\" })
912
995
  def _dbl_escapes
913
-
996
+
914
997
  _save = self.pos
915
- while true # choice
916
-
917
- _save1 = self.pos
918
- while true # sequence
919
- _tmp = match_string("\\\"")
920
- unless _tmp
921
- self.pos = _save1
922
- break
923
- end
924
- @result = begin; '"' ; end
925
- _tmp = true
926
- unless _tmp
927
- self.pos = _save1
928
- end
929
- break
930
- end # end sequence
998
+ while true # choice
931
999
 
932
- break if _tmp
933
- self.pos = _save
934
-
935
- _save2 = self.pos
936
- while true # sequence
937
- _tmp = match_string("\\n")
938
- unless _tmp
939
- self.pos = _save2
940
- break
941
- end
942
- @result = begin; "\n" ; end
943
- _tmp = true
944
- unless _tmp
945
- self.pos = _save2
946
- end
1000
+ _save1 = self.pos
1001
+ while true # sequence
1002
+ _tmp = match_string("\\\"")
1003
+ unless _tmp
1004
+ self.pos = _save1
947
1005
  break
948
- end # end sequence
1006
+ end
1007
+ @result = begin; '"' ; end
1008
+ _tmp = true
1009
+ unless _tmp
1010
+ self.pos = _save1
1011
+ end
1012
+ break
1013
+ end # end sequence
949
1014
 
950
- break if _tmp
951
- self.pos = _save
952
-
953
- _save3 = self.pos
954
- while true # sequence
955
- _tmp = match_string("\\t")
956
- unless _tmp
957
- self.pos = _save3
958
- break
959
- end
960
- @result = begin; "\t" ; end
961
- _tmp = true
962
- unless _tmp
963
- self.pos = _save3
964
- end
1015
+ break if _tmp
1016
+ self.pos = _save
1017
+
1018
+ _save2 = self.pos
1019
+ while true # sequence
1020
+ _tmp = match_string("\\n")
1021
+ unless _tmp
1022
+ self.pos = _save2
965
1023
  break
966
- end # end sequence
1024
+ end
1025
+ @result = begin; "\n" ; end
1026
+ _tmp = true
1027
+ unless _tmp
1028
+ self.pos = _save2
1029
+ end
1030
+ break
1031
+ end # end sequence
967
1032
 
968
- break if _tmp
969
- self.pos = _save
970
-
971
- _save4 = self.pos
972
- while true # sequence
973
- _tmp = match_string("\\\\")
974
- unless _tmp
975
- self.pos = _save4
976
- break
977
- end
978
- @result = begin; "\\" ; end
979
- _tmp = true
980
- unless _tmp
981
- self.pos = _save4
982
- end
1033
+ break if _tmp
1034
+ self.pos = _save
1035
+
1036
+ _save3 = self.pos
1037
+ while true # sequence
1038
+ _tmp = match_string("\\t")
1039
+ unless _tmp
1040
+ self.pos = _save3
983
1041
  break
984
- end # end sequence
1042
+ end
1043
+ @result = begin; "\t" ; end
1044
+ _tmp = true
1045
+ unless _tmp
1046
+ self.pos = _save3
1047
+ end
1048
+ break
1049
+ end # end sequence
985
1050
 
986
- break if _tmp
987
- self.pos = _save
1051
+ break if _tmp
1052
+ self.pos = _save
1053
+
1054
+ _save4 = self.pos
1055
+ while true # sequence
1056
+ _tmp = match_string("\\\\")
1057
+ unless _tmp
1058
+ self.pos = _save4
1059
+ break
1060
+ end
1061
+ @result = begin; "\\" ; end
1062
+ _tmp = true
1063
+ unless _tmp
1064
+ self.pos = _save4
1065
+ end
988
1066
  break
989
- end # end choice
1067
+ end # end sequence
1068
+
1069
+ break if _tmp
1070
+ self.pos = _save
1071
+ break
1072
+ end # end choice
990
1073
 
991
1074
  set_failed_rule :_dbl_escapes unless _tmp
992
1075
  return _tmp
@@ -994,204 +1077,204 @@ class CmdParse
994
1077
 
995
1078
  # escapes = ("\\\"" { '"' } | "\\n" { "\n" } | "\\t" { "\t" } | "\\ " { " " } | "\\:" { ":" } | "\\\\" { "\\" })
996
1079
  def _escapes
997
-
1080
+
998
1081
  _save = self.pos
999
- while true # choice
1000
-
1001
- _save1 = self.pos
1002
- while true # sequence
1003
- _tmp = match_string("\\\"")
1004
- unless _tmp
1005
- self.pos = _save1
1006
- break
1007
- end
1008
- @result = begin; '"' ; end
1009
- _tmp = true
1010
- unless _tmp
1011
- self.pos = _save1
1012
- end
1013
- break
1014
- end # end sequence
1082
+ while true # choice
1015
1083
 
1016
- break if _tmp
1017
- self.pos = _save
1018
-
1019
- _save2 = self.pos
1020
- while true # sequence
1021
- _tmp = match_string("\\n")
1022
- unless _tmp
1023
- self.pos = _save2
1024
- break
1025
- end
1026
- @result = begin; "\n" ; end
1027
- _tmp = true
1028
- unless _tmp
1029
- self.pos = _save2
1030
- end
1084
+ _save1 = self.pos
1085
+ while true # sequence
1086
+ _tmp = match_string("\\\"")
1087
+ unless _tmp
1088
+ self.pos = _save1
1031
1089
  break
1032
- end # end sequence
1090
+ end
1091
+ @result = begin; '"' ; end
1092
+ _tmp = true
1093
+ unless _tmp
1094
+ self.pos = _save1
1095
+ end
1096
+ break
1097
+ end # end sequence
1033
1098
 
1034
- break if _tmp
1035
- self.pos = _save
1036
-
1037
- _save3 = self.pos
1038
- while true # sequence
1039
- _tmp = match_string("\\t")
1040
- unless _tmp
1041
- self.pos = _save3
1042
- break
1043
- end
1044
- @result = begin; "\t" ; end
1045
- _tmp = true
1046
- unless _tmp
1047
- self.pos = _save3
1048
- end
1049
- break
1050
- end # end sequence
1099
+ break if _tmp
1100
+ self.pos = _save
1051
1101
 
1052
- break if _tmp
1053
- self.pos = _save
1054
-
1055
- _save4 = self.pos
1056
- while true # sequence
1057
- _tmp = match_string("\\ ")
1058
- unless _tmp
1059
- self.pos = _save4
1060
- break
1061
- end
1062
- @result = begin; " " ; end
1063
- _tmp = true
1064
- unless _tmp
1065
- self.pos = _save4
1066
- end
1102
+ _save2 = self.pos
1103
+ while true # sequence
1104
+ _tmp = match_string("\\n")
1105
+ unless _tmp
1106
+ self.pos = _save2
1067
1107
  break
1068
- end # end sequence
1108
+ end
1109
+ @result = begin; "\n" ; end
1110
+ _tmp = true
1111
+ unless _tmp
1112
+ self.pos = _save2
1113
+ end
1114
+ break
1115
+ end # end sequence
1069
1116
 
1070
- break if _tmp
1071
- self.pos = _save
1072
-
1073
- _save5 = self.pos
1074
- while true # sequence
1075
- _tmp = match_string("\\:")
1076
- unless _tmp
1077
- self.pos = _save5
1078
- break
1079
- end
1080
- @result = begin; ":" ; end
1081
- _tmp = true
1082
- unless _tmp
1083
- self.pos = _save5
1084
- end
1085
- break
1086
- end # end sequence
1117
+ break if _tmp
1118
+ self.pos = _save
1087
1119
 
1088
- break if _tmp
1089
- self.pos = _save
1090
-
1091
- _save6 = self.pos
1092
- while true # sequence
1093
- _tmp = match_string("\\\\")
1094
- unless _tmp
1095
- self.pos = _save6
1096
- break
1097
- end
1098
- @result = begin; "\\" ; end
1099
- _tmp = true
1100
- unless _tmp
1101
- self.pos = _save6
1102
- end
1120
+ _save3 = self.pos
1121
+ while true # sequence
1122
+ _tmp = match_string("\\t")
1123
+ unless _tmp
1124
+ self.pos = _save3
1103
1125
  break
1104
- end # end sequence
1126
+ end
1127
+ @result = begin; "\t" ; end
1128
+ _tmp = true
1129
+ unless _tmp
1130
+ self.pos = _save3
1131
+ end
1132
+ break
1133
+ end # end sequence
1105
1134
 
1106
- break if _tmp
1107
- self.pos = _save
1135
+ break if _tmp
1136
+ self.pos = _save
1137
+
1138
+ _save4 = self.pos
1139
+ while true # sequence
1140
+ _tmp = match_string("\\ ")
1141
+ unless _tmp
1142
+ self.pos = _save4
1143
+ break
1144
+ end
1145
+ @result = begin; " " ; end
1146
+ _tmp = true
1147
+ unless _tmp
1148
+ self.pos = _save4
1149
+ end
1108
1150
  break
1109
- end # end choice
1151
+ end # end sequence
1110
1152
 
1111
- set_failed_rule :_escapes unless _tmp
1112
- return _tmp
1113
- end
1153
+ break if _tmp
1154
+ self.pos = _save
1114
1155
 
1115
- # dbl_seq = < /[^\\"]+/ > { text }
1116
- def _dbl_seq
1117
-
1118
- _save = self.pos
1156
+ _save5 = self.pos
1119
1157
  while true # sequence
1120
- _text_start = self.pos
1121
- _tmp = scan(/\A(?-mix:[^\\"]+)/)
1122
- if _tmp
1123
- text = get_text(_text_start)
1158
+ _tmp = match_string("\\:")
1159
+ unless _tmp
1160
+ self.pos = _save5
1161
+ break
1162
+ end
1163
+ @result = begin; ":" ; end
1164
+ _tmp = true
1165
+ unless _tmp
1166
+ self.pos = _save5
1124
1167
  end
1168
+ break
1169
+ end # end sequence
1170
+
1171
+ break if _tmp
1172
+ self.pos = _save
1173
+
1174
+ _save6 = self.pos
1175
+ while true # sequence
1176
+ _tmp = match_string("\\\\")
1125
1177
  unless _tmp
1126
- self.pos = _save
1178
+ self.pos = _save6
1127
1179
  break
1128
1180
  end
1129
- @result = begin; text ; end
1181
+ @result = begin; "\\" ; end
1130
1182
  _tmp = true
1131
1183
  unless _tmp
1132
- self.pos = _save
1184
+ self.pos = _save6
1133
1185
  end
1134
1186
  break
1135
1187
  end # end sequence
1136
1188
 
1189
+ break if _tmp
1190
+ self.pos = _save
1191
+ break
1192
+ end # end choice
1193
+
1194
+ set_failed_rule :_escapes unless _tmp
1195
+ return _tmp
1196
+ end
1197
+
1198
+ # dbl_seq = < /[^\\"]+/ > { text }
1199
+ def _dbl_seq
1200
+
1201
+ _save = self.pos
1202
+ while true # sequence
1203
+ _text_start = self.pos
1204
+ _tmp = scan(/\A(?-mix:[^\\"]+)/)
1205
+ if _tmp
1206
+ text = get_text(_text_start)
1207
+ end
1208
+ unless _tmp
1209
+ self.pos = _save
1210
+ break
1211
+ end
1212
+ @result = begin; text ; end
1213
+ _tmp = true
1214
+ unless _tmp
1215
+ self.pos = _save
1216
+ end
1217
+ break
1218
+ end # end sequence
1219
+
1137
1220
  set_failed_rule :_dbl_seq unless _tmp
1138
1221
  return _tmp
1139
1222
  end
1140
1223
 
1141
1224
  # dbl_not_quote = (dbl_escapes | dbl_seq)+:ary { ary }
1142
1225
  def _dbl_not_quote
1143
-
1226
+
1144
1227
  _save = self.pos
1145
- while true # sequence
1146
- _save1 = self.pos
1147
- _ary = []
1148
-
1149
- _save2 = self.pos
1150
- while true # choice
1151
- _tmp = apply(:_dbl_escapes)
1152
- break if _tmp
1153
- self.pos = _save2
1154
- _tmp = apply(:_dbl_seq)
1155
- break if _tmp
1156
- self.pos = _save2
1157
- break
1158
- end # end choice
1228
+ while true # sequence
1229
+ _save1 = self.pos
1230
+ _ary = []
1159
1231
 
1160
- if _tmp
1161
- _ary << @result
1162
- while true
1163
-
1164
- _save3 = self.pos
1165
- while true # choice
1166
- _tmp = apply(:_dbl_escapes)
1167
- break if _tmp
1168
- self.pos = _save3
1169
- _tmp = apply(:_dbl_seq)
1170
- break if _tmp
1171
- self.pos = _save3
1172
- break
1173
- end # end choice
1174
-
1175
- _ary << @result if _tmp
1176
- break unless _tmp
1177
- end
1178
- _tmp = true
1179
- @result = _ary
1180
- else
1181
- self.pos = _save1
1182
- end
1183
- ary = @result
1184
- unless _tmp
1185
- self.pos = _save
1232
+ _save2 = self.pos
1233
+ while true # choice
1234
+ _tmp = apply(:_dbl_escapes)
1235
+ break if _tmp
1236
+ self.pos = _save2
1237
+ _tmp = apply(:_dbl_seq)
1238
+ break if _tmp
1239
+ self.pos = _save2
1240
+ break
1241
+ end # end choice
1242
+
1243
+ if _tmp
1244
+ _ary << @result
1245
+ while true
1246
+
1247
+ _save3 = self.pos
1248
+ while true # choice
1249
+ _tmp = apply(:_dbl_escapes)
1250
+ break if _tmp
1251
+ self.pos = _save3
1252
+ _tmp = apply(:_dbl_seq)
1253
+ break if _tmp
1254
+ self.pos = _save3
1186
1255
  break
1187
- end
1188
- @result = begin; ary ; end
1189
- _tmp = true
1190
- unless _tmp
1191
- self.pos = _save
1192
- end
1193
- break
1194
- end # end sequence
1256
+ end # end choice
1257
+
1258
+ _ary << @result if _tmp
1259
+ break unless _tmp
1260
+ end
1261
+ _tmp = true
1262
+ @result = _ary
1263
+ else
1264
+ self.pos = _save1
1265
+ end
1266
+ ary = @result
1267
+ unless _tmp
1268
+ self.pos = _save
1269
+ break
1270
+ end
1271
+ @result = begin; ary ; end
1272
+ _tmp = true
1273
+ unless _tmp
1274
+ self.pos = _save
1275
+ end
1276
+ break
1277
+ end # end sequence
1195
1278
 
1196
1279
  set_failed_rule :_dbl_not_quote unless _tmp
1197
1280
  return _tmp
@@ -1199,32 +1282,32 @@ class CmdParse
1199
1282
 
1200
1283
  # dbl_string = "\"" dbl_not_quote:ary "\"" { ary.join }
1201
1284
  def _dbl_string
1202
-
1285
+
1203
1286
  _save = self.pos
1204
- while true # sequence
1205
- _tmp = match_string("\"")
1206
- unless _tmp
1207
- self.pos = _save
1208
- break
1209
- end
1210
- _tmp = apply(:_dbl_not_quote)
1211
- ary = @result
1212
- unless _tmp
1213
- self.pos = _save
1214
- break
1215
- end
1216
- _tmp = match_string("\"")
1217
- unless _tmp
1218
- self.pos = _save
1219
- break
1220
- end
1221
- @result = begin; ary.join ; end
1222
- _tmp = true
1223
- unless _tmp
1224
- self.pos = _save
1225
- end
1226
- break
1227
- end # end sequence
1287
+ while true # sequence
1288
+ _tmp = match_string("\"")
1289
+ unless _tmp
1290
+ self.pos = _save
1291
+ break
1292
+ end
1293
+ _tmp = apply(:_dbl_not_quote)
1294
+ ary = @result
1295
+ unless _tmp
1296
+ self.pos = _save
1297
+ break
1298
+ end
1299
+ _tmp = match_string("\"")
1300
+ unless _tmp
1301
+ self.pos = _save
1302
+ break
1303
+ end
1304
+ @result = begin; ary.join ; end
1305
+ _tmp = true
1306
+ unless _tmp
1307
+ self.pos = _save
1308
+ end
1309
+ break
1310
+ end # end sequence
1228
1311
 
1229
1312
  set_failed_rule :_dbl_string unless _tmp
1230
1313
  return _tmp
@@ -1232,36 +1315,36 @@ class CmdParse
1232
1315
 
1233
1316
  # not_space_colon = (escapes | < /[^ \t\n:]/ > { text })
1234
1317
  def _not_space_colon
1235
-
1318
+
1236
1319
  _save = self.pos
1237
- while true # choice
1238
- _tmp = apply(:_escapes)
1239
- break if _tmp
1240
- self.pos = _save
1241
-
1242
- _save1 = self.pos
1243
- while true # sequence
1244
- _text_start = self.pos
1245
- _tmp = scan(/\A(?-mix:[^ \t\n:])/)
1246
- if _tmp
1247
- text = get_text(_text_start)
1248
- end
1249
- unless _tmp
1250
- self.pos = _save1
1251
- break
1252
- end
1253
- @result = begin; text ; end
1254
- _tmp = true
1255
- unless _tmp
1256
- self.pos = _save1
1257
- end
1258
- break
1259
- end # end sequence
1320
+ while true # choice
1321
+ _tmp = apply(:_escapes)
1322
+ break if _tmp
1323
+ self.pos = _save
1260
1324
 
1261
- break if _tmp
1262
- self.pos = _save
1325
+ _save1 = self.pos
1326
+ while true # sequence
1327
+ _text_start = self.pos
1328
+ _tmp = scan(/\A(?-mix:[^ \t\n:])/)
1329
+ if _tmp
1330
+ text = get_text(_text_start)
1331
+ end
1332
+ unless _tmp
1333
+ self.pos = _save1
1263
1334
  break
1264
- end # end choice
1335
+ end
1336
+ @result = begin; text ; end
1337
+ _tmp = true
1338
+ unless _tmp
1339
+ self.pos = _save1
1340
+ end
1341
+ break
1342
+ end # end sequence
1343
+
1344
+ break if _tmp
1345
+ self.pos = _save
1346
+ break
1347
+ end # end choice
1265
1348
 
1266
1349
  set_failed_rule :_not_space_colon unless _tmp
1267
1350
  return _tmp
@@ -1269,36 +1352,36 @@ class CmdParse
1269
1352
 
1270
1353
  # not_space_colons = not_space_colon+:ary { ary.join }
1271
1354
  def _not_space_colons
1272
-
1355
+
1273
1356
  _save = self.pos
1274
- while true # sequence
1275
- _save1 = self.pos
1276
- _ary = []
1357
+ while true # sequence
1358
+ _save1 = self.pos
1359
+ _ary = []
1360
+ _tmp = apply(:_not_space_colon)
1361
+ if _tmp
1362
+ _ary << @result
1363
+ while true
1277
1364
  _tmp = apply(:_not_space_colon)
1278
- if _tmp
1279
- _ary << @result
1280
- while true
1281
- _tmp = apply(:_not_space_colon)
1282
- _ary << @result if _tmp
1283
- break unless _tmp
1284
- end
1285
- _tmp = true
1286
- @result = _ary
1287
- else
1288
- self.pos = _save1
1289
- end
1290
- ary = @result
1291
- unless _tmp
1292
- self.pos = _save
1293
- break
1294
- end
1295
- @result = begin; ary.join ; end
1296
- _tmp = true
1297
- unless _tmp
1298
- self.pos = _save
1299
- end
1300
- break
1301
- end # end sequence
1365
+ _ary << @result if _tmp
1366
+ break unless _tmp
1367
+ end
1368
+ _tmp = true
1369
+ @result = _ary
1370
+ else
1371
+ self.pos = _save1
1372
+ end
1373
+ ary = @result
1374
+ unless _tmp
1375
+ self.pos = _save
1376
+ break
1377
+ end
1378
+ @result = begin; ary.join ; end
1379
+ _tmp = true
1380
+ unless _tmp
1381
+ self.pos = _save
1382
+ end
1383
+ break
1384
+ end # end sequence
1302
1385
 
1303
1386
  set_failed_rule :_not_space_colons unless _tmp
1304
1387
  return _tmp
@@ -1306,17 +1389,17 @@ class CmdParse
1306
1389
 
1307
1390
  # filename = (dbl_string | not_space_colons)
1308
1391
  def _filename
1309
-
1392
+
1310
1393
  _save = self.pos
1311
- while true # choice
1312
- _tmp = apply(:_dbl_string)
1313
- break if _tmp
1314
- self.pos = _save
1315
- _tmp = apply(:_not_space_colons)
1316
- break if _tmp
1317
- self.pos = _save
1318
- break
1319
- end # end choice
1394
+ while true # choice
1395
+ _tmp = apply(:_dbl_string)
1396
+ break if _tmp
1397
+ self.pos = _save
1398
+ _tmp = apply(:_not_space_colons)
1399
+ break if _tmp
1400
+ self.pos = _save
1401
+ break
1402
+ end # end choice
1320
1403
 
1321
1404
  set_failed_rule :_filename unless _tmp
1322
1405
  return _tmp
@@ -1324,27 +1407,27 @@ class CmdParse
1324
1407
 
1325
1408
  # file_pos_sep = (sp+ | ":")
1326
1409
  def _file_pos_sep
1327
-
1410
+
1328
1411
  _save = self.pos
1329
- while true # choice
1330
- _save1 = self.pos
1331
- _tmp = apply(:_sp)
1332
- if _tmp
1333
- while true
1334
- _tmp = apply(:_sp)
1335
- break unless _tmp
1336
- end
1337
- _tmp = true
1338
- else
1339
- self.pos = _save1
1340
- end
1341
- break if _tmp
1342
- self.pos = _save
1343
- _tmp = match_string(":")
1344
- break if _tmp
1345
- self.pos = _save
1346
- break
1347
- end # end choice
1412
+ while true # choice
1413
+ _save1 = self.pos
1414
+ _tmp = apply(:_sp)
1415
+ if _tmp
1416
+ while true
1417
+ _tmp = apply(:_sp)
1418
+ break unless _tmp
1419
+ end
1420
+ _tmp = true
1421
+ else
1422
+ self.pos = _save1
1423
+ end
1424
+ break if _tmp
1425
+ self.pos = _save
1426
+ _tmp = match_string(":")
1427
+ break if _tmp
1428
+ self.pos = _save
1429
+ break
1430
+ end # end choice
1348
1431
 
1349
1432
  set_failed_rule :_file_pos_sep unless _tmp
1350
1433
  return _tmp
@@ -1352,25 +1435,25 @@ class CmdParse
1352
1435
 
1353
1436
  # integer = < /[0-9]+/ > { text.to_i }
1354
1437
  def _integer
1355
-
1438
+
1356
1439
  _save = self.pos
1357
- while true # sequence
1358
- _text_start = self.pos
1359
- _tmp = scan(/\A(?-mix:[0-9]+)/)
1360
- if _tmp
1361
- text = get_text(_text_start)
1362
- end
1363
- unless _tmp
1364
- self.pos = _save
1365
- break
1366
- end
1367
- @result = begin; text.to_i ; end
1368
- _tmp = true
1369
- unless _tmp
1370
- self.pos = _save
1371
- end
1372
- break
1373
- end # end sequence
1440
+ while true # sequence
1441
+ _text_start = self.pos
1442
+ _tmp = scan(/\A(?-mix:[0-9]+)/)
1443
+ if _tmp
1444
+ text = get_text(_text_start)
1445
+ end
1446
+ unless _tmp
1447
+ self.pos = _save
1448
+ break
1449
+ end
1450
+ @result = begin; text.to_i ; end
1451
+ _tmp = true
1452
+ unless _tmp
1453
+ self.pos = _save
1454
+ end
1455
+ break
1456
+ end # end sequence
1374
1457
 
1375
1458
  set_failed_rule :_integer unless _tmp
1376
1459
  return _tmp
@@ -1378,25 +1461,25 @@ class CmdParse
1378
1461
 
1379
1462
  # sinteger = < /[+-]?[0-9]+/ > { text.to_i }
1380
1463
  def _sinteger
1381
-
1464
+
1382
1465
  _save = self.pos
1383
- while true # sequence
1384
- _text_start = self.pos
1385
- _tmp = scan(/\A(?-mix:[+-]?[0-9]+)/)
1386
- if _tmp
1387
- text = get_text(_text_start)
1388
- end
1389
- unless _tmp
1390
- self.pos = _save
1391
- break
1392
- end
1393
- @result = begin; text.to_i ; end
1394
- _tmp = true
1395
- unless _tmp
1396
- self.pos = _save
1397
- end
1398
- break
1399
- end # end sequence
1466
+ while true # sequence
1467
+ _text_start = self.pos
1468
+ _tmp = scan(/\A(?-mix:[+-]?[0-9]+)/)
1469
+ if _tmp
1470
+ text = get_text(_text_start)
1471
+ end
1472
+ unless _tmp
1473
+ self.pos = _save
1474
+ break
1475
+ end
1476
+ @result = begin; text.to_i ; end
1477
+ _tmp = true
1478
+ unless _tmp
1479
+ self.pos = _save
1480
+ end
1481
+ break
1482
+ end # end sequence
1400
1483
 
1401
1484
  set_failed_rule :_sinteger unless _tmp
1402
1485
  return _tmp
@@ -1404,115 +1487,115 @@ class CmdParse
1404
1487
 
1405
1488
  # line_number = integer
1406
1489
  def _line_number
1407
- _tmp = apply(:_integer)
1490
+ _tmp = apply(:_integer)
1408
1491
  set_failed_rule :_line_number unless _tmp
1409
1492
  return _tmp
1410
1493
  end
1411
1494
 
1412
1495
  # vm_offset = "@" integer:int { Position.new(nil, nil, :offset, int) }
1413
1496
  def _vm_offset
1414
-
1497
+
1415
1498
  _save = self.pos
1416
- while true # sequence
1417
- _tmp = match_string("@")
1418
- unless _tmp
1419
- self.pos = _save
1420
- break
1421
- end
1422
- _tmp = apply(:_integer)
1423
- int = @result
1424
- unless _tmp
1425
- self.pos = _save
1426
- break
1427
- end
1428
- @result = begin;
1499
+ while true # sequence
1500
+ _tmp = match_string("@")
1501
+ unless _tmp
1502
+ self.pos = _save
1503
+ break
1504
+ end
1505
+ _tmp = apply(:_integer)
1506
+ int = @result
1507
+ unless _tmp
1508
+ self.pos = _save
1509
+ break
1510
+ end
1511
+ @result = begin;
1429
1512
  Position.new(nil, nil, :offset, int)
1430
1513
  ; end
1431
- _tmp = true
1432
- unless _tmp
1433
- self.pos = _save
1434
- end
1435
- break
1436
- end # end sequence
1514
+ _tmp = true
1515
+ unless _tmp
1516
+ self.pos = _save
1517
+ end
1518
+ break
1519
+ end # end sequence
1437
1520
 
1438
1521
  set_failed_rule :_vm_offset unless _tmp
1439
1522
  return _tmp
1440
1523
  end
1441
1524
 
1442
- # position = (vm_offset | line_number:l { Position.new(nil, nil, :line, l) })
1525
+ # position = (vm_offset | line_number:l { Position.new(nil, nil, :line, l) })
1443
1526
  def _position
1444
-
1527
+
1445
1528
  _save = self.pos
1446
- while true # choice
1447
- _tmp = apply(:_vm_offset)
1448
- break if _tmp
1449
- self.pos = _save
1450
-
1451
- _save1 = self.pos
1452
- while true # sequence
1453
- _tmp = apply(:_line_number)
1454
- l = @result
1455
- unless _tmp
1456
- self.pos = _save1
1457
- break
1458
- end
1459
- @result = begin;
1460
- Position.new(nil, nil, :line, l)
1529
+ while true # choice
1530
+ _tmp = apply(:_vm_offset)
1531
+ break if _tmp
1532
+ self.pos = _save
1533
+
1534
+ _save1 = self.pos
1535
+ while true # sequence
1536
+ _tmp = apply(:_line_number)
1537
+ l = @result
1538
+ unless _tmp
1539
+ self.pos = _save1
1540
+ break
1541
+ end
1542
+ @result = begin;
1543
+ Position.new(nil, nil, :line, l)
1461
1544
  ; end
1462
- _tmp = true
1463
- unless _tmp
1464
- self.pos = _save1
1465
- end
1466
- break
1467
- end # end sequence
1468
-
1469
- break if _tmp
1470
- self.pos = _save
1471
- break
1472
- end # end choice
1545
+ _tmp = true
1546
+ unless _tmp
1547
+ self.pos = _save1
1548
+ end
1549
+ break
1550
+ end # end sequence
1551
+
1552
+ break if _tmp
1553
+ self.pos = _save
1554
+ break
1555
+ end # end choice
1473
1556
 
1474
1557
  set_failed_rule :_position unless _tmp
1475
1558
  return _tmp
1476
1559
  end
1477
1560
 
1478
- # file_colon_line = file_no_colon:file &{ File.exist?(file) } ":" position:pos { Position.new(:file, file, pos.position_type, pos.position) }
1561
+ # file_colon_line = file_no_colon:file &{ File.exist?(file) } ":" position:pos { Position.new(:file, file, pos.position_type, pos.position) }
1479
1562
  def _file_colon_line
1480
-
1563
+
1481
1564
  _save = self.pos
1482
- while true # sequence
1483
- _tmp = apply(:_file_no_colon)
1484
- file = @result
1485
- unless _tmp
1486
- self.pos = _save
1487
- break
1488
- end
1489
- _save1 = self.pos
1490
- _tmp = begin; File.exist?(file) ; end
1491
- self.pos = _save1
1492
- unless _tmp
1493
- self.pos = _save
1494
- break
1495
- end
1496
- _tmp = match_string(":")
1497
- unless _tmp
1498
- self.pos = _save
1499
- break
1500
- end
1501
- _tmp = apply(:_position)
1502
- pos = @result
1503
- unless _tmp
1504
- self.pos = _save
1505
- break
1506
- end
1507
- @result = begin;
1508
- Position.new(:file, file, pos.position_type, pos.position)
1565
+ while true # sequence
1566
+ _tmp = apply(:_file_no_colon)
1567
+ file = @result
1568
+ unless _tmp
1569
+ self.pos = _save
1570
+ break
1571
+ end
1572
+ _save1 = self.pos
1573
+ _tmp = begin; File.exist?(file) ; end
1574
+ self.pos = _save1
1575
+ unless _tmp
1576
+ self.pos = _save
1577
+ break
1578
+ end
1579
+ _tmp = match_string(":")
1580
+ unless _tmp
1581
+ self.pos = _save
1582
+ break
1583
+ end
1584
+ _tmp = apply(:_position)
1585
+ pos = @result
1586
+ unless _tmp
1587
+ self.pos = _save
1588
+ break
1589
+ end
1590
+ @result = begin;
1591
+ Position.new(:file, file, pos.position_type, pos.position)
1509
1592
  ; end
1510
- _tmp = true
1511
- unless _tmp
1512
- self.pos = _save
1513
- end
1514
- break
1515
- end # end sequence
1593
+ _tmp = true
1594
+ unless _tmp
1595
+ self.pos = _save
1596
+ end
1597
+ break
1598
+ end # end sequence
1516
1599
 
1517
1600
  set_failed_rule :_file_colon_line unless _tmp
1518
1601
  return _tmp
@@ -1520,154 +1603,154 @@ class CmdParse
1520
1603
 
1521
1604
  # location = (position | < filename >:file &{ @file_exists_proc.call(file) } file_pos_sep position:pos { Position.new(:file, file, pos.position_type, pos.position) } | < filename >:file &{ @file_exists_proc.call(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) })
1522
1605
  def _location
1523
-
1606
+
1524
1607
  _save = self.pos
1525
- while true # choice
1526
- _tmp = apply(:_position)
1527
- break if _tmp
1528
- self.pos = _save
1529
-
1530
- _save1 = self.pos
1531
- while true # sequence
1532
- _text_start = self.pos
1533
- _tmp = apply(:_filename)
1534
- if _tmp
1535
- text = get_text(_text_start)
1536
- end
1537
- file = @result
1538
- unless _tmp
1539
- self.pos = _save1
1540
- break
1541
- end
1542
- _save2 = self.pos
1543
- _tmp = begin; @file_exists_proc.call(file) ; end
1544
- self.pos = _save2
1545
- unless _tmp
1546
- self.pos = _save1
1547
- break
1548
- end
1549
- _tmp = apply(:_file_pos_sep)
1550
- unless _tmp
1551
- self.pos = _save1
1552
- break
1553
- end
1554
- _tmp = apply(:_position)
1555
- pos = @result
1556
- unless _tmp
1557
- self.pos = _save1
1558
- break
1559
- end
1560
- @result = begin;
1608
+ while true # choice
1609
+ _tmp = apply(:_position)
1610
+ break if _tmp
1611
+ self.pos = _save
1612
+
1613
+ _save1 = self.pos
1614
+ while true # sequence
1615
+ _text_start = self.pos
1616
+ _tmp = apply(:_filename)
1617
+ if _tmp
1618
+ text = get_text(_text_start)
1619
+ end
1620
+ file = @result
1621
+ unless _tmp
1622
+ self.pos = _save1
1623
+ break
1624
+ end
1625
+ _save2 = self.pos
1626
+ _tmp = begin; @file_exists_proc.call(file) ; end
1627
+ self.pos = _save2
1628
+ unless _tmp
1629
+ self.pos = _save1
1630
+ break
1631
+ end
1632
+ _tmp = apply(:_file_pos_sep)
1633
+ unless _tmp
1634
+ self.pos = _save1
1635
+ break
1636
+ end
1637
+ _tmp = apply(:_position)
1638
+ pos = @result
1639
+ unless _tmp
1640
+ self.pos = _save1
1641
+ break
1642
+ end
1643
+ @result = begin;
1561
1644
  Position.new(:file, file, pos.position_type, pos.position)
1562
1645
  ; end
1563
- _tmp = true
1564
- unless _tmp
1565
- self.pos = _save1
1566
- end
1567
- break
1568
- end # end sequence
1569
-
1570
- break if _tmp
1571
- self.pos = _save
1572
-
1573
- _save3 = self.pos
1574
- while true # sequence
1575
- _text_start = self.pos
1576
- _tmp = apply(:_filename)
1577
- if _tmp
1578
- text = get_text(_text_start)
1579
- end
1580
- file = @result
1581
- unless _tmp
1582
- self.pos = _save3
1583
- break
1584
- end
1585
- _save4 = self.pos
1586
- _tmp = begin; @file_exists_proc.call(file) ; end
1587
- self.pos = _save4
1588
- unless _tmp
1589
- self.pos = _save3
1590
- break
1591
- end
1592
- @result = begin;
1646
+ _tmp = true
1647
+ unless _tmp
1648
+ self.pos = _save1
1649
+ end
1650
+ break
1651
+ end # end sequence
1652
+
1653
+ break if _tmp
1654
+ self.pos = _save
1655
+
1656
+ _save3 = self.pos
1657
+ while true # sequence
1658
+ _text_start = self.pos
1659
+ _tmp = apply(:_filename)
1660
+ if _tmp
1661
+ text = get_text(_text_start)
1662
+ end
1663
+ file = @result
1664
+ unless _tmp
1665
+ self.pos = _save3
1666
+ break
1667
+ end
1668
+ _save4 = self.pos
1669
+ _tmp = begin; @file_exists_proc.call(file) ; end
1670
+ self.pos = _save4
1671
+ unless _tmp
1672
+ self.pos = _save3
1673
+ break
1674
+ end
1675
+ @result = begin;
1593
1676
  Position.new(:file, file, nil, nil)
1594
1677
  ; end
1595
- _tmp = true
1596
- unless _tmp
1597
- self.pos = _save3
1598
- end
1599
- break
1600
- end # end sequence
1601
-
1602
- break if _tmp
1603
- self.pos = _save
1604
-
1605
- _save5 = self.pos
1606
- while true # sequence
1607
- _save6 = self.pos
1608
- _tmp = apply(:_class_module_chain)
1609
- @result = nil unless _tmp
1610
- unless _tmp
1611
- _tmp = true
1612
- self.pos = _save6
1613
- end
1614
- fn = @result
1615
- unless _tmp
1616
- self.pos = _save5
1617
- break
1618
- end
1619
- _tmp = apply(:_file_pos_sep)
1620
- unless _tmp
1621
- self.pos = _save5
1622
- break
1623
- end
1624
- _tmp = apply(:_position)
1625
- pos = @result
1626
- unless _tmp
1627
- self.pos = _save5
1628
- break
1629
- end
1630
- @result = begin;
1678
+ _tmp = true
1679
+ unless _tmp
1680
+ self.pos = _save3
1681
+ end
1682
+ break
1683
+ end # end sequence
1684
+
1685
+ break if _tmp
1686
+ self.pos = _save
1687
+
1688
+ _save5 = self.pos
1689
+ while true # sequence
1690
+ _save6 = self.pos
1691
+ _tmp = apply(:_class_module_chain)
1692
+ @result = nil unless _tmp
1693
+ unless _tmp
1694
+ _tmp = true
1695
+ self.pos = _save6
1696
+ end
1697
+ fn = @result
1698
+ unless _tmp
1699
+ self.pos = _save5
1700
+ break
1701
+ end
1702
+ _tmp = apply(:_file_pos_sep)
1703
+ unless _tmp
1704
+ self.pos = _save5
1705
+ break
1706
+ end
1707
+ _tmp = apply(:_position)
1708
+ pos = @result
1709
+ unless _tmp
1710
+ self.pos = _save5
1711
+ break
1712
+ end
1713
+ @result = begin;
1631
1714
  Position.new(:fn, fn, pos.position_type, pos.position)
1632
1715
  ; end
1633
- _tmp = true
1634
- unless _tmp
1635
- self.pos = _save5
1636
- end
1637
- break
1638
- end # end sequence
1639
-
1640
- break if _tmp
1641
- self.pos = _save
1642
-
1643
- _save7 = self.pos
1644
- while true # sequence
1645
- _save8 = self.pos
1646
- _tmp = apply(:_class_module_chain)
1647
- @result = nil unless _tmp
1648
- unless _tmp
1649
- _tmp = true
1650
- self.pos = _save8
1651
- end
1652
- fn = @result
1653
- unless _tmp
1654
- self.pos = _save7
1655
- break
1656
- end
1657
- @result = begin;
1716
+ _tmp = true
1717
+ unless _tmp
1718
+ self.pos = _save5
1719
+ end
1720
+ break
1721
+ end # end sequence
1722
+
1723
+ break if _tmp
1724
+ self.pos = _save
1725
+
1726
+ _save7 = self.pos
1727
+ while true # sequence
1728
+ _save8 = self.pos
1729
+ _tmp = apply(:_class_module_chain)
1730
+ @result = nil unless _tmp
1731
+ unless _tmp
1732
+ _tmp = true
1733
+ self.pos = _save8
1734
+ end
1735
+ fn = @result
1736
+ unless _tmp
1737
+ self.pos = _save7
1738
+ break
1739
+ end
1740
+ @result = begin;
1658
1741
  Position.new(:fn, fn, nil, nil)
1659
1742
  ; end
1660
- _tmp = true
1661
- unless _tmp
1662
- self.pos = _save7
1663
- end
1664
- break
1665
- end # end sequence
1666
-
1667
- break if _tmp
1668
- self.pos = _save
1669
- break
1670
- end # end choice
1743
+ _tmp = true
1744
+ unless _tmp
1745
+ self.pos = _save7
1746
+ end
1747
+ break
1748
+ end # end sequence
1749
+
1750
+ break if _tmp
1751
+ self.pos = _save
1752
+ break
1753
+ end # end choice
1671
1754
 
1672
1755
  set_failed_rule :_location unless _tmp
1673
1756
  return _tmp
@@ -1675,36 +1758,36 @@ class CmdParse
1675
1758
 
1676
1759
  # if_unless = < ("if" | "unless") > { text }
1677
1760
  def _if_unless
1678
-
1761
+
1679
1762
  _save = self.pos
1680
- while true # sequence
1681
- _text_start = self.pos
1682
-
1683
- _save1 = self.pos
1684
- while true # choice
1685
- _tmp = match_string("if")
1686
- break if _tmp
1687
- self.pos = _save1
1688
- _tmp = match_string("unless")
1689
- break if _tmp
1690
- self.pos = _save1
1691
- break
1692
- end # end choice
1693
-
1694
- if _tmp
1695
- text = get_text(_text_start)
1696
- end
1697
- unless _tmp
1698
- self.pos = _save
1699
- break
1700
- end
1701
- @result = begin; text ; end
1702
- _tmp = true
1703
- unless _tmp
1704
- self.pos = _save
1705
- end
1706
- break
1707
- end # end sequence
1763
+ while true # sequence
1764
+ _text_start = self.pos
1765
+
1766
+ _save1 = self.pos
1767
+ while true # choice
1768
+ _tmp = match_string("if")
1769
+ break if _tmp
1770
+ self.pos = _save1
1771
+ _tmp = match_string("unless")
1772
+ break if _tmp
1773
+ self.pos = _save1
1774
+ break
1775
+ end # end choice
1776
+
1777
+ if _tmp
1778
+ text = get_text(_text_start)
1779
+ end
1780
+ unless _tmp
1781
+ self.pos = _save
1782
+ break
1783
+ end
1784
+ @result = begin; text ; end
1785
+ _tmp = true
1786
+ unless _tmp
1787
+ self.pos = _save
1788
+ end
1789
+ break
1790
+ end # end sequence
1708
1791
 
1709
1792
  set_failed_rule :_if_unless unless _tmp
1710
1793
  return _tmp
@@ -1712,25 +1795,25 @@ class CmdParse
1712
1795
 
1713
1796
  # condition = < /.+/ > { text}
1714
1797
  def _condition
1715
-
1798
+
1716
1799
  _save = self.pos
1717
- while true # sequence
1718
- _text_start = self.pos
1719
- _tmp = scan(/\A(?-mix:.+)/)
1720
- if _tmp
1721
- text = get_text(_text_start)
1722
- end
1723
- unless _tmp
1724
- self.pos = _save
1725
- break
1726
- end
1727
- @result = begin; text; end
1728
- _tmp = true
1729
- unless _tmp
1730
- self.pos = _save
1731
- end
1732
- break
1733
- end # end sequence
1800
+ while true # sequence
1801
+ _text_start = self.pos
1802
+ _tmp = scan(/\A(?-mix:.+)/)
1803
+ if _tmp
1804
+ text = get_text(_text_start)
1805
+ end
1806
+ unless _tmp
1807
+ self.pos = _save
1808
+ break
1809
+ end
1810
+ @result = begin; text; end
1811
+ _tmp = true
1812
+ unless _tmp
1813
+ self.pos = _save
1814
+ end
1815
+ break
1816
+ end # end sequence
1734
1817
 
1735
1818
  set_failed_rule :_condition unless _tmp
1736
1819
  return _tmp
@@ -1738,24 +1821,24 @@ class CmdParse
1738
1821
 
1739
1822
  # breakpoint_stmt_no_condition = location:loc { Breakpoint.new(loc, false, 'true') }
1740
1823
  def _breakpoint_stmt_no_condition
1741
-
1824
+
1742
1825
  _save = self.pos
1743
- while true # sequence
1744
- _tmp = apply(:_location)
1745
- loc = @result
1746
- unless _tmp
1747
- self.pos = _save
1748
- break
1749
- end
1750
- @result = begin;
1826
+ while true # sequence
1827
+ _tmp = apply(:_location)
1828
+ loc = @result
1829
+ unless _tmp
1830
+ self.pos = _save
1831
+ break
1832
+ end
1833
+ @result = begin;
1751
1834
  Breakpoint.new(loc, false, 'true')
1752
1835
  ; end
1753
- _tmp = true
1754
- unless _tmp
1755
- self.pos = _save
1756
- end
1757
- break
1758
- end # end sequence
1836
+ _tmp = true
1837
+ unless _tmp
1838
+ self.pos = _save
1839
+ end
1840
+ break
1841
+ end # end sequence
1759
1842
 
1760
1843
  set_failed_rule :_breakpoint_stmt_no_condition unless _tmp
1761
1844
  return _tmp
@@ -1763,57 +1846,57 @@ class CmdParse
1763
1846
 
1764
1847
  # breakpoint_stmt = (location:loc - if_unless:iu - condition:cond { Breakpoint.new(loc, iu == 'unless', cond) } | breakpoint_stmt_no_condition)
1765
1848
  def _breakpoint_stmt
1766
-
1849
+
1767
1850
  _save = self.pos
1768
- while true # choice
1769
-
1770
- _save1 = self.pos
1771
- while true # sequence
1772
- _tmp = apply(:_location)
1773
- loc = @result
1774
- unless _tmp
1775
- self.pos = _save1
1776
- break
1777
- end
1778
- _tmp = apply(:__hyphen_)
1779
- unless _tmp
1780
- self.pos = _save1
1781
- break
1782
- end
1783
- _tmp = apply(:_if_unless)
1784
- iu = @result
1785
- unless _tmp
1786
- self.pos = _save1
1787
- break
1788
- end
1789
- _tmp = apply(:__hyphen_)
1790
- unless _tmp
1791
- self.pos = _save1
1792
- break
1793
- end
1794
- _tmp = apply(:_condition)
1795
- cond = @result
1796
- unless _tmp
1797
- self.pos = _save1
1798
- break
1799
- end
1800
- @result = begin;
1851
+ while true # choice
1852
+
1853
+ _save1 = self.pos
1854
+ while true # sequence
1855
+ _tmp = apply(:_location)
1856
+ loc = @result
1857
+ unless _tmp
1858
+ self.pos = _save1
1859
+ break
1860
+ end
1861
+ _tmp = apply(:__hyphen_)
1862
+ unless _tmp
1863
+ self.pos = _save1
1864
+ break
1865
+ end
1866
+ _tmp = apply(:_if_unless)
1867
+ iu = @result
1868
+ unless _tmp
1869
+ self.pos = _save1
1870
+ break
1871
+ end
1872
+ _tmp = apply(:__hyphen_)
1873
+ unless _tmp
1874
+ self.pos = _save1
1875
+ break
1876
+ end
1877
+ _tmp = apply(:_condition)
1878
+ cond = @result
1879
+ unless _tmp
1880
+ self.pos = _save1
1881
+ break
1882
+ end
1883
+ @result = begin;
1801
1884
  Breakpoint.new(loc, iu == 'unless', cond)
1802
1885
  ; end
1803
- _tmp = true
1804
- unless _tmp
1805
- self.pos = _save1
1806
- end
1807
- break
1808
- end # end sequence
1809
-
1810
- break if _tmp
1811
- self.pos = _save
1812
- _tmp = apply(:_breakpoint_stmt_no_condition)
1813
- break if _tmp
1814
- self.pos = _save
1815
- break
1816
- end # end choice
1886
+ _tmp = true
1887
+ unless _tmp
1888
+ self.pos = _save1
1889
+ end
1890
+ break
1891
+ end # end sequence
1892
+
1893
+ break if _tmp
1894
+ self.pos = _save
1895
+ _tmp = apply(:_breakpoint_stmt_no_condition)
1896
+ break if _tmp
1897
+ self.pos = _save
1898
+ break
1899
+ end # end choice
1817
1900
 
1818
1901
  set_failed_rule :_breakpoint_stmt unless _tmp
1819
1902
  return _tmp
@@ -1821,36 +1904,36 @@ class CmdParse
1821
1904
 
1822
1905
  # list_special_targets = < ("." | "-") > { text }
1823
1906
  def _list_special_targets
1824
-
1907
+
1825
1908
  _save = self.pos
1826
- while true # sequence
1827
- _text_start = self.pos
1828
-
1829
- _save1 = self.pos
1830
- while true # choice
1831
- _tmp = match_string(".")
1832
- break if _tmp
1833
- self.pos = _save1
1834
- _tmp = match_string("-")
1835
- break if _tmp
1836
- self.pos = _save1
1837
- break
1838
- end # end choice
1839
-
1840
- if _tmp
1841
- text = get_text(_text_start)
1842
- end
1843
- unless _tmp
1844
- self.pos = _save
1845
- break
1846
- end
1847
- @result = begin; text ; end
1848
- _tmp = true
1849
- unless _tmp
1850
- self.pos = _save
1851
- end
1852
- break
1853
- end # end sequence
1909
+ while true # sequence
1910
+ _text_start = self.pos
1911
+
1912
+ _save1 = self.pos
1913
+ while true # choice
1914
+ _tmp = match_string(".")
1915
+ break if _tmp
1916
+ self.pos = _save1
1917
+ _tmp = match_string("-")
1918
+ break if _tmp
1919
+ self.pos = _save1
1920
+ break
1921
+ end # end choice
1922
+
1923
+ if _tmp
1924
+ text = get_text(_text_start)
1925
+ end
1926
+ unless _tmp
1927
+ self.pos = _save
1928
+ break
1929
+ end
1930
+ @result = begin; text ; end
1931
+ _tmp = true
1932
+ unless _tmp
1933
+ self.pos = _save
1934
+ end
1935
+ break
1936
+ end # end sequence
1854
1937
 
1855
1938
  set_failed_rule :_list_special_targets unless _tmp
1856
1939
  return _tmp
@@ -1858,226 +1941,137 @@ class CmdParse
1858
1941
 
1859
1942
  # list_stmt = ((list_special_targets | location):loc - sinteger:int? { List.new(loc, int) } | (list_special_targets | location):loc { List.new(loc, nil) })
1860
1943
  def _list_stmt
1861
-
1944
+
1862
1945
  _save = self.pos
1863
- while true # choice
1864
-
1865
- _save1 = self.pos
1866
- while true # sequence
1867
-
1868
- _save2 = self.pos
1869
- while true # choice
1870
- _tmp = apply(:_list_special_targets)
1871
- break if _tmp
1872
- self.pos = _save2
1873
- _tmp = apply(:_location)
1874
- break if _tmp
1875
- self.pos = _save2
1876
- break
1877
- end # end choice
1878
-
1879
- loc = @result
1880
- unless _tmp
1881
- self.pos = _save1
1882
- break
1883
- end
1884
- _tmp = apply(:__hyphen_)
1885
- unless _tmp
1886
- self.pos = _save1
1887
- break
1888
- end
1889
- _save3 = self.pos
1890
- _tmp = apply(:_sinteger)
1891
- int = @result
1892
- unless _tmp
1893
- _tmp = true
1894
- self.pos = _save3
1895
- end
1896
- unless _tmp
1897
- self.pos = _save1
1898
- break
1899
- end
1900
- @result = begin;
1901
- List.new(loc, int)
1902
- ; end
1903
- _tmp = true
1904
- unless _tmp
1905
- self.pos = _save1
1906
- end
1907
- break
1908
- end # end sequence
1909
-
1910
- break if _tmp
1911
- self.pos = _save
1912
-
1913
- _save4 = self.pos
1914
- while true # sequence
1915
-
1916
- _save5 = self.pos
1917
- while true # choice
1918
- _tmp = apply(:_list_special_targets)
1919
- break if _tmp
1920
- self.pos = _save5
1921
- _tmp = apply(:_location)
1922
- break if _tmp
1923
- self.pos = _save5
1924
- break
1925
- end # end choice
1926
-
1927
- loc = @result
1928
- unless _tmp
1929
- self.pos = _save4
1930
- break
1931
- end
1932
- @result = begin;
1933
- List.new(loc, nil)
1934
- ; end
1935
- _tmp = true
1936
- unless _tmp
1937
- self.pos = _save4
1938
- end
1939
- break
1940
- end # end sequence
1941
-
1942
- break if _tmp
1943
- self.pos = _save
1944
- break
1945
- end # end choice
1946
+ while true # choice
1946
1947
 
1947
- set_failed_rule :_list_stmt unless _tmp
1948
- return _tmp
1949
- end
1948
+ _save1 = self.pos
1949
+ while true # sequence
1950
1950
 
1951
- # list_stmt = ((list_special_targets | location):loc - integer:int? { List.new(loc, int) } | (list_special_targets | location):loc { List.new(loc, nil) })
1952
- def _list_stmt
1953
-
1954
- _save = self.pos
1955
- while true # choice
1956
-
1957
- _save1 = self.pos
1958
- while true # sequence
1959
-
1960
- _save2 = self.pos
1961
- while true # choice
1962
- _tmp = apply(:_list_special_targets)
1963
- break if _tmp
1964
- self.pos = _save2
1965
- _tmp = apply(:_location)
1966
- break if _tmp
1967
- self.pos = _save2
1968
- break
1969
- end # end choice
1970
-
1971
- loc = @result
1972
- unless _tmp
1973
- self.pos = _save1
1974
- break
1975
- end
1976
- _tmp = apply(:__hyphen_)
1977
- unless _tmp
1978
- self.pos = _save1
1979
- break
1980
- end
1981
- _save3 = self.pos
1982
- _tmp = apply(:_integer)
1983
- int = @result
1984
- unless _tmp
1985
- _tmp = true
1986
- self.pos = _save3
1987
- end
1988
- unless _tmp
1989
- self.pos = _save1
1990
- break
1991
- end
1992
- @result = begin;
1951
+ _save2 = self.pos
1952
+ while true # choice
1953
+ _tmp = apply(:_list_special_targets)
1954
+ break if _tmp
1955
+ self.pos = _save2
1956
+ _tmp = apply(:_location)
1957
+ break if _tmp
1958
+ self.pos = _save2
1959
+ break
1960
+ end # end choice
1961
+
1962
+ loc = @result
1963
+ unless _tmp
1964
+ self.pos = _save1
1965
+ break
1966
+ end
1967
+ _tmp = apply(:__hyphen_)
1968
+ unless _tmp
1969
+ self.pos = _save1
1970
+ break
1971
+ end
1972
+ _save3 = self.pos
1973
+ _tmp = apply(:_sinteger)
1974
+ int = @result
1975
+ unless _tmp
1976
+ _tmp = true
1977
+ self.pos = _save3
1978
+ end
1979
+ unless _tmp
1980
+ self.pos = _save1
1981
+ break
1982
+ end
1983
+ @result = begin;
1993
1984
  List.new(loc, int)
1994
1985
  ; end
1995
- _tmp = true
1996
- unless _tmp
1997
- self.pos = _save1
1998
- end
1999
- break
2000
- end # end sequence
2001
-
2002
- break if _tmp
2003
- self.pos = _save
2004
-
2005
- _save4 = self.pos
2006
- while true # sequence
2007
-
2008
- _save5 = self.pos
2009
- while true # choice
2010
- _tmp = apply(:_list_special_targets)
2011
- break if _tmp
2012
- self.pos = _save5
2013
- _tmp = apply(:_location)
2014
- break if _tmp
2015
- self.pos = _save5
2016
- break
2017
- end # end choice
2018
-
2019
- loc = @result
2020
- unless _tmp
2021
- self.pos = _save4
2022
- break
2023
- end
2024
- @result = begin;
1986
+ _tmp = true
1987
+ unless _tmp
1988
+ self.pos = _save1
1989
+ end
1990
+ break
1991
+ end # end sequence
1992
+
1993
+ break if _tmp
1994
+ self.pos = _save
1995
+
1996
+ _save4 = self.pos
1997
+ while true # sequence
1998
+
1999
+ _save5 = self.pos
2000
+ while true # choice
2001
+ _tmp = apply(:_list_special_targets)
2002
+ break if _tmp
2003
+ self.pos = _save5
2004
+ _tmp = apply(:_location)
2005
+ break if _tmp
2006
+ self.pos = _save5
2007
+ break
2008
+ end # end choice
2009
+
2010
+ loc = @result
2011
+ unless _tmp
2012
+ self.pos = _save4
2013
+ break
2014
+ end
2015
+ @result = begin;
2025
2016
  List.new(loc, nil)
2026
2017
  ; end
2027
- _tmp = true
2028
- unless _tmp
2029
- self.pos = _save4
2030
- end
2031
- break
2032
- end # end sequence
2033
-
2034
- break if _tmp
2035
- self.pos = _save
2036
- break
2037
- end # end choice
2018
+ _tmp = true
2019
+ unless _tmp
2020
+ self.pos = _save4
2021
+ end
2022
+ break
2023
+ end # end sequence
2024
+
2025
+ break if _tmp
2026
+ self.pos = _save
2027
+ break
2028
+ end # end choice
2038
2029
 
2030
+ set_failed_rule :_list_stmt unless _tmp
2039
2031
  return _tmp
2040
2032
  end
2041
- end
2042
- if __FILE__ == $0
2043
- # require 'rubygems'; require_relative '../lib/trepanning';
2044
-
2045
- cp = CmdParse.new('', :debug=>true)
2046
- %w(A::B @@classvar abc01! @ivar @ivar.meth
2047
- Object A::B::C A::B::C::D A::B.c A.b.c.d).each do |name|
2048
- cp.setup_parser(name, true)
2049
- # debugger if name == '@ivar.meth'
2050
- res = cp._class_module_chain
2051
- p res
2052
- p cp.string
2053
- p cp.result
2054
- end
2055
- %w(A::B:5 A::B:@5 @@classvar abc01!:10 @ivar).each do |name|
2056
- cp.setup_parser(name, true)
2057
- res = cp._location
2058
- p res
2059
- p cp.string
2060
- p cp.result
2061
- end
2062
- # require 'trepanning';
2063
- ["#{__FILE__}:10", 'A::B 5',
2064
- "#{__FILE__} 20"].each do |name|
2065
- cp.setup_parser(name, {:debug=>true})
2066
- res = cp._location
2067
- p res
2068
- p cp.string
2069
- p cp.result
2070
- end
2071
2033
 
2072
- ['filename', '"this is a filename"',
2073
- 'this\ is\ another\ filename',
2074
- 'C\:filename'
2075
- ].each do |name|
2076
- puts '-' * 10
2077
- cp.setup_parser(name, {:debug=>true})
2078
- res = cp._filename
2079
- p res
2080
- puts cp.string
2081
- puts cp.result
2082
- end
2034
+ Rules = {}
2035
+ Rules[:_upcase_letter] = rule_info("upcase_letter", "/[A-Z]/")
2036
+ Rules[:_downcase_letter] = rule_info("downcase_letter", "/[a-z]/")
2037
+ Rules[:_suffix_letter] = rule_info("suffix_letter", "/[=!?]/")
2038
+ Rules[:_letter] = rule_info("letter", "(upcase_letter | downcase_letter)")
2039
+ Rules[:_id_symbol] = rule_info("id_symbol", "(letter | \"_\" | [0-9])")
2040
+ Rules[:_vm_identifier] = rule_info("vm_identifier", "< (downcase_letter | \"_\") id_symbol* suffix_letter? > { SymbolEntry.new(:variable, text) }")
2041
+ Rules[:_variable_identifier] = rule_info("variable_identifier", "< (downcase_letter | \"_\") id_symbol* > { SymbolEntry.new(:variable, text) }")
2042
+ Rules[:_constant_identifier] = rule_info("constant_identifier", "< upcase_letter id_symbol* > { SymbolEntry.new(:constant, text) }")
2043
+ Rules[:_global_identifier] = rule_info("global_identifier", "< \"$\" (constant_identifier | variable_identifier) > { SymbolEntry.new(:global, text) }")
2044
+ Rules[:_local_internal_identifier] = rule_info("local_internal_identifier", "(constant_identifier | variable_identifier)")
2045
+ Rules[:_local_identifier] = rule_info("local_identifier", "(constant_identifier | vm_identifier)")
2046
+ Rules[:_instance_identifier] = rule_info("instance_identifier", "< \"@\" local_identifier > { SymbolEntry.new(:instance, text) }")
2047
+ Rules[:_classvar_identifier] = rule_info("classvar_identifier", "\"@@\" local_identifier:id { SymbolEntry.new(:classvar, id) }")
2048
+ Rules[:_identifier] = rule_info("identifier", "(global_identifier | instance_identifier | classvar_identifier | local_identifier)")
2049
+ Rules[:_id_separator] = rule_info("id_separator", "< (\"::\" | \".\") > { text }")
2050
+ Rules[:_internal_class_module_chain] = rule_info("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)")
2051
+ Rules[:_class_module_chain] = rule_info("class_module_chain", "(< identifier:parent id_separator:sep internal_class_module_chain:child > { SymbolEntry.new(parent.type, text, [parent, child, sep]) } | identifier)")
2052
+ Rules[:_sp] = rule_info("sp", "/[ \\t]/")
2053
+ Rules[:__hyphen_] = rule_info("-", "sp+")
2054
+ Rules[:_dbl_escapes] = rule_info("dbl_escapes", "(\"\\\\\\\"\" { '\"' } | \"\\\\n\" { \"\\n\" } | \"\\\\t\" { \"\\t\" } | \"\\\\\\\\\" { \"\\\\\" })")
2055
+ Rules[:_escapes] = rule_info("escapes", "(\"\\\\\\\"\" { '\"' } | \"\\\\n\" { \"\\n\" } | \"\\\\t\" { \"\\t\" } | \"\\\\ \" { \" \" } | \"\\\\:\" { \":\" } | \"\\\\\\\\\" { \"\\\\\" })")
2056
+ Rules[:_dbl_seq] = rule_info("dbl_seq", "< /[^\\\\\"]+/ > { text }")
2057
+ Rules[:_dbl_not_quote] = rule_info("dbl_not_quote", "(dbl_escapes | dbl_seq)+:ary { ary }")
2058
+ Rules[:_dbl_string] = rule_info("dbl_string", "\"\\\"\" dbl_not_quote:ary \"\\\"\" { ary.join }")
2059
+ Rules[:_not_space_colon] = rule_info("not_space_colon", "(escapes | < /[^ \\t\\n:]/ > { text })")
2060
+ Rules[:_not_space_colons] = rule_info("not_space_colons", "not_space_colon+:ary { ary.join }")
2061
+ Rules[:_filename] = rule_info("filename", "(dbl_string | not_space_colons)")
2062
+ Rules[:_file_pos_sep] = rule_info("file_pos_sep", "(sp+ | \":\")")
2063
+ Rules[:_integer] = rule_info("integer", "< /[0-9]+/ > { text.to_i }")
2064
+ Rules[:_sinteger] = rule_info("sinteger", "< /[+-]?[0-9]+/ > { text.to_i }")
2065
+ Rules[:_line_number] = rule_info("line_number", "integer")
2066
+ Rules[:_vm_offset] = rule_info("vm_offset", "\"@\" integer:int { Position.new(nil, nil, :offset, int) }")
2067
+ Rules[:_position] = rule_info("position", "(vm_offset | line_number:l { Position.new(nil, nil, :line, l) })")
2068
+ Rules[:_file_colon_line] = rule_info("file_colon_line", "file_no_colon:file &{ File.exist?(file) } \":\" position:pos { Position.new(:file, file, pos.position_type, pos.position) }")
2069
+ Rules[:_location] = rule_info("location", "(position | < filename >:file &{ @file_exists_proc.call(file) } file_pos_sep position:pos { Position.new(:file, file, pos.position_type, pos.position) } | < filename >:file &{ @file_exists_proc.call(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) })")
2070
+ Rules[:_if_unless] = rule_info("if_unless", "< (\"if\" | \"unless\") > { text }")
2071
+ Rules[:_condition] = rule_info("condition", "< /.+/ > { text}")
2072
+ Rules[:_breakpoint_stmt_no_condition] = rule_info("breakpoint_stmt_no_condition", "location:loc { Breakpoint.new(loc, false, 'true') }")
2073
+ Rules[:_breakpoint_stmt] = rule_info("breakpoint_stmt", "(location:loc - if_unless:iu - condition:cond { Breakpoint.new(loc, iu == 'unless', cond) } | breakpoint_stmt_no_condition)")
2074
+ Rules[:_list_special_targets] = rule_info("list_special_targets", "< (\".\" | \"-\") > { text }")
2075
+ Rules[:_list_stmt] = rule_info("list_stmt", "((list_special_targets | location):loc - sinteger:int? { List.new(loc, int) } | (list_special_targets | location):loc { List.new(loc, nil) })")
2076
+ # :startdoc:
2083
2077
  end