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
@@ -6,50 +6,76 @@
|
|
6
6
|
include 'simple_statement.rl';
|
7
7
|
|
8
8
|
action statement_init {
|
9
|
+
trace('NESTED_STATEMENT statement_init')
|
9
10
|
@buffers[:statement_stack] = [ statement() ]
|
10
11
|
}
|
11
12
|
|
12
13
|
action inner_statement_init {
|
14
|
+
trace('NESTED_STATEMENT inner_statement_init')
|
13
15
|
@buffers[:statement_stack] << statement()
|
14
16
|
}
|
15
17
|
|
16
18
|
action ast_subject {
|
17
|
-
|
19
|
+
trace('NESTED_STATEMENT ast_subject')
|
20
|
+
subject_node = @buffers[:subject]
|
21
|
+
stmt = @buffers[:statement_stack][-1] << subject_node
|
22
|
+
@buffers[:statement_stack][-1] = stmt
|
18
23
|
}
|
19
24
|
|
20
25
|
action ast_relationship {
|
21
|
-
|
26
|
+
trace('NESTED_STATEMENT ast_relationship')
|
27
|
+
rel_node = @buffers[:relationship]
|
28
|
+
stmt = @buffers[:statement_stack][-1] << rel_node
|
29
|
+
@buffers[:statement_stack][-1] = stmt
|
22
30
|
}
|
23
31
|
|
24
32
|
action ast_object {
|
25
|
-
|
33
|
+
trace('NESTED_STATEMENT ast_object')
|
34
|
+
object_node = object(@buffers[:object])
|
35
|
+
stmt = @buffers[:statement_stack][-1] << object_node
|
36
|
+
@buffers[:statement_stack][-1] = stmt
|
26
37
|
}
|
27
38
|
|
28
39
|
action statement_object_statement {
|
40
|
+
trace('NESTED_STATEMENT statement_object_statement')
|
29
41
|
@buffers[:object] = @buffers[:statement_stack][-1]
|
30
42
|
}
|
31
43
|
|
32
44
|
action call_nested_statement {
|
45
|
+
trace('NESTED_STATEMENT call_nested_statement')
|
33
46
|
fcall inner_statement;
|
34
47
|
}
|
35
48
|
|
36
49
|
action fret {
|
50
|
+
trace('NESTED_STATEMENT fret')
|
37
51
|
inner_statement = @buffers[:statement_stack].pop
|
38
52
|
@buffers[:object] = inner_statement
|
39
|
-
|
53
|
+
obj_node = object(inner_statement)
|
54
|
+
stmt = @buffers[:statement_stack][-1] << obj_node
|
55
|
+
@buffers[:statement_stack][-1] = stmt
|
56
|
+
nested_stmt = nested_statement(stmt)
|
57
|
+
nested_stmt.complete = true
|
58
|
+
@buffers[:nested_statement] = nested_stmt
|
40
59
|
fret;
|
41
60
|
}
|
42
61
|
|
62
|
+
action nested_statement_comment {
|
63
|
+
trace('NESTED_STATEMENT nested_statement_comment')
|
64
|
+
comment = @buffers[:comment]
|
65
|
+
@buffers[:nested_statement] =
|
66
|
+
nested_statement(
|
67
|
+
@buffers[:nested_statement].statement << comment)
|
68
|
+
}
|
69
|
+
|
43
70
|
action yield_nested_statement {
|
44
|
-
|
45
|
-
|
46
|
-
yield nested_statement(statement)
|
71
|
+
trace('NESTED_STATEMENT yield_nested_statement')
|
72
|
+
yield @buffers[:nested_statement]
|
47
73
|
}
|
48
74
|
|
49
75
|
inner_statement :=
|
50
76
|
outer_term >inner_statement_init %statement_subject %ast_subject
|
51
77
|
SP+
|
52
|
-
|
78
|
+
relationship %relationship_end %ast_relationship
|
53
79
|
SP+
|
54
80
|
(
|
55
81
|
outer_term @statement_object @ast_object |
|
@@ -59,18 +85,19 @@
|
|
59
85
|
outer_statement =
|
60
86
|
outer_term >statement_init %statement_subject %ast_subject
|
61
87
|
SP+
|
62
|
-
|
88
|
+
relationship %relationship_end %ast_relationship
|
63
89
|
SP+
|
64
90
|
'(' @call_nested_statement
|
65
91
|
')'
|
66
92
|
# ')' @ast_object
|
67
93
|
;
|
68
94
|
|
95
|
+
|
69
96
|
nested_statement :=
|
70
97
|
outer_statement
|
71
98
|
SP*
|
72
|
-
|
73
|
-
NL
|
99
|
+
comment? %nested_statement_comment %yield_nested_statement
|
100
|
+
NL?;
|
74
101
|
}%%
|
75
102
|
=end
|
76
103
|
# end: ragel
|
@@ -78,6 +105,7 @@
|
|
78
105
|
require_relative '../ast/node'
|
79
106
|
require_relative '../mixin/buffer'
|
80
107
|
require_relative '../nonblocking_io_wrapper'
|
108
|
+
require_relative '../tracer'
|
81
109
|
|
82
110
|
module BELParser
|
83
111
|
module Parsers
|
@@ -103,27 +131,29 @@ module BELParser
|
|
103
131
|
include Enumerable
|
104
132
|
include BELParser::Parsers::Buffer
|
105
133
|
include BELParser::Parsers::AST::Sexp
|
134
|
+
include BELParser::Parsers::Tracer
|
106
135
|
|
107
136
|
def initialize(content)
|
108
137
|
@content = content
|
109
|
-
# begin: ragel
|
138
|
+
# begin: ragel
|
110
139
|
%% write data;
|
111
|
-
# end: ragel
|
140
|
+
# end: ragel
|
112
141
|
end
|
113
142
|
|
114
143
|
def each
|
115
|
-
@buffers
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
144
|
+
@buffers = {}
|
145
|
+
@incomplete = {}
|
146
|
+
eof = :ignored
|
147
|
+
stack = []
|
148
|
+
data = @content.unpack('C*')
|
149
|
+
p = 0
|
150
|
+
pe = data.length
|
151
|
+
eof = data.length
|
152
|
+
|
153
|
+
# begin: ragel
|
124
154
|
%% write init;
|
125
155
|
%% write exec;
|
126
|
-
# end: ragel
|
156
|
+
# end: ragel
|
127
157
|
end
|
128
158
|
end
|
129
159
|
end
|