build-tool 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,710 @@
1
+ #--
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by rex 1.0.5
4
+ # from lexical definition file "lib/build-tool/cfg/lexer.rex".
5
+ #++
6
+
7
+ require 'racc/parser'
8
+ # vim:ft=ruby
9
+
10
+ #
11
+ ### HEADER
12
+ #
13
+ require 'build-tool/cfg/lexer_base.rb'
14
+
15
+ class BuildTool::Cfg::Lexer < Racc::Parser
16
+ require 'strscan'
17
+
18
+ class ScanError < StandardError ; end
19
+
20
+ attr_reader :lineno
21
+ attr_reader :filename
22
+ attr_accessor :state
23
+
24
+ def scan_setup(str)
25
+ @ss = StringScanner.new(str)
26
+ @lineno = 1
27
+ @state = nil
28
+ end
29
+
30
+ def action
31
+ yield
32
+ end
33
+
34
+ def scan_str(str)
35
+ scan_setup(str)
36
+ do_parse
37
+ end
38
+ alias :scan :scan_str
39
+
40
+ def load_file( filename )
41
+ @filename = filename
42
+ open(filename, "r") do |f|
43
+ scan_setup(f.read)
44
+ end
45
+ end
46
+
47
+ def scan_file( filename )
48
+ load_file(filename)
49
+ do_parse
50
+ end
51
+
52
+
53
+ def next_token
54
+ return if @ss.eos?
55
+
56
+ # skips empty actions
57
+ until token = _next_token or @ss.eos?; end
58
+ token
59
+ end
60
+
61
+ def _next_token
62
+ text = @ss.peek(1)
63
+ @lineno += 1 if text == "\n"
64
+ token = case @state
65
+ when nil
66
+ case
67
+ when (text = @ss.scan(/log-directory\b/))
68
+ action { [ :LOG_DIRECTORY, text ]; }
69
+
70
+ when (text = @ss.scan(/include\b/))
71
+ action { [ :INCLUDE, text ]; }
72
+
73
+ when (text = @ss.scan(/feature\b/))
74
+ action { [ :FEATURE, text ]; }
75
+
76
+ when (text = @ss.scan(/long\b/))
77
+ action { [ :LONG, text ]; }
78
+
79
+ when (text = @ss.scan(/short\b/))
80
+ action { [ :SHORT, text ]; }
81
+
82
+ when (text = @ss.scan(/description\b/))
83
+ action { [ :DESCRIPTION, text ]; }
84
+
85
+ when (text = @ss.scan(/end\b/))
86
+ action { [ :END, text ]; }
87
+
88
+ when (text = @ss.scan(/enable\b/))
89
+ action { @states.push @state; @state = :ENABLE; [:ENABLE, text]; }
90
+
91
+ when (text = @ss.scan(/disable\b/))
92
+ action { @states.push @state; @state = :DISABLE; [:DISABLE, text]; }
93
+
94
+ when (text = @ss.scan(/vcs\b/))
95
+ action { @states.push @state; @state = :VCS; [:VCS, text]; }
96
+
97
+ when (text = @ss.scan(/build-system\b/))
98
+ action { @states.push @state; @state = :BUILD_SYSTEM; [:BUILD_SYSTEM, text]; }
99
+
100
+ when (text = @ss.scan(/server\b/))
101
+ action { @states.push @state; @state = :SERVER; [:SERVER, text]; }
102
+
103
+ when (text = @ss.scan(/environment\b/))
104
+ action { @states.push @state; @state = :ENVIRONMENT; [:ENVIRONMENT, text]; }
105
+
106
+ when (text = @ss.scan(/module\b/))
107
+ action { @states.push @state; @state = :MODULE; [:MODULE, text]; }
108
+
109
+ when (text = @ss.scan(/repository\b/))
110
+ action { @states.push @state; @state = :REPOSITORY; [:REPOSITORY, text]; }
111
+
112
+ when (text = @ss.scan(/ssh-key\b/))
113
+ action { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
114
+
115
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
116
+ action { [:STRING, @ss[1]]; }
117
+
118
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
119
+ action { [:TOKEN, text]; }
120
+
121
+ when (text = @ss.scan(/\#[^\r\n]*/))
122
+ action { [:COMMENT, text]; }
123
+
124
+ when (text = @ss.scan(/[ \t]+/))
125
+ action { [:IGNORE, text]; }
126
+
127
+ when (text = @ss.scan(/[\r\n]/))
128
+ action { [:IGNORE, text]; }
129
+
130
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
131
+ action { [:GARBAGE, text]; }
132
+
133
+ when (text = @ss.scan(/./))
134
+ action { [:GARBAGE, text]; }
135
+
136
+ else
137
+ text = @ss.string[@ss.pos .. -1]
138
+ raise ScanError, "can not match: '" + text + "'"
139
+ end # if
140
+
141
+ when :ARCHIVE
142
+ case
143
+ when (text = @ss.scan(/end\b/))
144
+ action { @state = @states.pop; [ :END, text ]; }
145
+
146
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
147
+ action { [:STRING, @ss[1]]; }
148
+
149
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
150
+ action { [:TOKEN, text]; }
151
+
152
+ when (text = @ss.scan(/\#[^\r\n]*/))
153
+ action { [:COMMENT, text]; }
154
+
155
+ when (text = @ss.scan(/[ \t]+/))
156
+ action { [:IGNORE, text]; }
157
+
158
+ when (text = @ss.scan(/[\r\n]/))
159
+ action { [:IGNORE, text]; }
160
+
161
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
162
+ action { [:GARBAGE, text]; }
163
+
164
+ when (text = @ss.scan(/./))
165
+ action { [:GARBAGE, text]; }
166
+
167
+ else
168
+ text = @ss.string[@ss.pos .. -1]
169
+ raise ScanError, "can not match: '" + text + "'"
170
+ end # if
171
+
172
+ when :BUILD_SYSTEM
173
+ case
174
+ when (text = @ss.scan(/option/))
175
+ action { [:OPTION, text]; }
176
+
177
+ when (text = @ss.scan(/prepend/))
178
+ action { [:PREPEND, text]; }
179
+
180
+ when (text = @ss.scan(/append/))
181
+ action { [:APPEND, text]; }
182
+
183
+ when (text = @ss.scan(/set/))
184
+ action { [:SET, text]; }
185
+
186
+ when (text = @ss.scan(/inplace/))
187
+ action { [:INPLACE, text]; }
188
+
189
+ when (text = @ss.scan(/end\b/))
190
+ action { @state = @states.pop; [ :END, text ]; }
191
+
192
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
193
+ action { [:STRING, @ss[1]]; }
194
+
195
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
196
+ action { [:TOKEN, text]; }
197
+
198
+ when (text = @ss.scan(/\#[^\r\n]*/))
199
+ action { [:COMMENT, text]; }
200
+
201
+ when (text = @ss.scan(/[ \t]+/))
202
+ action { [:IGNORE, text]; }
203
+
204
+ when (text = @ss.scan(/[\r\n]/))
205
+ action { [:IGNORE, text]; }
206
+
207
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
208
+ action { [:GARBAGE, text]; }
209
+
210
+ when (text = @ss.scan(/./))
211
+ action { [:GARBAGE, text]; }
212
+
213
+ else
214
+ text = @ss.string[@ss.pos .. -1]
215
+ raise ScanError, "can not match: '" + text + "'"
216
+ end # if
217
+
218
+ when :DISABLE
219
+ case
220
+ when (text = @ss.scan(/feature\b/))
221
+ action { @state = @states.pop; [:FEATURE, text]; }
222
+
223
+ when (text = @ss.scan(/module\b/))
224
+ action { @state = @states.pop; [:MODULE, text]; }
225
+
226
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
227
+ action { [:STRING, @ss[1]]; }
228
+
229
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
230
+ action { [:TOKEN, text]; }
231
+
232
+ when (text = @ss.scan(/\#[^\r\n]*/))
233
+ action { [:COMMENT, text]; }
234
+
235
+ when (text = @ss.scan(/[ \t]+/))
236
+ action { [:IGNORE, text]; }
237
+
238
+ when (text = @ss.scan(/[\r\n]/))
239
+ action { [:IGNORE, text]; }
240
+
241
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
242
+ action { [:GARBAGE, text]; }
243
+
244
+ when (text = @ss.scan(/./))
245
+ action { [:GARBAGE, text]; }
246
+
247
+ else
248
+ text = @ss.string[@ss.pos .. -1]
249
+ raise ScanError, "can not match: '" + text + "'"
250
+ end # if
251
+
252
+ when :ENABLE
253
+ case
254
+ when (text = @ss.scan(/feature\b/))
255
+ action { @state = @states.pop; [:FEATURE, text]; }
256
+
257
+ when (text = @ss.scan(/module\b/))
258
+ action { @state = @states.pop; [:MODULE, text]; }
259
+
260
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
261
+ action { [:STRING, @ss[1]]; }
262
+
263
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
264
+ action { [:TOKEN, text]; }
265
+
266
+ when (text = @ss.scan(/\#[^\r\n]*/))
267
+ action { [:COMMENT, text]; }
268
+
269
+ when (text = @ss.scan(/[ \t]+/))
270
+ action { [:IGNORE, text]; }
271
+
272
+ when (text = @ss.scan(/[\r\n]/))
273
+ action { [:IGNORE, text]; }
274
+
275
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
276
+ action { [:GARBAGE, text]; }
277
+
278
+ when (text = @ss.scan(/./))
279
+ action { [:GARBAGE, text]; }
280
+
281
+ else
282
+ text = @ss.string[@ss.pos .. -1]
283
+ raise ScanError, "can not match: '" + text + "'"
284
+ end # if
285
+
286
+ when :ENVIRONMENT
287
+ case
288
+ when (text = @ss.scan(/var\b/))
289
+ action { [:VAR, text] }
290
+
291
+ when (text = @ss.scan(/prepend\b/))
292
+ action { [:PREPEND, text] }
293
+
294
+ when (text = @ss.scan(/append\b/))
295
+ action { [:APPEND, text] }
296
+
297
+ when (text = @ss.scan(/set\b/))
298
+ action { [:SET, text] }
299
+
300
+ when (text = @ss.scan(/</))
301
+ action { [:INHERITANCE, text] }
302
+
303
+ when (text = @ss.scan(/end\b/))
304
+ action { @state = @states.pop; [:END, text] }
305
+
306
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
307
+ action { [:STRING, @ss[1]]; }
308
+
309
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
310
+ action { [:TOKEN, text]; }
311
+
312
+ when (text = @ss.scan(/\#[^\r\n]*/))
313
+ action { [:COMMENT, text]; }
314
+
315
+ when (text = @ss.scan(/[ \t]+/))
316
+ action { [:IGNORE, text]; }
317
+
318
+ when (text = @ss.scan(/[\r\n]/))
319
+ action { [:IGNORE, text]; }
320
+
321
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
322
+ action { [:GARBAGE, text]; }
323
+
324
+ when (text = @ss.scan(/./))
325
+ action { [:GARBAGE, text]; }
326
+
327
+ else
328
+ text = @ss.string[@ss.pos .. -1]
329
+ raise ScanError, "can not match: '" + text + "'"
330
+ end # if
331
+
332
+ when :GIT
333
+ case
334
+ when (text = @ss.scan(/external\b/))
335
+ action { [:EXTERNAL, text]; }
336
+
337
+ when (text = @ss.scan(/track-branch\b/))
338
+ action { [:TRACK_BRANCH, text]; }
339
+
340
+ when (text = @ss.scan(/remote\b/))
341
+ action { @states.push @state; @state = :REPOSITORY; [:REMOTE, text]; }
342
+
343
+ when (text = @ss.scan(/end\b/))
344
+ action { @state = @states.pop; [ :END, text ]; }
345
+
346
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
347
+ action { [:STRING, @ss[1]]; }
348
+
349
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
350
+ action { [:TOKEN, text]; }
351
+
352
+ when (text = @ss.scan(/\#[^\r\n]*/))
353
+ action { [:COMMENT, text]; }
354
+
355
+ when (text = @ss.scan(/[ \t]+/))
356
+ action { [:IGNORE, text]; }
357
+
358
+ when (text = @ss.scan(/[\r\n]/))
359
+ action { [:IGNORE, text]; }
360
+
361
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
362
+ action { [:GARBAGE, text]; }
363
+
364
+ when (text = @ss.scan(/./))
365
+ action { [:GARBAGE, text]; }
366
+
367
+ else
368
+ text = @ss.string[@ss.pos .. -1]
369
+ raise ScanError, "can not match: '" + text + "'"
370
+ end # if
371
+
372
+ when :MODULE
373
+ case
374
+ when (text = @ss.scan(/build-prefix\b/))
375
+ action { [:BUILD_PREFIX, text]; }
376
+
377
+ when (text = @ss.scan(/</))
378
+ action { [:INHERITANCE, text]; }
379
+
380
+ when (text = @ss.scan(/apply\b/))
381
+ action { [:APPLY, text ]; }
382
+
383
+ when (text = @ss.scan(/patch\b/))
384
+ action { [:PATCH, text ]; }
385
+
386
+ when (text = @ss.scan(/long\b/))
387
+ action { [:LONG, text ]; }
388
+
389
+ when (text = @ss.scan(/description\b/))
390
+ action { [:DESCRIPTION, text ]; }
391
+
392
+ when (text = @ss.scan(/install-prefix\b/))
393
+ action { [:INSTALL_PREFIX, text]; }
394
+
395
+ when (text = @ss.scan(/local-path\b/))
396
+ action { [:LOCAL_PATH, text]; }
397
+
398
+ when (text = @ss.scan(/remote-path\b/))
399
+ action { [:REMOTE_PATH, text]; }
400
+
401
+ when (text = @ss.scan(/TEMPLATE\b/))
402
+ action { [:TEMPLATE, text]; }
403
+
404
+ when (text = @ss.scan(/build-system\b/))
405
+ action { @states.push @state; @state = :BUILD_SYSTEM; [:BUILD_SYSTEM, text]; }
406
+
407
+ when (text = @ss.scan(/environment\b/))
408
+ action { @states.push @state; @state = :ENVIRONMENT; [:ENVIRONMENT, text]; }
409
+
410
+ when (text = @ss.scan(/repository\b/))
411
+ action { @states.push @state; @state = :REPOSITORY; [:REPOSITORY, text]; }
412
+
413
+ when (text = @ss.scan(/use\b/))
414
+ action { @states.push @state; @state = :USE; [:USE, text]; }
415
+
416
+ when (text = @ss.scan(/vcs\b/))
417
+ action { @states.push @state; @state = :VCS; [:VCS, text]; }
418
+
419
+ when (text = @ss.scan(/end\b/))
420
+ action { @state = @states.pop; [:END, text]; }
421
+
422
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
423
+ action { [:STRING, @ss[1]]; }
424
+
425
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
426
+ action { [:TOKEN, text]; }
427
+
428
+ when (text = @ss.scan(/\#[^\r\n]*/))
429
+ action { [:COMMENT, text]; }
430
+
431
+ when (text = @ss.scan(/[ \t]+/))
432
+ action { [:IGNORE, text]; }
433
+
434
+ when (text = @ss.scan(/[\r\n]/))
435
+ action { [:IGNORE, text]; }
436
+
437
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
438
+ action { [:GARBAGE, text]; }
439
+
440
+ when (text = @ss.scan(/./))
441
+ action { [:GARBAGE, text]; }
442
+
443
+ else
444
+ text = @ss.string[@ss.pos .. -1]
445
+ raise ScanError, "can not match: '" + text + "'"
446
+ end # if
447
+
448
+ when :REPOSITORY
449
+ case
450
+ when (text = @ss.scan(/path\b/))
451
+ action { [:PATH, text]; }
452
+
453
+ when (text = @ss.scan(/user\b/))
454
+ action { [:USER, text]; }
455
+
456
+ when (text = @ss.scan(/server\b/))
457
+ action { @states.push @state; @state = :SERVER; [:SERVER, text]; }
458
+
459
+ when (text = @ss.scan(/ssh-key\b/))
460
+ action { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
461
+
462
+ when (text = @ss.scan(/use\b/))
463
+ action { @states.push @state; @state = :USE; [:USE, text]; }
464
+
465
+ when (text = @ss.scan(/end\b/))
466
+ action { @state = @states.pop; [:END, text]; }
467
+
468
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
469
+ action { [:STRING, @ss[1]]; }
470
+
471
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
472
+ action { [:TOKEN, text]; }
473
+
474
+ when (text = @ss.scan(/\#[^\r\n]*/))
475
+ action { [:COMMENT, text]; }
476
+
477
+ when (text = @ss.scan(/[ \t]+/))
478
+ action { [:IGNORE, text]; }
479
+
480
+ when (text = @ss.scan(/[\r\n]/))
481
+ action { [:IGNORE, text]; }
482
+
483
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
484
+ action { [:GARBAGE, text]; }
485
+
486
+ when (text = @ss.scan(/./))
487
+ action { [:GARBAGE, text]; }
488
+
489
+ else
490
+ text = @ss.string[@ss.pos .. -1]
491
+ raise ScanError, "can not match: '" + text + "'"
492
+ end # if
493
+
494
+ when :SERVER
495
+ case
496
+ when (text = @ss.scan(/protocol\b/))
497
+ action { [:PROTOCOL, text]; }
498
+
499
+ when (text = @ss.scan(/server\b/))
500
+ action { [:SERVER, text]; }
501
+
502
+ when (text = @ss.scan(/path\b/))
503
+ action { [:PATH, text]; }
504
+
505
+ when (text = @ss.scan(/host\b/))
506
+ action { [:HOST, text]; }
507
+
508
+ when (text = @ss.scan(/end\b/))
509
+ action { @state = @states.pop; [:END, text]; }
510
+
511
+ when (text = @ss.scan(/use\b/))
512
+ action { @states.push @state; @state = :USE; [:USE, text]; }
513
+
514
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
515
+ action { [:STRING, @ss[1]]; }
516
+
517
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
518
+ action { [:TOKEN, text]; }
519
+
520
+ when (text = @ss.scan(/\#[^\r\n]*/))
521
+ action { [:COMMENT, text]; }
522
+
523
+ when (text = @ss.scan(/[ \t]+/))
524
+ action { [:IGNORE, text]; }
525
+
526
+ when (text = @ss.scan(/[\r\n]/))
527
+ action { [:IGNORE, text]; }
528
+
529
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
530
+ action { [:GARBAGE, text]; }
531
+
532
+ when (text = @ss.scan(/./))
533
+ action { [:GARBAGE, text]; }
534
+
535
+ else
536
+ text = @ss.string[@ss.pos .. -1]
537
+ raise ScanError, "can not match: '" + text + "'"
538
+ end # if
539
+
540
+ when :SSH_KEY
541
+ case
542
+ when (text = @ss.scan(/file\b/))
543
+ action { [:FILE, text]; }
544
+
545
+ when (text = @ss.scan(/end\b/))
546
+ action { @state = @states.pop; [:END, text]; }
547
+
548
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
549
+ action { [:STRING, @ss[1]]; }
550
+
551
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
552
+ action { [:TOKEN, text]; }
553
+
554
+ when (text = @ss.scan(/\#[^\r\n]*/))
555
+ action { [:COMMENT, text]; }
556
+
557
+ when (text = @ss.scan(/[ \t]+/))
558
+ action { [:IGNORE, text]; }
559
+
560
+ when (text = @ss.scan(/[\r\n]/))
561
+ action { [:IGNORE, text]; }
562
+
563
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
564
+ action { [:GARBAGE, text]; }
565
+
566
+ when (text = @ss.scan(/./))
567
+ action { [:GARBAGE, text]; }
568
+
569
+ else
570
+ text = @ss.string[@ss.pos .. -1]
571
+ raise ScanError, "can not match: '" + text + "'"
572
+ end # if
573
+
574
+ when :SVN
575
+ case
576
+ when (text = @ss.scan(/only\b/))
577
+ action { [:ONLY, text]; }
578
+
579
+ when (text = @ss.scan(/end\b/))
580
+ action { @state = @states.pop; [ :END, text ]; }
581
+
582
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
583
+ action { [:STRING, @ss[1]]; }
584
+
585
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
586
+ action { [:TOKEN, text]; }
587
+
588
+ when (text = @ss.scan(/\#[^\r\n]*/))
589
+ action { [:COMMENT, text]; }
590
+
591
+ when (text = @ss.scan(/[ \t]+/))
592
+ action { [:IGNORE, text]; }
593
+
594
+ when (text = @ss.scan(/[\r\n]/))
595
+ action { [:IGNORE, text]; }
596
+
597
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
598
+ action { [:GARBAGE, text]; }
599
+
600
+ when (text = @ss.scan(/./))
601
+ action { [:GARBAGE, text]; }
602
+
603
+ else
604
+ text = @ss.string[@ss.pos .. -1]
605
+ raise ScanError, "can not match: '" + text + "'"
606
+ end # if
607
+
608
+ when :USE
609
+ case
610
+ when (text = @ss.scan(/build-system\b/))
611
+ action { @state = @states.pop; [:BUILD_SYSTEM, text]; }
612
+
613
+ when (text = @ss.scan(/environment\b/))
614
+ action { @state = @states.pop; [:ENVIRONMENT, text]; }
615
+
616
+ when (text = @ss.scan(/repository\b/))
617
+ action { @state = @states.pop; [:REPOSITORY, text]; }
618
+
619
+ when (text = @ss.scan(/server\b/))
620
+ action { @state = @states.pop; [:SERVER, text]; }
621
+
622
+ when (text = @ss.scan(/ssh-key\b/))
623
+ action { @state = @states.pop; [:SSH_KEY, text]; }
624
+
625
+ when (text = @ss.scan(/vcs\b/))
626
+ action { @state = @states.pop; [:VCS, text]; }
627
+
628
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
629
+ action { [:STRING, @ss[1]]; }
630
+
631
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
632
+ action { [:TOKEN, text]; }
633
+
634
+ when (text = @ss.scan(/\#[^\r\n]*/))
635
+ action { [:COMMENT, text]; }
636
+
637
+ when (text = @ss.scan(/[ \t]+/))
638
+ action { [:IGNORE, text]; }
639
+
640
+ when (text = @ss.scan(/[\r\n]/))
641
+ action { [:IGNORE, text]; }
642
+
643
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
644
+ action { [:GARBAGE, text]; }
645
+
646
+ when (text = @ss.scan(/./))
647
+ action { [:GARBAGE, text]; }
648
+
649
+ else
650
+ text = @ss.string[@ss.pos .. -1]
651
+ raise ScanError, "can not match: '" + text + "'"
652
+ end # if
653
+
654
+ when :VCS
655
+ case
656
+ when (text = @ss.scan(/git-svn\b/))
657
+ action { @state = :GIT; [:GIT_SVN, text]; }
658
+
659
+ when (text = @ss.scan(/git\b/))
660
+ action { @state = :GIT; [:GIT, text]; }
661
+
662
+ when (text = @ss.scan(/svn\b/))
663
+ action { @state = :SVN; [:SVN, text]; }
664
+
665
+ when (text = @ss.scan(/archive\b/))
666
+ action { @state = :ARCHIVE; [:ARCHIVE, text]; }
667
+
668
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
669
+ action { [:STRING, @ss[1]]; }
670
+
671
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
672
+ action { [:TOKEN, text]; }
673
+
674
+ when (text = @ss.scan(/\#[^\r\n]*/))
675
+ action { [:COMMENT, text]; }
676
+
677
+ when (text = @ss.scan(/[ \t]+/))
678
+ action { [:IGNORE, text]; }
679
+
680
+ when (text = @ss.scan(/[\r\n]/))
681
+ action { [:IGNORE, text]; }
682
+
683
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
684
+ action { [:GARBAGE, text]; }
685
+
686
+ when (text = @ss.scan(/./))
687
+ action { [:GARBAGE, text]; }
688
+
689
+ else
690
+ text = @ss.string[@ss.pos .. -1]
691
+ raise ScanError, "can not match: '" + text + "'"
692
+ end # if
693
+
694
+ else
695
+ raise ScanError, "undefined state: '" + state.to_s + "'"
696
+ end # case state
697
+ token
698
+ end # def _next_token
699
+
700
+ include LexerBase
701
+ def do_parse
702
+ @states = []
703
+ super
704
+ end
705
+ end # class
706
+
707
+ #
708
+ ### FOOTER
709
+ #
710
+