waxeye 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +13 -11
- data/lib/waxeye.rb +23 -10
- metadata +3 -3
data/README
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
============================================
|
3
3
|
| Waxeye Parser Generator |
|
4
|
-
| v 0.
|
4
|
+
| v 0.5.0 |
|
5
5
|
| www.waxeye.org |
|
6
6
|
| Copyright (C) 2008 Orlando D. A. R. Hill |
|
7
7
|
============================================
|
@@ -39,8 +39,8 @@ Features
|
|
39
39
|
User Manual
|
40
40
|
===========
|
41
41
|
|
42
|
-
Waxeye's user manual is in 'docs/manual.html'
|
43
|
-
|
42
|
+
Waxeye's user manual is in 'docs/manual.html'. The latest version is also
|
43
|
+
online at http://waxeye.org/manual.html.
|
44
44
|
|
45
45
|
|
46
46
|
Installation
|
@@ -69,18 +69,21 @@ Building
|
|
69
69
|
http://download.plt-scheme.org
|
70
70
|
|
71
71
|
2. Install Waxeye's backend for PLT Scheme.
|
72
|
-
Unix, OSX:
|
72
|
+
Unix, OSX:
|
73
73
|
sudo ln -s /usr/local/waxeye/src/scheme/waxeye /usr/local/plt/lib/plt/collects/
|
74
74
|
|
75
|
-
Windows:
|
76
|
-
Copy the
|
75
|
+
Windows:
|
76
|
+
Copy the directory 'src/scheme/waxeye' into your PLT-Scheme 'collects'
|
77
|
+
directory. For example, that might be 'C:\Program Files\PLT\collects'.
|
77
78
|
|
78
79
|
3. Build Waxeye
|
79
|
-
Unix, OSX:
|
80
|
+
Unix, OSX:
|
80
81
|
./build/unix
|
81
82
|
|
82
|
-
Windows:
|
83
|
-
|
83
|
+
Windows:
|
84
|
+
From your Waxeye installation directory, run the 'build\exe.bat' script in a
|
85
|
+
command prompt. If your PLT-Scheme installation isn't 'C:\Program Files\PLT'
|
86
|
+
then you will need to modify 'build\exe.bat' to use the correct path.
|
84
87
|
|
85
88
|
|
86
89
|
Running
|
@@ -100,8 +103,7 @@ MIT/X11 - All files (except the user manual) are under the permissive MIT/X11
|
|
100
103
|
license.
|
101
104
|
|
102
105
|
GNU FDL - Waxeye's user manual is under the GNU Free Documentation License.
|
103
|
-
This includes
|
104
|
-
'doc/manual.pdf'.
|
106
|
+
This includes the files 'doc/book/book' and 'doc/manual.html'.
|
105
107
|
|
106
108
|
|
107
109
|
Support
|
data/lib/waxeye.rb
CHANGED
@@ -41,11 +41,11 @@ module Waxeye
|
|
41
41
|
end
|
42
42
|
|
43
43
|
class Automaton
|
44
|
-
attr_reader :type, :states, :
|
45
|
-
def initialize(type, states,
|
44
|
+
attr_reader :type, :states, :mode
|
45
|
+
def initialize(type, states, mode)
|
46
46
|
@type = type
|
47
47
|
@states = states
|
48
|
-
@
|
48
|
+
@mode = mode
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -167,7 +167,7 @@ module Waxeye
|
|
167
167
|
automaton = @automata[index]
|
168
168
|
type = automaton.type
|
169
169
|
states = automaton.states
|
170
|
-
|
170
|
+
mode = automaton.mode
|
171
171
|
|
172
172
|
@states_stack.push(states)
|
173
173
|
res = match_state(0)
|
@@ -180,16 +180,28 @@ module Waxeye
|
|
180
180
|
restore_pos(start_pos, start_line, start_col, start_cr)
|
181
181
|
if res
|
182
182
|
update_error()
|
183
|
-
false
|
184
183
|
else
|
185
184
|
true
|
186
185
|
end
|
187
186
|
else
|
188
187
|
if res
|
189
|
-
|
188
|
+
case mode
|
189
|
+
when :void
|
190
|
+
true
|
191
|
+
when :prune
|
192
|
+
case res.length
|
193
|
+
when 0
|
194
|
+
true
|
195
|
+
when 1
|
196
|
+
res[0]
|
197
|
+
else
|
198
|
+
AST.new(type, res, :pos)
|
199
|
+
end
|
200
|
+
else
|
201
|
+
AST.new(type, res, :pos)
|
202
|
+
end
|
190
203
|
else
|
191
204
|
update_error()
|
192
|
-
false
|
193
205
|
end
|
194
206
|
end
|
195
207
|
|
@@ -219,11 +231,11 @@ module Waxeye
|
|
219
231
|
start_cr = @last_cr
|
220
232
|
t = edge.trans
|
221
233
|
res = if t == :_wild
|
222
|
-
@input_pos < @input_len ? mv() :
|
234
|
+
@input_pos < @input_len ? mv() : update_error()
|
223
235
|
elsif t.is_a?(String)
|
224
|
-
@input_pos < @input_len and t[0] == @input[@input_pos] ? mv() :
|
236
|
+
@input_pos < @input_len and t[0] == @input[@input_pos] ? mv() : update_error()
|
225
237
|
elsif t.is_a?(Array)
|
226
|
-
@input_pos < @input_len and within_set?(t, @input[@input_pos]) ? mv() :
|
238
|
+
@input_pos < @input_len and within_set?(t, @input[@input_pos]) ? mv() : update_error()
|
227
239
|
elsif t.is_a?(Integer)
|
228
240
|
match_automaton(t)
|
229
241
|
else
|
@@ -260,6 +272,7 @@ module Waxeye
|
|
260
272
|
@error_line = @line
|
261
273
|
@error_col = @column
|
262
274
|
end
|
275
|
+
false
|
263
276
|
end
|
264
277
|
|
265
278
|
def mv()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waxeye
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orlando D. A. R. Hill
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-24 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
version:
|
47
47
|
requirements: []
|
48
48
|
|
49
|
-
rubyforge_project:
|
49
|
+
rubyforge_project: waxeye
|
50
50
|
rubygems_version: 1.1.1
|
51
51
|
signing_key:
|
52
52
|
specification_version: 2
|