redparse 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +33 -2
- data/Manifest.txt +2 -3
- data/README.txt +157 -265
- data/Rakefile +13 -4
- data/bin/redparse +3 -2
- data/lib/redparse.rb +2423 -489
- data/lib/redparse/generate.rb +378 -0
- data/lib/redparse/node.rb +1497 -620
- data/lib/redparse/reg_more_sugar.rb +21 -0
- data/lib/redparse/version.rb +1 -1
- data/test/data/def_spec.rb +2 -0
- data/test/rp-locatetest.rb +2 -1
- data/test/test_redparse.rb +594 -61
- metadata +17 -8
- data/nurli/test_control.nurli +0 -261
- data/redparse.vpj +0 -92
- data/redparse.vpw +0 -8
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redparse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Clausen
|
8
8
|
autorequire:
|
9
|
-
bindir: bin
|
9
|
+
bindir: bin/
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.7.
|
23
|
+
version: 0.7.4
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: reg
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.4.7
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: Ron
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
35
45
|
- !ruby/object:Gem::Dependency
|
36
46
|
name: hoe
|
37
47
|
type: :development
|
@@ -92,12 +102,11 @@ files:
|
|
92
102
|
- History.txt
|
93
103
|
- Rakefile
|
94
104
|
- COPYING.LGPL
|
95
|
-
- nurli/test_control.nurli
|
96
|
-
- redparse.vpj
|
97
|
-
- redparse.vpw
|
98
105
|
- bin/redparse
|
106
|
+
- lib/redparse/generate.rb
|
107
|
+
- test/data/def_spec.rb
|
99
108
|
has_rdoc: true
|
100
|
-
homepage: http://
|
109
|
+
homepage: http://github.com/coatl/redparse/
|
101
110
|
post_install_message:
|
102
111
|
rdoc_options:
|
103
112
|
- --main
|
data/nurli/test_control.nurli
DELETED
@@ -1,261 +0,0 @@
|
|
1
|
-
#;; test_control.nurli
|
2
|
-
#;; tests for Nurli control structures.
|
3
|
-
#;;
|
4
|
-
#;; Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
|
5
|
-
#(converted from nu to nurli by caleb clausen)
|
6
|
-
|
7
|
-
load "test"
|
8
|
-
|
9
|
-
class TestControl < NuTestCase
|
10
|
-
|
11
|
-
def testIf #(id)
|
12
|
-
x=0
|
13
|
-
if x==0 then y=0; y+=1
|
14
|
-
y+=1
|
15
|
-
else if x==1 then y=10; y+=1
|
16
|
-
y+=1
|
17
|
-
else y=100; y+=1
|
18
|
-
end
|
19
|
-
end
|
20
|
-
assert_equal 2, y
|
21
|
-
|
22
|
-
x=1
|
23
|
-
if x==0 then y=0; y+=1
|
24
|
-
y+=1
|
25
|
-
else if x==1 then y=10; y+=1
|
26
|
-
y+=1
|
27
|
-
else y=100; y+=1
|
28
|
-
end
|
29
|
-
end
|
30
|
-
assert_equal 12, y
|
31
|
-
|
32
|
-
x=2
|
33
|
-
if x==0 then y=0; y+=1
|
34
|
-
y+=1
|
35
|
-
else if x==1 then y=10; y+=1
|
36
|
-
y+=1
|
37
|
-
else y=100; y+=1
|
38
|
-
end
|
39
|
-
end
|
40
|
-
assert_equal 101, y
|
41
|
-
end
|
42
|
-
|
43
|
-
def testUnless #(id)
|
44
|
-
x=0
|
45
|
-
unless x!=0 then y=0; y+=1
|
46
|
-
y+=1
|
47
|
-
else unless x!=1 then y=10; y+=1
|
48
|
-
y+=1
|
49
|
-
else y=100; y+=1
|
50
|
-
end
|
51
|
-
end
|
52
|
-
assert_equal 2, y
|
53
|
-
|
54
|
-
x=1
|
55
|
-
unless x!=0 then y=0; y+=1
|
56
|
-
y+=1
|
57
|
-
else unless x!=1 then y=10; y+=1
|
58
|
-
y+=1
|
59
|
-
else y=100; y+=1
|
60
|
-
end
|
61
|
-
end
|
62
|
-
assert_equal 12, y
|
63
|
-
|
64
|
-
x=2
|
65
|
-
unless x!=0 then y=0; y+=1
|
66
|
-
y+=1
|
67
|
-
else unless x!=1 then y=10; y+=1
|
68
|
-
y+=1
|
69
|
-
else y=100; y+=1
|
70
|
-
end
|
71
|
-
end
|
72
|
-
assert_equal 101, y
|
73
|
-
end
|
74
|
-
|
75
|
-
def testWhile #(id)
|
76
|
-
x=10
|
77
|
-
y=0
|
78
|
-
while x
|
79
|
-
y+=x
|
80
|
-
x-=1
|
81
|
-
end
|
82
|
-
assert_equal 55,y
|
83
|
-
end
|
84
|
-
|
85
|
-
def testUntil #(id)
|
86
|
-
x=10
|
87
|
-
y=0
|
88
|
-
until x==0
|
89
|
-
y+=x
|
90
|
-
x-=1
|
91
|
-
end
|
92
|
-
assert_equal 55,y
|
93
|
-
end
|
94
|
-
|
95
|
-
def testWhileBreak #(id)
|
96
|
-
$count=0
|
97
|
-
x=10
|
98
|
-
while(x!=0)
|
99
|
-
x-=1
|
100
|
-
y=10
|
101
|
-
while(y!=0)
|
102
|
-
y-=1
|
103
|
-
$count+=1
|
104
|
-
break if y==5
|
105
|
-
end
|
106
|
-
end
|
107
|
-
assert_equal 50, $count
|
108
|
-
end
|
109
|
-
|
110
|
-
def testWhileContinue #(id)
|
111
|
-
$count=0
|
112
|
-
x=10
|
113
|
-
while(x!=0)
|
114
|
-
x-=1
|
115
|
-
y=10
|
116
|
-
while(y!=0)
|
117
|
-
y-=1
|
118
|
-
continue if y>=5
|
119
|
-
$count+=1
|
120
|
-
end
|
121
|
-
end
|
122
|
-
assert_equal 50, $count
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
def testUntilBreak #(id)
|
127
|
-
$count=0
|
128
|
-
x=10
|
129
|
-
until(x==0)
|
130
|
-
x-=1
|
131
|
-
y=10
|
132
|
-
until(y==0)
|
133
|
-
y-=1
|
134
|
-
$count+=1
|
135
|
-
break if y==5
|
136
|
-
end
|
137
|
-
end
|
138
|
-
assert_equal 50, $count
|
139
|
-
end
|
140
|
-
|
141
|
-
def testUntilContinue #(id)
|
142
|
-
$count=0
|
143
|
-
x=10
|
144
|
-
until(x==0)
|
145
|
-
x-=1
|
146
|
-
y=10
|
147
|
-
until(y==0)
|
148
|
-
y-=1
|
149
|
-
continue if y>=5
|
150
|
-
$count+=1
|
151
|
-
end
|
152
|
-
end
|
153
|
-
assert_equal 50, $count
|
154
|
-
end
|
155
|
-
|
156
|
-
=begin cant do these yet, sorry
|
157
|
-
(imethod (id) testLoopMacro is
|
158
|
-
;; here is a simple macro defining an unending loop
|
159
|
-
(macro loop (eval (append '(while t) margs)))
|
160
|
-
;; here's a macro that decrements a named value
|
161
|
-
(macro decrement (set (unquote (margs car)) (- (unquote (margs car)) 1)))
|
162
|
-
;; here's a macro that increments a named value
|
163
|
-
(macro increment (set (unquote (margs car)) (+ (unquote (margs car)) 1)))
|
164
|
-
;; run the loop, breaking out after 5 iterations
|
165
|
-
(set count 0)
|
166
|
-
(set x 10)
|
167
|
-
(loop
|
168
|
-
(decrement x)
|
169
|
-
(increment count)
|
170
|
-
(if (eq x 5) (break)))
|
171
|
-
(assert_equal 5 count)
|
172
|
-
;; run the loop, breaking out after 10 iterations
|
173
|
-
;; but only counting until the loop counter (x) drops below 5
|
174
|
-
(set count 0)
|
175
|
-
(set x 10)
|
176
|
-
(loop
|
177
|
-
(decrement x)
|
178
|
-
(if (eq x 0) (break))
|
179
|
-
(if (< x 5) (continue))
|
180
|
-
(increment count))
|
181
|
-
(assert_equal 5 count))
|
182
|
-
|
183
|
-
(imethod (id) testFor is
|
184
|
-
(set x 0)
|
185
|
-
(for ((set i 1) (< i 10) (set i (+ i 1)))
|
186
|
-
(set x (+ x i)))
|
187
|
-
(assert_equal 45 x))
|
188
|
-
|
189
|
-
(imethod (id) testForBreak is
|
190
|
-
(set x 0)
|
191
|
-
(for ((set i 1) (< i 10) (set i (+ i 1)))
|
192
|
-
(if (== i 6) (break))
|
193
|
-
(set x (+ x i)))
|
194
|
-
(assert_equal 15 x))
|
195
|
-
|
196
|
-
(imethod (id) testForContinue is
|
197
|
-
(set x 0)
|
198
|
-
(for ((set i 1) (< i 10) (set i (+ i 1)))
|
199
|
-
(if (== i 6) (continue))
|
200
|
-
(set x (+ x i)))
|
201
|
-
(assert_equal 39 x))
|
202
|
-
=end
|
203
|
-
|
204
|
-
def testCond #(id)
|
205
|
-
x=0
|
206
|
-
assert_equal 1,
|
207
|
-
if x==0: y=0; y+=1
|
208
|
-
elsif x==1: y=10; y+=1
|
209
|
-
else y=100; y+=1
|
210
|
-
end
|
211
|
-
|
212
|
-
x=1
|
213
|
-
assert_equal 11,
|
214
|
-
if x==0: y=0; y+=1
|
215
|
-
elsif x==1: y=10; y+=1
|
216
|
-
else y=100; y+=1
|
217
|
-
end
|
218
|
-
|
219
|
-
x=2
|
220
|
-
assert_equal 101,
|
221
|
-
if x==0: y=0; y+=1
|
222
|
-
elsif x==1: y=10; y+=1
|
223
|
-
else y=100; y+=1
|
224
|
-
end
|
225
|
-
|
226
|
-
# ;; test fallthrough
|
227
|
-
|
228
|
-
assert_equal(1,(if 1; 1 else 2 end))
|
229
|
-
assert_equal(1,(if 0; 0 elsif 1; 1 else 2 end))
|
230
|
-
assert_equal(2,(if 0; 0 elsif 0; 0 else 2 end))
|
231
|
-
end
|
232
|
-
|
233
|
-
def testCase
|
234
|
-
x=0
|
235
|
-
assert_equal 1,
|
236
|
-
case x
|
237
|
-
when 0: y=0;y+=1
|
238
|
-
when 1: y=10;y+=1
|
239
|
-
else y=100;y+=1
|
240
|
-
end
|
241
|
-
|
242
|
-
x=1
|
243
|
-
assert_equal 11,
|
244
|
-
case x
|
245
|
-
when 0: y=0;y+=1
|
246
|
-
when 1: y=10;y+=1
|
247
|
-
else y=100;y+=1
|
248
|
-
end
|
249
|
-
|
250
|
-
x=2
|
251
|
-
assert_equal 101,
|
252
|
-
case x
|
253
|
-
when 0: y=0;y+=1
|
254
|
-
when 1: y=10;y+=1
|
255
|
-
else y=100;y+=1
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
|
261
|
-
NuTestCase.runAllTests
|
data/redparse.vpj
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
|
2
|
-
<Project
|
3
|
-
Version="10.0"
|
4
|
-
VendorName="SlickEdit"
|
5
|
-
WorkingDir=".">
|
6
|
-
<Config
|
7
|
-
Name="Release"
|
8
|
-
OutputFile=""
|
9
|
-
CompilerConfigName="Latest Version">
|
10
|
-
<Menu>
|
11
|
-
<Target
|
12
|
-
Name="Compile"
|
13
|
-
MenuCaption="&Compile"
|
14
|
-
CaptureOutputWith="ProcessBuffer"
|
15
|
-
SaveOption="SaveCurrent"
|
16
|
-
RunFromDir="%rw">
|
17
|
-
<Exec/>
|
18
|
-
</Target>
|
19
|
-
<Target
|
20
|
-
Name="Build"
|
21
|
-
MenuCaption="&Build"
|
22
|
-
CaptureOutputWith="ProcessBuffer"
|
23
|
-
SaveOption="SaveWorkspaceFiles"
|
24
|
-
RunFromDir="%rw">
|
25
|
-
<Exec/>
|
26
|
-
</Target>
|
27
|
-
<Target
|
28
|
-
Name="Rebuild"
|
29
|
-
MenuCaption="&Rebuild"
|
30
|
-
CaptureOutputWith="ProcessBuffer"
|
31
|
-
SaveOption="SaveWorkspaceFiles"
|
32
|
-
RunFromDir="%rw">
|
33
|
-
<Exec/>
|
34
|
-
</Target>
|
35
|
-
<Target
|
36
|
-
Name="Debug"
|
37
|
-
MenuCaption="&Debug"
|
38
|
-
SaveOption="SaveNone"
|
39
|
-
RunFromDir="%rw">
|
40
|
-
<Exec/>
|
41
|
-
</Target>
|
42
|
-
<Target
|
43
|
-
Name="Execute"
|
44
|
-
MenuCaption="E&xecute"
|
45
|
-
SaveOption="SaveNone"
|
46
|
-
RunFromDir="%rw">
|
47
|
-
<Exec CmdLine='".exe"'/>
|
48
|
-
</Target>
|
49
|
-
</Menu>
|
50
|
-
</Config>
|
51
|
-
<CustomFolders>
|
52
|
-
<Folder
|
53
|
-
Name="Source Files"
|
54
|
-
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.rb">
|
55
|
-
</Folder>
|
56
|
-
<Folder
|
57
|
-
Name="Header Files"
|
58
|
-
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"/>
|
59
|
-
<Folder
|
60
|
-
Name="Resource Files"
|
61
|
-
Filters="*.ico;*.cur;*.dlg"/>
|
62
|
-
<Folder
|
63
|
-
Name="Bitmaps"
|
64
|
-
Filters="*.bmp"/>
|
65
|
-
<Folder
|
66
|
-
Name="Other Files"
|
67
|
-
Filters="">
|
68
|
-
</Folder>
|
69
|
-
</CustomFolders>
|
70
|
-
<Files AutoFolders="DirectoryView">
|
71
|
-
<Folder Name="bin">
|
72
|
-
<F N="bin/redparse"/>
|
73
|
-
</Folder>
|
74
|
-
<Folder Name="lib">
|
75
|
-
<Folder Name="redparse">
|
76
|
-
<F N="lib/redparse/babynodes.rb"/>
|
77
|
-
<F N="lib/redparse/babyparser.rb"/>
|
78
|
-
<F N="lib/redparse/decisiontree.rb"/>
|
79
|
-
<F N="lib/redparse/node.rb"/>
|
80
|
-
<F N="lib/redparse/reg_more_sugar.rb"/>
|
81
|
-
<F N="lib/redparse/version.rb"/>
|
82
|
-
</Folder>
|
83
|
-
<F N="lib/redparse.rb"/>
|
84
|
-
</Folder>
|
85
|
-
<Folder Name="test">
|
86
|
-
<F N="test/problemfiles.rb"/>
|
87
|
-
<F N="test/rp-locatetest.rb"/>
|
88
|
-
<F N="test/test_redparse.rb"/>
|
89
|
-
</Folder>
|
90
|
-
<F N="README.txt"/>
|
91
|
-
</Files>
|
92
|
-
</Project>
|
data/redparse.vpw
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
|
2
|
-
<Workspace Version="10.0" VendorName="SlickEdit">
|
3
|
-
<Projects>
|
4
|
-
<Project File="redparse.vpj" />
|
5
|
-
<Project File="/rubylexer/rubylexer.vpj" />
|
6
|
-
<Project File="/rubymacros/rubymacros.vpj" />
|
7
|
-
</Projects>
|
8
|
-
</Workspace>
|