halunke 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/examples/hello.hal +19 -0
- data/examples/web.hal +20 -0
- data/exe/halunke +11 -7
- data/halunke.gemspec +2 -0
- data/lib/halunke/grammar.y +16 -32
- data/lib/halunke/interpreter.rb +56 -2
- data/lib/halunke/lexer.rb +95 -80
- data/lib/halunke/lexer.rl +7 -3
- data/lib/halunke/nodes.rb +24 -25
- data/lib/halunke/parser.rb +97 -112
- data/lib/halunke/runtime.rb +11 -222
- data/lib/halunke/runtime/false.hal +18 -0
- data/lib/halunke/runtime/harray.rb +30 -0
- data/lib/halunke/runtime/hclass.rb +96 -0
- data/lib/halunke/runtime/hdictionary.rb +26 -0
- data/lib/halunke/runtime/hfunction.rb +27 -0
- data/lib/halunke/runtime/hnative_object.rb +21 -0
- data/lib/halunke/runtime/hnumber.rb +41 -0
- data/lib/halunke/runtime/hobject.rb +30 -0
- data/lib/halunke/runtime/hstdout.rb +16 -0
- data/lib/halunke/runtime/hstring.rb +35 -0
- data/lib/halunke/runtime/hunassigned_bareword.rb +19 -0
- data/lib/halunke/runtime/hweb.rb +40 -0
- data/lib/halunke/runtime/true.hal +18 -0
- data/lib/halunke/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df4242816f16240f4ecb71b5a1412b7e0e6a2345
|
4
|
+
data.tar.gz: f114fb281e8beb82bc8ed50f81f6087e91a6409b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34027218c4f018c28843168c0b19d2de85922c5a420c84f712ef3f2cee061399049875dfe6bf5985bd4ee75cb2fd74e23672c90ed3c0447094e9e2c37ba4c093
|
7
|
+
data.tar.gz: 49b490349bf99ef366206e495aaa494c438ef5c83e68d176f32673b67ab298716c51f0951ab4aff36bf03ace191982cb53a5880155a410b3b238c9a62841fc25
|
data/Gemfile.lock
CHANGED
data/examples/hello.hal
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
(Class new 'Greeter
|
2
|
+
attributes ["name"]
|
3
|
+
methods @[
|
4
|
+
"greet" { |'self|
|
5
|
+
("Hello " + (self name))
|
6
|
+
}
|
7
|
+
"name" { |'self|
|
8
|
+
(self @ "name" else "<Unknown>")
|
9
|
+
}
|
10
|
+
]
|
11
|
+
class_methods @[
|
12
|
+
"for" { |'self 'name|
|
13
|
+
(self new @["name" name])
|
14
|
+
}
|
15
|
+
]
|
16
|
+
)
|
17
|
+
|
18
|
+
('greeter = (Greeter for "World"))
|
19
|
+
(stdout puts (greeter greet))
|
data/examples/web.hal
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
(Class new 'App
|
2
|
+
methods @[
|
3
|
+
"call" { |'self 'env|
|
4
|
+
[
|
5
|
+
"200"
|
6
|
+
@[ "Content-Type" "text/html" ]
|
7
|
+
[
|
8
|
+
"<h1>Halunke!</h1>"
|
9
|
+
"<ul>"
|
10
|
+
(("<li>Request Method: " + (env @ "request_method" else "I dont know")) + "</li>")
|
11
|
+
(("<li>Path: " + (env @ "path" else "/")) + "</li>")
|
12
|
+
(("<li>Query: " + (env @ "query" else "")) + "</li>")
|
13
|
+
"</ul>"
|
14
|
+
]
|
15
|
+
]
|
16
|
+
}
|
17
|
+
]
|
18
|
+
)
|
19
|
+
|
20
|
+
(web run (App new) on "0.0.0.0:3000")
|
data/exe/halunke
CHANGED
@@ -5,12 +5,16 @@ require "readline"
|
|
5
5
|
|
6
6
|
interpreter = Halunke::Interpreter.new
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
if ARGV.length == 0
|
9
|
+
puts "Halunke REPL. Ctrl+d to quit"
|
10
|
+
while (line = Readline.readline(">> ", true))
|
11
|
+
begin
|
12
|
+
value = interpreter.eval(line)
|
13
|
+
puts "=> #{value}"
|
14
|
+
rescue Exception => e
|
15
|
+
puts "An Error Occurred: #{e.message}"
|
16
|
+
end
|
15
17
|
end
|
18
|
+
else
|
19
|
+
interpreter.eval(File.read(ARGV[0]))
|
16
20
|
end
|
data/halunke.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
+
spec.add_dependency "rack", "~> 2.0.4"
|
25
|
+
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.16.1"
|
25
27
|
spec.add_development_dependency "rake", "~> 12.3.0"
|
26
28
|
spec.add_development_dependency "minitest", "~> 5.11.3"
|
data/lib/halunke/grammar.y
CHANGED
@@ -7,52 +7,36 @@ token OPEN_PAREN
|
|
7
7
|
token CLOSE_PAREN
|
8
8
|
token OPEN_CURLY
|
9
9
|
token CLOSE_CURLY
|
10
|
-
token OPERATOR
|
11
10
|
token UNASSIGNED_BAREWORD
|
12
11
|
token OPEN_BRACKET
|
13
12
|
token CLOSE_BRACKET
|
13
|
+
token OPEN_DICT_BRACKET
|
14
14
|
token BAR
|
15
|
+
token START_COMMENT
|
16
|
+
token END_COMMENT
|
15
17
|
|
16
18
|
rule
|
17
19
|
Program:
|
18
|
-
Expressions
|
20
|
+
Expressions { result = val[0] }
|
19
21
|
;
|
20
22
|
|
21
23
|
Expressions:
|
22
|
-
/* empty */ { result = Nodes.new }
|
23
|
-
| Expression Expressions { result = Nodes.new([val[0]]
|
24
|
+
/* empty */ { result = Nodes.new([]) }
|
25
|
+
| Expression Expressions { result = Nodes.new([val[0]].concat(val[1].nodes)) }
|
24
26
|
;
|
25
27
|
|
26
28
|
Expression:
|
27
|
-
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
NUMBER { result = NumberNode.new(val[0]) }
|
30
|
+
| STRING { result = StringNode.new(val[0]) }
|
31
|
+
| BAREWORD { result = BarewordNode.new(val[0]) }
|
32
|
+
| UNASSIGNED_BAREWORD { result = UnassignedNode.new(BarewordNode.new(val[0])) }
|
33
|
+
| START_COMMENT Expressions END_COMMENT { result = Nodes.new([]) }
|
34
|
+
| OPEN_CURLY Expressions CLOSE_CURLY { result = FunctionNode.new(ArrayNode.new([]), val[1]) }
|
35
|
+
| OPEN_CURLY BAR Expressions BAR Expressions CLOSE_CURLY { result = FunctionNode.new(val[2].to_array, val[4]) }
|
36
|
+
| OPEN_PAREN Expression Expressions CLOSE_PAREN { result = MessageSendNode.new(val[1], val[2].to_message) }
|
37
|
+
| OPEN_BRACKET Expressions CLOSE_BRACKET { result = val[1].to_array }
|
38
|
+
| OPEN_DICT_BRACKET Expressions CLOSE_BRACKET { result = val[1].to_dictionary }
|
32
39
|
;
|
33
|
-
|
34
|
-
Args:
|
35
|
-
BAR UnassignedBarewords BAR { result = Halunke::ArrayNode.new(val[1].nodes) }
|
36
|
-
;
|
37
|
-
|
38
|
-
UnassignedBarewords:
|
39
|
-
/* empty */ { result = Nodes.new }
|
40
|
-
| UnassignedBareword UnassignedBarewords { result = Nodes.new([val[0]]).concat(val[1]) }
|
41
|
-
;
|
42
|
-
|
43
|
-
UnassignedBareword:
|
44
|
-
UNASSIGNED_BAREWORD { result = UnassignedNode.new(BarewordNode.new(val[0])) }
|
45
|
-
;
|
46
|
-
|
47
|
-
Literal:
|
48
|
-
NUMBER { result = NumberNode.new(val[0]) }
|
49
|
-
| STRING { result = StringNode.new(val[0]) }
|
50
|
-
/* TODO: Are Operators just Barewords? */
|
51
|
-
| BAREWORD { result = BarewordNode.new(val[0]) }
|
52
|
-
| OPERATOR { result = BarewordNode.new(val[0]) }
|
53
|
-
| UNASSIGNED_BAREWORD { result = UnassignedNode.new(BarewordNode.new(val[0])) }
|
54
|
-
;
|
55
|
-
|
56
40
|
end
|
57
41
|
|
58
42
|
---- header
|
data/lib/halunke/interpreter.rb
CHANGED
@@ -1,15 +1,69 @@
|
|
1
|
+
require "pathname"
|
1
2
|
require "halunke/parser"
|
3
|
+
require "halunke/runtime"
|
2
4
|
|
3
5
|
module Halunke
|
4
6
|
class Interpreter
|
7
|
+
attr_reader :root_context
|
8
|
+
|
5
9
|
def initialize
|
6
10
|
@parser = Parser.new
|
7
|
-
@
|
11
|
+
@root_context = Context.new
|
12
|
+
|
13
|
+
@root_context["Class"] = Halunke::Runtime::HClass
|
14
|
+
@root_context["Function"] = Halunke::Runtime::HFunction
|
15
|
+
@root_context["Number"] = Halunke::Runtime::HNumber
|
16
|
+
@root_context["String"] = Halunke::Runtime::HString
|
17
|
+
@root_context["Array"] = Halunke::Runtime::HArray
|
18
|
+
@root_context["Dictionary"] = Halunke::Runtime::HDictionary
|
19
|
+
@root_context["UnassignedBareword"] = Halunke::Runtime::HUnassignedBareword
|
20
|
+
@root_context["stdout"] = Halunke::Runtime::HStdout.create_instance
|
21
|
+
@root_context["web"] = Halunke::Runtime::HWeb.create_instance
|
22
|
+
|
23
|
+
preludes.each do |prelude|
|
24
|
+
self.eval(prelude)
|
25
|
+
end
|
8
26
|
end
|
9
27
|
|
10
28
|
def eval(str)
|
11
29
|
nodes = @parser.parse(str)
|
12
|
-
nodes.eval(
|
30
|
+
nodes.eval(root_context).inspect(root_context)
|
31
|
+
end
|
32
|
+
|
33
|
+
def preludes
|
34
|
+
[
|
35
|
+
Pathname.new(__dir__).join("runtime", "true.hal").read,
|
36
|
+
Pathname.new(__dir__).join("runtime", "false.hal").read
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
class Context
|
41
|
+
attr_reader :parent
|
42
|
+
|
43
|
+
def initialize(parent = nil)
|
44
|
+
@parent = parent
|
45
|
+
@context = {}
|
46
|
+
end
|
47
|
+
|
48
|
+
def []=(name, value)
|
49
|
+
raise "Bareword #{name} is already assigned" if key? name
|
50
|
+
@context[name] = value
|
51
|
+
end
|
52
|
+
|
53
|
+
def [](name)
|
54
|
+
@context.fetch(name)
|
55
|
+
rescue KeyError
|
56
|
+
raise "Bareword '#{name} is unassigned'" if @parent.nil?
|
57
|
+
@parent[name]
|
58
|
+
end
|
59
|
+
|
60
|
+
def key?(name)
|
61
|
+
@context.key?(name)
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_child
|
65
|
+
Context.new(self)
|
66
|
+
end
|
13
67
|
end
|
14
68
|
end
|
15
69
|
end
|
data/lib/halunke/lexer.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# line 1 "lib/halunke/lexer.rl"
|
3
3
|
=begin
|
4
4
|
|
5
|
-
# line
|
5
|
+
# line 40 "lib/halunke/lexer.rl"
|
6
6
|
|
7
7
|
=end
|
8
8
|
|
@@ -21,8 +21,8 @@ self._lexer_actions = [
|
|
21
21
|
9, 1, 10, 1, 11, 1, 12, 1,
|
22
22
|
13, 1, 14, 1, 15, 1, 16, 1,
|
23
23
|
17, 1, 18, 1, 19, 1, 20, 1,
|
24
|
-
21, 1, 22,
|
25
|
-
4
|
24
|
+
21, 1, 22, 1, 23, 1, 24, 2,
|
25
|
+
2, 3, 2, 2, 4
|
26
26
|
]
|
27
27
|
|
28
28
|
class << self
|
@@ -30,8 +30,8 @@ class << self
|
|
30
30
|
private :_lexer_key_offsets, :_lexer_key_offsets=
|
31
31
|
end
|
32
32
|
self._lexer_key_offsets = [
|
33
|
-
0, 1, 3,
|
34
|
-
|
33
|
+
0, 1, 3, 29, 30, 35, 36, 38,
|
34
|
+
41, 43, 44, 45
|
35
35
|
]
|
36
36
|
|
37
37
|
class << self
|
@@ -40,11 +40,12 @@ class << self
|
|
40
40
|
end
|
41
41
|
self._lexer_trans_keys = [
|
42
42
|
34, 48, 57, 32, 34, 39, 40, 41,
|
43
|
-
43, 45,
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
42, 43, 45, 47, 64, 91, 93, 95,
|
44
|
+
123, 124, 125, 9, 13, 48, 57, 60,
|
45
|
+
62, 65, 90, 97, 122, 34, 95, 65,
|
46
|
+
90, 97, 122, 47, 48, 57, 46, 48,
|
47
|
+
57, 48, 57, 42, 91, 95, 65, 90,
|
48
|
+
97, 122, 0
|
48
49
|
]
|
49
50
|
|
50
51
|
class << self
|
@@ -52,8 +53,8 @@ class << self
|
|
52
53
|
private :_lexer_single_lengths, :_lexer_single_lengths=
|
53
54
|
end
|
54
55
|
self._lexer_single_lengths = [
|
55
|
-
1, 0,
|
56
|
-
1
|
56
|
+
1, 0, 16, 1, 1, 1, 0, 1,
|
57
|
+
0, 1, 1, 1
|
57
58
|
]
|
58
59
|
|
59
60
|
class << self
|
@@ -61,8 +62,8 @@ class << self
|
|
61
62
|
private :_lexer_range_lengths, :_lexer_range_lengths=
|
62
63
|
end
|
63
64
|
self._lexer_range_lengths = [
|
64
|
-
0, 1, 5, 0, 2,
|
65
|
-
2
|
65
|
+
0, 1, 5, 0, 2, 0, 1, 1,
|
66
|
+
1, 0, 0, 2
|
66
67
|
]
|
67
68
|
|
68
69
|
class << self
|
@@ -70,8 +71,8 @@ class << self
|
|
70
71
|
private :_lexer_index_offsets, :_lexer_index_offsets=
|
71
72
|
end
|
72
73
|
self._lexer_index_offsets = [
|
73
|
-
0, 2, 4,
|
74
|
-
|
74
|
+
0, 2, 4, 26, 28, 32, 34, 36,
|
75
|
+
39, 41, 43, 45
|
75
76
|
]
|
76
77
|
|
77
78
|
class << self
|
@@ -79,13 +80,14 @@ class << self
|
|
79
80
|
private :_lexer_trans_targs, :_lexer_trans_targs=
|
80
81
|
end
|
81
82
|
self._lexer_trans_targs = [
|
82
|
-
2, 0,
|
83
|
-
2, 5,
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
2, 0, 8, 2, 2, 3, 4, 2,
|
84
|
+
2, 5, 6, 6, 9, 10, 2, 2,
|
85
|
+
11, 2, 2, 2, 2, 7, 2, 11,
|
86
|
+
11, 2, 2, 0, 4, 4, 4, 2,
|
87
|
+
2, 2, 7, 2, 1, 7, 2, 8,
|
88
|
+
2, 2, 2, 2, 2, 11, 11, 11,
|
87
89
|
2, 2, 2, 2, 2, 2, 2, 2,
|
88
|
-
0
|
90
|
+
2, 2, 2, 2, 0
|
89
91
|
]
|
90
92
|
|
91
93
|
class << self
|
@@ -93,13 +95,14 @@ class << self
|
|
93
95
|
private :_lexer_trans_actions, :_lexer_trans_actions=
|
94
96
|
end
|
95
97
|
self._lexer_trans_actions = [
|
96
|
-
7, 0, 0,
|
97
|
-
|
98
|
-
|
99
|
-
0,
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
7, 0, 0, 41, 31, 5, 50, 11,
|
99
|
+
13, 0, 0, 0, 0, 0, 19, 21,
|
100
|
+
0, 15, 29, 17, 31, 5, 9, 0,
|
101
|
+
0, 33, 7, 0, 47, 47, 47, 45,
|
102
|
+
27, 39, 5, 37, 0, 5, 35, 0,
|
103
|
+
35, 25, 39, 23, 37, 0, 0, 0,
|
104
|
+
37, 43, 41, 39, 45, 39, 37, 35,
|
105
|
+
35, 39, 37, 37, 0
|
103
106
|
]
|
104
107
|
|
105
108
|
class << self
|
@@ -108,7 +111,7 @@ class << self
|
|
108
111
|
end
|
109
112
|
self._lexer_to_state_actions = [
|
110
113
|
0, 0, 1, 0, 0, 0, 0, 0,
|
111
|
-
0
|
114
|
+
0, 0, 0, 0
|
112
115
|
]
|
113
116
|
|
114
117
|
class << self
|
@@ -117,7 +120,7 @@ class << self
|
|
117
120
|
end
|
118
121
|
self._lexer_from_state_actions = [
|
119
122
|
0, 0, 3, 0, 0, 0, 0, 0,
|
120
|
-
0
|
123
|
+
0, 0, 0, 0
|
121
124
|
]
|
122
125
|
|
123
126
|
class << self
|
@@ -125,8 +128,8 @@ class << self
|
|
125
128
|
private :_lexer_eof_trans, :_lexer_eof_trans=
|
126
129
|
end
|
127
130
|
self._lexer_eof_trans = [
|
128
|
-
|
129
|
-
|
131
|
+
50, 51, 0, 58, 53, 58, 60, 57,
|
132
|
+
57, 58, 60, 60
|
130
133
|
]
|
131
134
|
|
132
135
|
class << self
|
@@ -148,7 +151,7 @@ end
|
|
148
151
|
self.lexer_en_main = 2;
|
149
152
|
|
150
153
|
|
151
|
-
# line
|
154
|
+
# line 47 "lib/halunke/lexer.rl"
|
152
155
|
@tokens = []
|
153
156
|
end
|
154
157
|
|
@@ -157,7 +160,7 @@ self.lexer_en_main = 2;
|
|
157
160
|
eof = data.length
|
158
161
|
|
159
162
|
|
160
|
-
# line
|
163
|
+
# line 164 "lib/halunke/lexer.rb"
|
161
164
|
begin
|
162
165
|
p ||= 0
|
163
166
|
pe ||= data.length
|
@@ -167,9 +170,9 @@ begin
|
|
167
170
|
act = 0
|
168
171
|
end
|
169
172
|
|
170
|
-
# line
|
173
|
+
# line 55 "lib/halunke/lexer.rl"
|
171
174
|
|
172
|
-
# line
|
175
|
+
# line 176 "lib/halunke/lexer.rb"
|
173
176
|
begin
|
174
177
|
_klen, _trans, _keys, _acts, _nacts = nil
|
175
178
|
_goto_level = 0
|
@@ -199,7 +202,7 @@ begin
|
|
199
202
|
begin
|
200
203
|
ts = p
|
201
204
|
end
|
202
|
-
# line
|
205
|
+
# line 206 "lib/halunke/lexer.rb"
|
203
206
|
end # from state action switch
|
204
207
|
end
|
205
208
|
if _trigger_goto
|
@@ -271,127 +274,139 @@ when 2 then
|
|
271
274
|
te = p+1
|
272
275
|
end
|
273
276
|
when 3 then
|
274
|
-
# line
|
277
|
+
# line 24 "lib/halunke/lexer.rl"
|
275
278
|
begin
|
276
279
|
act = 3; end
|
277
280
|
when 4 then
|
278
|
-
# line
|
281
|
+
# line 37 "lib/halunke/lexer.rl"
|
279
282
|
begin
|
280
|
-
act =
|
283
|
+
act = 16; end
|
281
284
|
when 5 then
|
282
|
-
# line
|
285
|
+
# line 23 "lib/halunke/lexer.rl"
|
283
286
|
begin
|
284
287
|
te = p+1
|
285
288
|
begin emit(:STRING, data[ts+1...te-1]) end
|
286
289
|
end
|
287
290
|
when 6 then
|
288
|
-
# line
|
291
|
+
# line 25 "lib/halunke/lexer.rl"
|
289
292
|
begin
|
290
293
|
te = p+1
|
291
|
-
begin emit(:
|
294
|
+
begin emit(:BAREWORD, data[ts...te]) end
|
292
295
|
end
|
293
296
|
when 7 then
|
294
|
-
# line
|
297
|
+
# line 26 "lib/halunke/lexer.rl"
|
295
298
|
begin
|
296
299
|
te = p+1
|
297
|
-
begin emit(:
|
300
|
+
begin emit(:OPEN_PAREN, data[ts...te]) end
|
298
301
|
end
|
299
302
|
when 8 then
|
300
|
-
# line
|
303
|
+
# line 27 "lib/halunke/lexer.rl"
|
301
304
|
begin
|
302
305
|
te = p+1
|
303
|
-
begin emit(:
|
306
|
+
begin emit(:CLOSE_PAREN, data[ts...te]) end
|
304
307
|
end
|
305
308
|
when 9 then
|
306
|
-
# line
|
309
|
+
# line 28 "lib/halunke/lexer.rl"
|
307
310
|
begin
|
308
311
|
te = p+1
|
309
|
-
begin emit(:
|
312
|
+
begin emit(:OPEN_CURLY, data[ts...te]) end
|
310
313
|
end
|
311
314
|
when 10 then
|
312
|
-
# line
|
315
|
+
# line 29 "lib/halunke/lexer.rl"
|
313
316
|
begin
|
314
317
|
te = p+1
|
315
|
-
begin emit(:
|
318
|
+
begin emit(:CLOSE_CURLY, data[ts...te]) end
|
316
319
|
end
|
317
320
|
when 11 then
|
318
|
-
# line
|
321
|
+
# line 30 "lib/halunke/lexer.rl"
|
319
322
|
begin
|
320
323
|
te = p+1
|
321
|
-
begin emit(:
|
324
|
+
begin emit(:OPEN_BRACKET, data[ts...te]) end
|
322
325
|
end
|
323
326
|
when 12 then
|
324
|
-
# line
|
327
|
+
# line 31 "lib/halunke/lexer.rl"
|
325
328
|
begin
|
326
329
|
te = p+1
|
327
|
-
begin emit(:
|
330
|
+
begin emit(:CLOSE_BRACKET, data[ts...te]) end
|
328
331
|
end
|
329
332
|
when 13 then
|
330
|
-
# line
|
333
|
+
# line 32 "lib/halunke/lexer.rl"
|
331
334
|
begin
|
332
335
|
te = p+1
|
333
|
-
begin emit(:
|
336
|
+
begin emit(:OPEN_DICT_BRACKET, data[ts...te]) end
|
334
337
|
end
|
335
338
|
when 14 then
|
336
|
-
# line
|
339
|
+
# line 33 "lib/halunke/lexer.rl"
|
337
340
|
begin
|
338
341
|
te = p+1
|
342
|
+
begin emit(:START_COMMENT, data[ts...te]) end
|
339
343
|
end
|
340
344
|
when 15 then
|
341
|
-
# line
|
345
|
+
# line 34 "lib/halunke/lexer.rl"
|
342
346
|
begin
|
343
347
|
te = p+1
|
344
|
-
begin
|
348
|
+
begin emit(:END_COMMENT, data[ts...te]) end
|
345
349
|
end
|
346
350
|
when 16 then
|
347
|
-
# line
|
351
|
+
# line 35 "lib/halunke/lexer.rl"
|
348
352
|
begin
|
349
|
-
te = p
|
350
|
-
|
353
|
+
te = p+1
|
354
|
+
begin emit(:BAR, data[ts...te]) end
|
351
355
|
end
|
352
356
|
when 17 then
|
353
|
-
# line
|
357
|
+
# line 36 "lib/halunke/lexer.rl"
|
354
358
|
begin
|
355
|
-
te = p
|
356
|
-
p = p - 1; begin emit(:BAREWORD, data[ts...te]) end
|
359
|
+
te = p+1
|
357
360
|
end
|
358
361
|
when 18 then
|
359
|
-
# line
|
362
|
+
# line 37 "lib/halunke/lexer.rl"
|
360
363
|
begin
|
361
|
-
te = p
|
362
|
-
|
364
|
+
te = p+1
|
365
|
+
begin raise "Could not lex '#{ data[ts...te] }'" end
|
363
366
|
end
|
364
367
|
when 19 then
|
365
|
-
# line
|
368
|
+
# line 22 "lib/halunke/lexer.rl"
|
366
369
|
begin
|
367
370
|
te = p
|
368
|
-
p = p - 1; begin
|
371
|
+
p = p - 1; begin emit(:NUMBER, data[ts...te].to_r) end
|
369
372
|
end
|
370
373
|
when 20 then
|
371
|
-
# line
|
374
|
+
# line 25 "lib/halunke/lexer.rl"
|
375
|
+
begin
|
376
|
+
te = p
|
377
|
+
p = p - 1; begin emit(:BAREWORD, data[ts...te]) end
|
378
|
+
end
|
379
|
+
when 21 then
|
380
|
+
# line 37 "lib/halunke/lexer.rl"
|
381
|
+
begin
|
382
|
+
te = p
|
383
|
+
p = p - 1; begin raise "Could not lex '#{ data[ts...te] }'" end
|
384
|
+
end
|
385
|
+
when 22 then
|
386
|
+
# line 22 "lib/halunke/lexer.rl"
|
372
387
|
begin
|
373
388
|
begin p = ((te))-1; end
|
374
389
|
begin emit(:NUMBER, data[ts...te].to_r) end
|
375
390
|
end
|
376
|
-
when
|
377
|
-
# line
|
391
|
+
when 23 then
|
392
|
+
# line 37 "lib/halunke/lexer.rl"
|
378
393
|
begin
|
379
394
|
begin p = ((te))-1; end
|
380
395
|
begin raise "Could not lex '#{ data[ts...te] }'" end
|
381
396
|
end
|
382
|
-
when
|
397
|
+
when 24 then
|
383
398
|
# line 1 "NONE"
|
384
399
|
begin
|
385
400
|
case act
|
386
401
|
when 3 then
|
387
402
|
begin begin p = ((te))-1; end
|
388
403
|
emit(:UNASSIGNED_BAREWORD, data[ts+1 ...te]) end
|
389
|
-
when
|
404
|
+
when 16 then
|
390
405
|
begin begin p = ((te))-1; end
|
391
406
|
raise "Could not lex '#{ data[ts...te] }'" end
|
392
407
|
end
|
393
408
|
end
|
394
|
-
# line
|
409
|
+
# line 410 "lib/halunke/lexer.rb"
|
395
410
|
end # action switch
|
396
411
|
end
|
397
412
|
end
|
@@ -411,7 +426,7 @@ when 0 then
|
|
411
426
|
# line 1 "NONE"
|
412
427
|
begin
|
413
428
|
ts = nil; end
|
414
|
-
# line
|
429
|
+
# line 430 "lib/halunke/lexer.rb"
|
415
430
|
end # to state action switch
|
416
431
|
end
|
417
432
|
if _trigger_goto
|
@@ -438,7 +453,7 @@ end
|
|
438
453
|
end
|
439
454
|
end
|
440
455
|
|
441
|
-
# line
|
456
|
+
# line 56 "lib/halunke/lexer.rl"
|
442
457
|
|
443
458
|
@tokens
|
444
459
|
end
|