rexical 1.0.4 → 1.0.5.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rexical might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +6 -0
- data/lib/rexical.rb +1 -1
- data/lib/rexical/generator.rb +2 -11
- data/lib/rexical/rexcmd.rb +4 -4
- data/test/rex-20060125.rb +2 -2
- data/test/rex-20060511.rb +2 -2
- data/test/test_generator.rb +14 -0
- metadata +49 -12
data/CHANGELOG.rdoc
CHANGED
data/lib/rexical.rb
CHANGED
data/lib/rexical/generator.rb
CHANGED
@@ -151,13 +151,7 @@ module Rexical
|
|
151
151
|
if ss.scan(/class/)
|
152
152
|
state1 = :CLASS
|
153
153
|
st = ss.post_match.strip
|
154
|
-
|
155
|
-
@module_name = $1
|
156
|
-
@class_name = $2
|
157
|
-
else
|
158
|
-
@module_name = nil
|
159
|
-
@class_name = st
|
160
|
-
end
|
154
|
+
@class_name = st
|
161
155
|
else
|
162
156
|
add_header st
|
163
157
|
end
|
@@ -333,6 +327,7 @@ REX_UTIL = <<-REX_EOT
|
|
333
327
|
scan_setup(str)
|
334
328
|
do_parse
|
335
329
|
end
|
330
|
+
alias :scan :scan_str
|
336
331
|
|
337
332
|
def load_file( filename )
|
338
333
|
@filename = filename
|
@@ -390,9 +385,6 @@ REX_EOT
|
|
390
385
|
@scanner_header.each_line do |s|
|
391
386
|
f.print s
|
392
387
|
end
|
393
|
-
if @module_name
|
394
|
-
f.puts "module #{@module_name}"
|
395
|
-
end
|
396
388
|
if @opt['--independent']
|
397
389
|
f.puts "class #{@class_name}"
|
398
390
|
else
|
@@ -484,7 +476,6 @@ REX_EOT
|
|
484
476
|
f.print s
|
485
477
|
end
|
486
478
|
f.puts "end # class"
|
487
|
-
f.puts "end # module" if @module_name
|
488
479
|
|
489
480
|
## footer
|
490
481
|
@scanner_footer.each_line do |s|
|
data/lib/rexical/rexcmd.rb
CHANGED
@@ -63,7 +63,7 @@ EOT
|
|
63
63
|
def initialize
|
64
64
|
@status = 2
|
65
65
|
@cmd = File.basename($0, ".rb")
|
66
|
-
tmp = OPTIONS.collect do |line|
|
66
|
+
tmp = OPTIONS.lines.collect do |line|
|
67
67
|
next if /\A\s*\z/ === line
|
68
68
|
disp, sopt, lopt, takearg, doc = line.strip.split(/\s+/, 5)
|
69
69
|
a = []
|
@@ -91,11 +91,11 @@ EOT
|
|
91
91
|
usage if @opt['--help']
|
92
92
|
|
93
93
|
if @opt['--version']
|
94
|
-
puts "#{@cmd} version #{Rexical::
|
94
|
+
puts "#{@cmd} version #{Rexical::VERSION}"
|
95
95
|
exit 0
|
96
96
|
end
|
97
97
|
if @opt['--copyright']
|
98
|
-
puts "#{@cmd} version #{Rexical::
|
98
|
+
puts "#{@cmd} version #{Rexical::VERSION}"
|
99
99
|
puts "#{Rexical::Copyright} <#{Rexical::Mailto}>"
|
100
100
|
exit 0
|
101
101
|
end
|
@@ -109,7 +109,7 @@ Usage: #{@cmd} [options] <grammar file>
|
|
109
109
|
Options:
|
110
110
|
EOT
|
111
111
|
|
112
|
-
OPTIONS.
|
112
|
+
OPTIONS.each_line do |line|
|
113
113
|
next if line.strip.empty?
|
114
114
|
if /\A\s*\z/ === line
|
115
115
|
f.puts
|
data/test/rex-20060125.rb
CHANGED
@@ -99,11 +99,11 @@ def get_options
|
|
99
99
|
usage if opt['--help']
|
100
100
|
|
101
101
|
if opt['--version']
|
102
|
-
puts "#{$cmd} version #{Rex::
|
102
|
+
puts "#{$cmd} version #{Rex::VERSION}"
|
103
103
|
exit 0
|
104
104
|
end
|
105
105
|
if opt['--copyright']
|
106
|
-
puts "#{$cmd} version #{Rex::
|
106
|
+
puts "#{$cmd} version #{Rex::VERSION}"
|
107
107
|
puts "#{Rex::Copyright} <#{Rex::Mailto}>"
|
108
108
|
exit 0
|
109
109
|
end
|
data/test/rex-20060511.rb
CHANGED
@@ -97,11 +97,11 @@ class RexRunner
|
|
97
97
|
usage if @opt['--help']
|
98
98
|
|
99
99
|
if @opt['--version']
|
100
|
-
puts "#{@cmd} version #{Rex::
|
100
|
+
puts "#{@cmd} version #{Rex::VERSION}"
|
101
101
|
exit 0
|
102
102
|
end
|
103
103
|
if @opt['--copyright']
|
104
|
-
puts "#{@cmd} version #{Rex::
|
104
|
+
puts "#{@cmd} version #{Rex::VERSION}"
|
105
105
|
puts "#{Rex::Copyright} <#{Rex::Mailto}>"
|
106
106
|
exit 0
|
107
107
|
end
|
data/test/test_generator.rb
CHANGED
@@ -33,6 +33,20 @@ class TestGenerator < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def test_scanner_nests_classes
|
37
|
+
source = parse_lexer %q{
|
38
|
+
module Foo
|
39
|
+
class Baz::Calculator < Bar
|
40
|
+
rule
|
41
|
+
\d+ { [:NUMBER, text.to_i] }
|
42
|
+
\s+ { [:S, text] }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
}
|
46
|
+
|
47
|
+
assert_match 'Baz::Calculator < Bar', source
|
48
|
+
end
|
49
|
+
|
36
50
|
def test_scanner_inherits
|
37
51
|
source = parse_lexer %q{
|
38
52
|
class Calculator < Bar
|
metadata
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: -1848230071
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
- beta1
|
11
|
+
version: 1.0.5.beta1
|
5
12
|
platform: ruby
|
6
13
|
authors:
|
7
14
|
- Aaron Patterson
|
@@ -9,19 +16,41 @@ autorequire:
|
|
9
16
|
bindir: bin
|
10
17
|
cert_chain: []
|
11
18
|
|
12
|
-
date:
|
19
|
+
date: 2010-06-15 00:00:00 -07:00
|
13
20
|
default_executable:
|
14
21
|
dependencies:
|
15
22
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
23
|
+
name: rubyforge
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 7
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 4
|
35
|
+
version: 2.0.4
|
17
36
|
type: :development
|
18
|
-
|
19
|
-
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: hoe
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
20
43
|
requirements:
|
21
44
|
- - ">="
|
22
45
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
46
|
+
hash: 23
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 6
|
50
|
+
- 0
|
51
|
+
version: 2.6.0
|
52
|
+
type: :development
|
53
|
+
version_requirements: *id002
|
25
54
|
description: |-
|
26
55
|
Rexical is a lexical scanner generator.
|
27
56
|
It is written in Ruby itself, and generates Ruby program.
|
@@ -86,21 +115,29 @@ rdoc_options:
|
|
86
115
|
require_paths:
|
87
116
|
- lib
|
88
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
89
119
|
requirements:
|
90
120
|
- - ">="
|
91
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
92
125
|
version: "0"
|
93
|
-
version:
|
94
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
95
128
|
requirements:
|
96
|
-
- - "
|
129
|
+
- - ">"
|
97
130
|
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
131
|
+
hash: 25
|
132
|
+
segments:
|
133
|
+
- 1
|
134
|
+
- 3
|
135
|
+
- 1
|
136
|
+
version: 1.3.1
|
100
137
|
requirements: []
|
101
138
|
|
102
139
|
rubyforge_project: ruby-rex
|
103
|
-
rubygems_version: 1.3.
|
140
|
+
rubygems_version: 1.3.7
|
104
141
|
signing_key:
|
105
142
|
specification_version: 3
|
106
143
|
summary: Rexical is a lexical scanner generator
|