bel_parser 1.0.0.alpha.38-java → 1.0.0.alpha.39-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bel_parser/ast_filter.rb +6 -2
- data/lib/bel_parser/parsers/ast/node.rb +113 -58
- data/lib/bel_parser/parsers/bel_script/define_annotation.rb +4175 -3097
- data/lib/bel_parser/parsers/bel_script/define_annotation.rl +142 -49
- data/lib/bel_parser/parsers/bel_script/define_namespace.rb +980 -461
- data/lib/bel_parser/parsers/bel_script/define_namespace.rl +79 -39
- data/lib/bel_parser/parsers/bel_script/set.rb +4878 -2743
- data/lib/bel_parser/parsers/bel_script/set.rl +114 -32
- data/lib/bel_parser/parsers/bel_script/set_document.rb +5839 -5292
- data/lib/bel_parser/parsers/bel_script/set_document.rl +130 -27
- data/lib/bel_parser/parsers/bel_script/unset.rb +321 -234
- data/lib/bel_parser/parsers/bel_script/unset.rl +49 -21
- data/lib/bel_parser/parsers/common/blank_line.rb +12 -11
- data/lib/bel_parser/parsers/common/blank_line.rl +12 -12
- data/lib/bel_parser/parsers/common/comment_line.rb +65 -40
- data/lib/bel_parser/parsers/common/comment_line.rl +26 -26
- data/lib/bel_parser/parsers/common/common.rl +60 -0
- data/lib/bel_parser/parsers/common/function.rb +319 -0
- data/lib/bel_parser/parsers/common/function.rl +149 -0
- data/lib/bel_parser/parsers/common/identifier.rb +72 -68
- data/lib/bel_parser/parsers/common/identifier.rl +73 -29
- data/lib/bel_parser/parsers/common/list.rb +1617 -1243
- data/lib/bel_parser/parsers/common/list.rl +120 -60
- data/lib/bel_parser/parsers/common/string.rb +114 -41
- data/lib/bel_parser/parsers/common/string.rl +91 -28
- data/lib/bel_parser/parsers/common.rb +1 -0
- data/lib/bel_parser/parsers/expression/comment.rb +70 -38
- data/lib/bel_parser/parsers/expression/comment.rl +37 -20
- data/lib/bel_parser/parsers/expression/nested_statement.rb +63116 -13958
- data/lib/bel_parser/parsers/expression/nested_statement.rl +53 -23
- data/lib/bel_parser/parsers/expression/observed_term.rb +32497 -5188
- data/lib/bel_parser/parsers/expression/observed_term.rl +25 -20
- data/lib/bel_parser/parsers/expression/parameter.rb +2861 -847
- data/lib/bel_parser/parsers/expression/parameter.rl +178 -21
- data/lib/bel_parser/parsers/expression/relationship.rb +73 -55
- data/lib/bel_parser/parsers/expression/relationship.rl +41 -23
- data/lib/bel_parser/parsers/expression/simple_statement.rb +42895 -7846
- data/lib/bel_parser/parsers/expression/simple_statement.rl +41 -24
- data/lib/bel_parser/parsers/expression/term.rb +16498 -2602
- data/lib/bel_parser/parsers/expression/term.rl +52 -35
- data/lib/bel_parser/parsers/line_parser.rb +1 -0
- data/lib/bel_parser/parsers/mixin/buffer.rb +4 -0
- data/lib/bel_parser/parsers/tracer.rb +19 -0
- data/lib/bel_parser/script/state/namespace_definition.rb +1 -0
- metadata +10 -7
@@ -8,44 +8,119 @@
|
|
8
8
|
include 'string.rl';
|
9
9
|
include 'list.rl';
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@buffers[:
|
11
|
+
action add_name {
|
12
|
+
trace('SET add_name')
|
13
|
+
key = @buffers.delete(:ident)
|
14
|
+
@buffers[:set_name] = key
|
15
15
|
}
|
16
16
|
|
17
|
-
action
|
18
|
-
|
17
|
+
action add_ident_value {
|
18
|
+
trace('SET add_ident_value')
|
19
|
+
ident = @buffers.delete(:ident)
|
20
|
+
@buffers[:set_value] = ident
|
19
21
|
}
|
20
22
|
|
21
|
-
action
|
22
|
-
|
23
|
+
action add_string_value {
|
24
|
+
trace('SET add_string_value')
|
25
|
+
string = @buffers.delete(:string)
|
26
|
+
@buffers[:set_value] = string
|
23
27
|
}
|
24
28
|
|
25
|
-
action
|
26
|
-
|
29
|
+
action add_list_value {
|
30
|
+
trace('SET add_list_value')
|
31
|
+
list = @buffers.delete(:list)
|
32
|
+
@buffers[:set_value] = list
|
27
33
|
}
|
28
34
|
|
29
|
-
action
|
30
|
-
|
35
|
+
action set_end {
|
36
|
+
trace('SET set_end')
|
37
|
+
set_node = set()
|
38
|
+
completed = true
|
39
|
+
|
40
|
+
name = @buffers.delete(:set_name)
|
41
|
+
if name.nil?
|
42
|
+
completed = false
|
43
|
+
else
|
44
|
+
set_node <<= name
|
45
|
+
end
|
46
|
+
|
47
|
+
value = @buffers.delete(:set_value)
|
48
|
+
if value.nil?
|
49
|
+
completed = false
|
50
|
+
else
|
51
|
+
set_node <<= value
|
52
|
+
end
|
53
|
+
set_node.complete = completed
|
54
|
+
@buffers[:set] = set_node
|
31
55
|
}
|
32
56
|
|
33
57
|
action yield_set {
|
58
|
+
trace('SET yield_set')
|
34
59
|
yield @buffers[:set]
|
35
60
|
}
|
36
61
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
62
|
+
action set_node_eof {
|
63
|
+
trace('SET set_node_eof')
|
64
|
+
name = @buffers.delete(:set_name)
|
65
|
+
set_node = set(name)
|
66
|
+
completed = name.complete
|
67
|
+
if @buffers.key?(:string)
|
68
|
+
value = @buffers.delete(:string)
|
69
|
+
set_node <<= value
|
70
|
+
completed = completed && value.complete
|
71
|
+
elsif @buffers.key?(:ident)
|
72
|
+
value = @buffers.delete(:ident)
|
73
|
+
set_node <<= value
|
74
|
+
completed = completed && value.complete
|
75
|
+
elsif @buffers.key?(:list)
|
76
|
+
value = @buffers.delete(:list)
|
77
|
+
set_node <<= value
|
78
|
+
completed = completed && value.complete
|
79
|
+
end
|
80
|
+
set_node.complete = completed
|
81
|
+
yield set_node
|
82
|
+
}
|
83
|
+
|
84
|
+
key =
|
85
|
+
an_ident
|
86
|
+
%add_name
|
87
|
+
;
|
88
|
+
|
89
|
+
ident_value =
|
90
|
+
an_ident
|
91
|
+
%add_ident_value
|
92
|
+
;
|
93
|
+
|
94
|
+
string_value =
|
95
|
+
a_string
|
96
|
+
%add_string_value
|
97
|
+
;
|
98
|
+
|
99
|
+
list_value =
|
100
|
+
a_list
|
101
|
+
%add_list_value
|
102
|
+
;
|
103
|
+
|
104
|
+
value =
|
105
|
+
ident_value |
|
106
|
+
string_value |
|
107
|
+
list_value
|
108
|
+
;
|
109
|
+
|
110
|
+
set_node :=
|
111
|
+
KW_SET
|
41
112
|
SP+
|
42
|
-
|
113
|
+
an_ident
|
114
|
+
%add_name
|
115
|
+
@eof(set_node_eof)
|
43
116
|
SP+
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
117
|
+
EQL?
|
118
|
+
SP+?
|
119
|
+
value?
|
120
|
+
@eof(set_node_eof)
|
121
|
+
%set_end
|
122
|
+
%yield_set
|
123
|
+
;
|
49
124
|
}%%
|
50
125
|
=end
|
51
126
|
# end: ragel
|
@@ -53,6 +128,7 @@
|
|
53
128
|
require_relative '../ast/node'
|
54
129
|
require_relative '../mixin/buffer'
|
55
130
|
require_relative '../nonblocking_io_wrapper'
|
131
|
+
require_relative '../tracer'
|
56
132
|
|
57
133
|
module BELParser
|
58
134
|
module Parsers
|
@@ -78,25 +154,31 @@ module BELParser
|
|
78
154
|
include Enumerable
|
79
155
|
include BELParser::Parsers::Buffer
|
80
156
|
include BELParser::Parsers::AST::Sexp
|
157
|
+
include BELParser::Parsers::Tracer
|
81
158
|
|
82
159
|
def initialize(content)
|
83
160
|
@content = content
|
84
|
-
# begin: ragel
|
161
|
+
# begin: ragel
|
85
162
|
%% write data;
|
86
|
-
# end: ragel
|
163
|
+
# end: ragel
|
87
164
|
end
|
88
165
|
|
89
166
|
def each
|
90
|
-
@buffers
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
167
|
+
@buffers = {}
|
168
|
+
@incomplete = {}
|
169
|
+
@accum_set = false
|
170
|
+
@have_set = false
|
171
|
+
@have_name = false
|
172
|
+
@have_value = false
|
173
|
+
data = @content.unpack('C*')
|
174
|
+
p = 0
|
175
|
+
pe = data.length
|
176
|
+
eof = data.length
|
177
|
+
|
178
|
+
# begin: ragel
|
97
179
|
%% write init;
|
98
180
|
%% write exec;
|
99
|
-
# end: ragel
|
181
|
+
# end: ragel
|
100
182
|
end
|
101
183
|
end
|
102
184
|
end
|