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
@@ -5,37 +5,75 @@
|
|
5
5
|
|
6
6
|
include 'common.rl';
|
7
7
|
|
8
|
-
action
|
9
|
-
|
8
|
+
action start_identifier {
|
9
|
+
trace('IDENTIFIER start_identifier')
|
10
|
+
@identifier_started = true
|
11
|
+
id_start = p;
|
10
12
|
}
|
11
13
|
|
12
|
-
action
|
13
|
-
(
|
14
|
+
action end_identifier {
|
15
|
+
trace('IDENTIFIER end_identifier')
|
16
|
+
id_end = p
|
17
|
+
chars = data[id_start...id_end]
|
18
|
+
completed = !chars.empty?
|
19
|
+
ast_node = identifier(utf8_string(chars), complete: completed)
|
20
|
+
@buffers[:ident] = ast_node
|
14
21
|
}
|
15
22
|
|
16
|
-
action
|
17
|
-
|
23
|
+
action an_ident_err {
|
24
|
+
trace('IDENTIFIER an_ident_err')
|
25
|
+
id_end = p
|
26
|
+
chars = data[id_start...id_end]
|
27
|
+
ast_node = identifier(utf8_string(chars), complete: false)
|
28
|
+
@buffers[:ident] = ast_node
|
18
29
|
}
|
19
30
|
|
20
|
-
action
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@buffers[:ident] ||= []
|
27
|
-
@buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
|
28
|
-
end
|
31
|
+
action ident_node_err {
|
32
|
+
trace('IDENTIFIER ident_node_err')
|
33
|
+
id_end = p
|
34
|
+
chars = data[id_start...id_end]
|
35
|
+
ast_node = identifier(utf8_string(chars), complete: false)
|
36
|
+
yield ast_node
|
29
37
|
}
|
30
38
|
|
31
|
-
action
|
32
|
-
|
39
|
+
action yield_identifier {
|
40
|
+
trace('IDENTIFIER yield_identifier')
|
33
41
|
yield @buffers[:ident]
|
34
42
|
}
|
35
43
|
|
36
|
-
|
44
|
+
action an_ident_eof {
|
45
|
+
trace('IDENTIFIER an_ident_eof')
|
46
|
+
if @identifier_started
|
47
|
+
id_end = p
|
48
|
+
chars = data[id_start...id_end]
|
49
|
+
completed = !chars.empty?
|
50
|
+
ast_node = identifier(utf8_string(chars), complete: completed)
|
51
|
+
@buffers[:ident] = ast_node
|
52
|
+
end
|
53
|
+
}
|
37
54
|
|
38
|
-
ident
|
55
|
+
ident =
|
56
|
+
ID_CHARS
|
57
|
+
>start_identifier
|
58
|
+
%end_identifier
|
59
|
+
;
|
60
|
+
|
61
|
+
maybe_ident =
|
62
|
+
ident?
|
63
|
+
;
|
64
|
+
|
65
|
+
an_ident =
|
66
|
+
ident
|
67
|
+
$eof(an_ident_eof)
|
68
|
+
$err(an_ident_err)
|
69
|
+
;
|
70
|
+
|
71
|
+
ident_node :=
|
72
|
+
ident
|
73
|
+
NL?
|
74
|
+
$err(ident_node_err)
|
75
|
+
%yield_identifier
|
76
|
+
;
|
39
77
|
}%%
|
40
78
|
=end
|
41
79
|
# end: ragel
|
@@ -43,6 +81,7 @@
|
|
43
81
|
require_relative '../ast/node'
|
44
82
|
require_relative '../mixin/buffer'
|
45
83
|
require_relative '../nonblocking_io_wrapper'
|
84
|
+
require_relative '../tracer'
|
46
85
|
|
47
86
|
module BELParser
|
48
87
|
module Parsers
|
@@ -68,25 +107,30 @@ module BELParser
|
|
68
107
|
include Enumerable
|
69
108
|
include BELParser::Parsers::Buffer
|
70
109
|
include BELParser::Parsers::AST::Sexp
|
110
|
+
include BELParser::Parsers::Tracer
|
71
111
|
|
72
112
|
def initialize(content)
|
73
113
|
@content = content
|
74
|
-
# begin: ragel
|
114
|
+
# begin: ragel
|
75
115
|
%% write data;
|
76
|
-
# end: ragel
|
116
|
+
# end: ragel
|
77
117
|
end
|
78
118
|
|
79
119
|
def each
|
80
|
-
@buffers
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
120
|
+
@buffers = {}
|
121
|
+
@incomplete = {}
|
122
|
+
data = @content.unpack('C*')
|
123
|
+
p = 0
|
124
|
+
id_start = 0
|
125
|
+
id_end = 0
|
126
|
+
pe = data.length
|
127
|
+
eof = data.length
|
128
|
+
|
129
|
+
identifier_started = false
|
130
|
+
# begin: ragel
|
87
131
|
%% write init;
|
88
132
|
%% write exec;
|
89
|
-
# end: ragel
|
133
|
+
# end: ragel
|
90
134
|
end
|
91
135
|
end
|
92
136
|
end
|