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,39 +8,53 @@
|
|
8
8
|
include 'comment.rl';
|
9
9
|
|
10
10
|
action statement_subject {
|
11
|
+
trace('SIMPLE_STATEMENT statement_subject')
|
11
12
|
@buffers[:subject] = subject(
|
12
13
|
@buffers[:term_stack][-1])
|
13
14
|
@buffers[:term_stack] = nil
|
14
15
|
}
|
15
16
|
|
16
17
|
action statement_object {
|
17
|
-
|
18
|
-
|
18
|
+
trace('SIMPLE_STATEMENT statement_object')
|
19
|
+
term = @buffers[:term_stack][-1]
|
20
|
+
@buffers[:object] = object(term)
|
19
21
|
@buffers[:term_stack] = nil
|
22
|
+
sub = @buffers[:subject]
|
23
|
+
rel = @buffers[:relationship]
|
24
|
+
obj = @buffers[:object]
|
25
|
+
stmt = statement(sub, rel, obj)
|
26
|
+
simple_stmt = simple_statement(stmt)
|
27
|
+
simple_stmt.complete = true
|
28
|
+
@buffers[:simple_statement] = simple_stmt
|
29
|
+
}
|
30
|
+
|
31
|
+
action simple_statement_comment {
|
32
|
+
trace('SIMPLE_STATEMENT simple_statement_comment')
|
33
|
+
comment = @buffers[:comment]
|
34
|
+
@buffers[:simple_statement] =
|
35
|
+
simple_statement(
|
36
|
+
@buffers[:simple_statement].statement << comment)
|
20
37
|
}
|
21
38
|
|
22
39
|
action yield_simple_statement {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@buffers[:subject],
|
27
|
-
@buffers[:relationship],
|
28
|
-
@buffers[:object],
|
29
|
-
@buffers[:comment]))
|
40
|
+
trace('YIELD_SIMPLE_STATEMENT')
|
41
|
+
simple_stmt = @buffers.delete(:simple_statement)
|
42
|
+
yield simple_stmt
|
30
43
|
}
|
31
44
|
|
32
45
|
STATEMENT_SIMPLE =
|
33
46
|
outer_term %statement_subject
|
34
47
|
SP+
|
35
|
-
|
48
|
+
relationship %relationship_end
|
36
49
|
SP+
|
37
|
-
outer_term
|
50
|
+
outer_term
|
51
|
+
%statement_object;
|
38
52
|
|
39
53
|
simple_statement :=
|
40
54
|
STATEMENT_SIMPLE
|
41
55
|
SP*
|
42
|
-
|
43
|
-
NL
|
56
|
+
comment? %simple_statement_comment %yield_simple_statement
|
57
|
+
NL?;
|
44
58
|
}%%
|
45
59
|
=end
|
46
60
|
# end: ragel
|
@@ -48,6 +62,7 @@
|
|
48
62
|
require_relative '../ast/node'
|
49
63
|
require_relative '../mixin/buffer'
|
50
64
|
require_relative '../nonblocking_io_wrapper'
|
65
|
+
require_relative '../tracer'
|
51
66
|
|
52
67
|
module BELParser
|
53
68
|
module Parsers
|
@@ -73,26 +88,28 @@ module BELParser
|
|
73
88
|
include Enumerable
|
74
89
|
include BELParser::Parsers::Buffer
|
75
90
|
include BELParser::Parsers::AST::Sexp
|
91
|
+
include BELParser::Parsers::Tracer
|
76
92
|
|
77
93
|
def initialize(content)
|
78
94
|
@content = content
|
79
|
-
# begin: ragel
|
95
|
+
# begin: ragel
|
80
96
|
%% write data;
|
81
|
-
# end: ragel
|
97
|
+
# end: ragel
|
82
98
|
end
|
83
99
|
|
84
100
|
def each
|
85
|
-
@buffers
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
101
|
+
@buffers = {}
|
102
|
+
@incomplete = {}
|
103
|
+
stack = []
|
104
|
+
data = @content.unpack('C*')
|
105
|
+
p = 0
|
106
|
+
pe = data.length
|
107
|
+
eof = data.length
|
108
|
+
|
109
|
+
# begin: ragel
|
93
110
|
%% write init;
|
94
111
|
%% write exec;
|
95
|
-
# end: ragel
|
112
|
+
# end: ragel
|
96
113
|
end
|
97
114
|
end
|
98
115
|
end
|