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
@@ -7,49 +7,86 @@
|
|
7
7
|
include 'identifier.rl';
|
8
8
|
include 'string.rl';
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
action namespace_keyword {
|
16
|
-
@buffers[:namespace_definition] = namespace_definition()
|
10
|
+
action add_name {
|
11
|
+
trace('DEFINE_NAMESPACE add_name')
|
12
|
+
name = @buffers.delete(:ident)
|
13
|
+
@buffers[:namespace_definition_name] = name
|
17
14
|
}
|
18
15
|
|
19
|
-
action
|
20
|
-
|
16
|
+
action add_string_value {
|
17
|
+
trace('DEFINE_NAMESPACE add_string_value')
|
18
|
+
string_node = @buffers.delete(:string)
|
19
|
+
leaf = domain(url(string_node))
|
20
|
+
leaf.complete = string_node.complete
|
21
|
+
@buffers[:namespace_definition_domain] = leaf
|
21
22
|
}
|
22
23
|
|
23
|
-
action
|
24
|
-
|
24
|
+
action add_url_domain {
|
25
|
+
trace('DEFINE_NAMESPACE add_url_domain')
|
26
|
+
@url_domain = true
|
25
27
|
}
|
26
28
|
|
27
|
-
action
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
action define_namespace_end {
|
30
|
+
trace('DEFINE_NAMESPACE define_namespace_end')
|
31
|
+
namespace_definition_node = namespace_definition()
|
32
|
+
|
33
|
+
name = @buffers.delete(:namespace_definition_name)
|
34
|
+
namespace_definition_node <<= keyword(name)
|
35
|
+
|
36
|
+
domain = @buffers.delete(:namespace_definition_domain)
|
37
|
+
unless domain.nil?
|
38
|
+
namespace_definition_node <<= domain
|
39
|
+
namespace_definition_node.complete = domain.complete
|
40
|
+
end
|
41
|
+
@buffers[:namespace_definition] = namespace_definition_node
|
32
42
|
}
|
33
43
|
|
34
|
-
action
|
44
|
+
action yield_define_namespace {
|
45
|
+
trace('DEFINE_NAMESPACE yield_define_namespace')
|
35
46
|
yield @buffers[:namespace_definition]
|
36
47
|
}
|
37
48
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
49
|
+
action define_namespace_node_eof {
|
50
|
+
trace('DEFINE_NAMESPACE define_namespace_node_eof')
|
51
|
+
leaf = url()
|
52
|
+
string_node = @buffers.delete(:string)
|
53
|
+
unless string_node.nil?
|
54
|
+
leaf <<= string_node
|
55
|
+
leaf.complete = string_node.complete
|
56
|
+
end
|
57
|
+
domain_node = domain(leaf)
|
58
|
+
domain_node.complete = leaf.complete
|
59
|
+
namespace_definition_node = namespace_definition(domain_node)
|
60
|
+
namespace_definition_node.complete = domain_node.complete
|
61
|
+
yield namespace_definition_node
|
62
|
+
}
|
63
|
+
|
64
|
+
string_value =
|
65
|
+
a_string
|
66
|
+
%add_string_value
|
67
|
+
;
|
68
|
+
|
69
|
+
url_domain =
|
70
|
+
KW_URL
|
71
|
+
%add_url_domain
|
72
|
+
;
|
73
|
+
|
74
|
+
define_namespace_node :=
|
75
|
+
DEFINE_NAMESPACE
|
43
76
|
SP+
|
44
|
-
|
77
|
+
an_ident
|
78
|
+
%add_name
|
45
79
|
SP+
|
46
|
-
|
80
|
+
KW_AS
|
47
81
|
SP+
|
48
|
-
|
82
|
+
url_domain
|
49
83
|
SP+
|
50
|
-
|
51
|
-
|
52
|
-
|
84
|
+
string_value
|
85
|
+
@eof(define_namespace_node_eof)
|
86
|
+
%define_namespace_end
|
87
|
+
%yield_define_namespace
|
88
|
+
NL
|
89
|
+
;
|
53
90
|
}%%
|
54
91
|
=end
|
55
92
|
# end: ragel
|
@@ -57,6 +94,7 @@
|
|
57
94
|
require_relative '../ast/node'
|
58
95
|
require_relative '../mixin/buffer'
|
59
96
|
require_relative '../nonblocking_io_wrapper'
|
97
|
+
require_relative '../tracer'
|
60
98
|
|
61
99
|
module BELParser
|
62
100
|
module Parsers
|
@@ -82,26 +120,28 @@ module BELParser
|
|
82
120
|
include Enumerable
|
83
121
|
include BELParser::Parsers::Buffer
|
84
122
|
include BELParser::Parsers::AST::Sexp
|
123
|
+
include BELParser::Parsers::Tracer
|
85
124
|
|
86
125
|
def initialize(content)
|
87
126
|
@content = content
|
88
|
-
# begin: ragel
|
127
|
+
# begin: ragel
|
89
128
|
%% write data;
|
90
|
-
# end: ragel
|
129
|
+
# end: ragel
|
91
130
|
end
|
92
131
|
|
93
132
|
def each
|
94
|
-
@buffers =
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
133
|
+
@buffers = {}
|
134
|
+
@incomplete = {}
|
135
|
+
stack = []
|
136
|
+
data = @content.unpack('C*')
|
137
|
+
p = 0
|
138
|
+
pe = data.length
|
139
|
+
eof = data.length
|
140
|
+
|
141
|
+
# begin: ragel
|
102
142
|
%% write init;
|
103
143
|
%% write exec;
|
104
|
-
# end: ragel
|
144
|
+
# end: ragel
|
105
145
|
end
|
106
146
|
end
|
107
147
|
end
|