bel_parser 1.0.8 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +12 -2
- data/VERSION +1 -1
- data/bin/bel2_compatibility +12 -9
- data/bin/bel2_upgrade +18 -6
- data/bin/bel2_validator +6 -3
- data/bin/bel_script_reader +1 -0
- data/lib/bel_parser/completion.rb +984 -0
- data/lib/bel_parser/language/apply_namespace_encoding.rb +14 -3
- data/lib/bel_parser/language/expression_validator.rb +1 -2
- data/lib/bel_parser/language/function.rb +4 -0
- data/lib/bel_parser/language/relationship.rb +4 -0
- data/lib/bel_parser/language/semantics/function_deprecation.rb +1 -0
- data/lib/bel_parser/language/semantics/list_function_subject.rb +2 -0
- data/lib/bel_parser/language/semantics/multiple_subject_object.rb +4 -1
- data/lib/bel_parser/language/semantics/nested_statement_without_object.rb +43 -0
- data/lib/bel_parser/language/semantics/non_object_list.rb +3 -0
- data/lib/bel_parser/language/semantics/relationship_not_listable.rb +2 -0
- data/lib/bel_parser/language/semantics/signature_mapping.rb +2 -0
- data/lib/bel_parser/language/semantics_ast.rb +0 -7
- data/lib/bel_parser/language/syntax/invalid_function.rb +6 -1
- data/lib/bel_parser/language/syntax/invalid_relationship.rb +1 -0
- data/lib/bel_parser/language/version1_0/relationships/acts_in.rb +9 -9
- data/lib/bel_parser/language/version1_0/relationships/analogous.rb +6 -4
- data/lib/bel_parser/language/version1_0/relationships/association.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/biomarker_for.rb +6 -5
- data/lib/bel_parser/language/version1_0/relationships/causes_no_change.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/decreases.rb +13 -12
- data/lib/bel_parser/language/version1_0/relationships/directly_decreases.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/directly_increases.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/has_component.rb +14 -14
- data/lib/bel_parser/language/version1_0/relationships/has_components.rb +12 -11
- data/lib/bel_parser/language/version1_0/relationships/has_member.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/has_members.rb +12 -11
- data/lib/bel_parser/language/version1_0/relationships/has_modification.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/has_product.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/has_variant.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/includes.rb +11 -10
- data/lib/bel_parser/language/version1_0/relationships/increases.rb +12 -13
- data/lib/bel_parser/language/version1_0/relationships/is_a.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/negative_correlation.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/orthologous.rb +9 -8
- data/lib/bel_parser/language/version1_0/relationships/positive_correlation.rb +8 -5
- data/lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb +10 -9
- data/lib/bel_parser/language/version1_0/relationships/reactant_in.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/sub_process_of.rb +13 -12
- data/lib/bel_parser/language/version1_0/relationships/transcribed_to.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/translated_to.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/translocates.rb +10 -9
- data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +1 -2
- data/lib/bel_parser/language/version2_0/functions/translocation.rb +1 -2
- data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -2
- data/lib/bel_parser/language/version2_0/relationships/acts_in.rb +10 -9
- data/lib/bel_parser/language/version2_0/relationships/biomarker_for.rb +7 -5
- data/lib/bel_parser/language/version2_0/relationships/causes_no_change.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/decreases.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/directly_decreases.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/directly_increases.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/has_component.rb +15 -14
- data/lib/bel_parser/language/version2_0/relationships/has_components.rb +12 -11
- data/lib/bel_parser/language/version2_0/relationships/has_member.rb +9 -8
- data/lib/bel_parser/language/version2_0/relationships/has_members.rb +12 -11
- data/lib/bel_parser/language/version2_0/relationships/has_modification.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/has_product.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/has_variant.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/includes.rb +11 -10
- data/lib/bel_parser/language/version2_0/relationships/increases.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/is_a.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/negative_correlation.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/orthologous.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/positive_correlation.rb +7 -5
- data/lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb +10 -9
- data/lib/bel_parser/language/version2_0/relationships/reactant_in.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/regulates.rb +9 -8
- data/lib/bel_parser/language/version2_0/relationships/sub_process_of.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/transcribed_to.rb +8 -7
- data/lib/bel_parser/language/version2_0/relationships/translated_to.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/translocates.rb +10 -9
- data/lib/bel_parser/mixin/levenshtein.rb +20 -0
- data/lib/bel_parser/parsers/ast/node.rb +49 -2
- data/lib/bel_parser/parsers/bel_script/define_annotation.rb +156 -156
- data/lib/bel_parser/parsers/bel_script/define_namespace.rb +60 -60
- data/lib/bel_parser/parsers/bel_script/set.rb +200 -200
- data/lib/bel_parser/parsers/bel_script/set_document.rb +188 -188
- data/lib/bel_parser/parsers/bel_script/unset.rb +14 -14
- data/lib/bel_parser/parsers/common/common.rl +1 -0
- data/lib/bel_parser/parsers/common/function.rb +8 -8
- data/lib/bel_parser/parsers/common/function.rl +6 -6
- data/lib/bel_parser/parsers/common/identifier.rb +3 -3
- data/lib/bel_parser/parsers/common/identifier.rl +4 -4
- data/lib/bel_parser/parsers/common/list.rb +78 -78
- data/lib/bel_parser/parsers/common/multi_identifier.rb +275 -0
- data/lib/bel_parser/parsers/common/multi_identifier.rl +141 -0
- data/lib/bel_parser/parsers/common/string.rb +6 -6
- data/lib/bel_parser/parsers/common/string.rl +4 -4
- data/lib/bel_parser/parsers/common.rb +1 -0
- data/lib/bel_parser/parsers/expression/nested_statement.rb +30180 -29055
- data/lib/bel_parser/parsers/expression/observed_term.rb +1456 -1099
- data/lib/bel_parser/parsers/expression/parameter.rb +192 -111
- data/lib/bel_parser/parsers/expression/parameter.rl +6 -3
- data/lib/bel_parser/parsers/expression/relationship.rb +43 -19
- data/lib/bel_parser/parsers/expression/relationship.rl +1 -0
- data/lib/bel_parser/parsers/expression/simple_statement.rb +17805 -17093
- data/lib/bel_parser/parsers/expression/statement_autocomplete.rb +1035 -0
- data/lib/bel_parser/parsers/expression/statement_autocomplete.rl +736 -0
- data/lib/bel_parser/parsers/expression/term.rb +960 -705
- data/lib/bel_parser/parsers/serializer.rb +8 -4
- data/lib/bel_parser/version.rb +33 -0
- data/lib/bel_parser.rb +3 -0
- metadata +25 -3
@@ -0,0 +1,275 @@
|
|
1
|
+
|
2
|
+
# begin: ragel
|
3
|
+
=begin
|
4
|
+
|
5
|
+
|
6
|
+
=end
|
7
|
+
# end: ragel
|
8
|
+
|
9
|
+
require_relative '../ast/node'
|
10
|
+
require_relative '../mixin/buffer'
|
11
|
+
require_relative '../nonblocking_io_wrapper'
|
12
|
+
require_relative '../tracer'
|
13
|
+
|
14
|
+
module BELParser
|
15
|
+
module Parsers
|
16
|
+
module Common
|
17
|
+
module MultiIdentifier
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
MAX_LENGTH = 1024 * 128 # 128K
|
22
|
+
|
23
|
+
def parse(content)
|
24
|
+
return nil unless content
|
25
|
+
|
26
|
+
Parser.new(content).each do |obj|
|
27
|
+
yield obj
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
class Parser
|
35
|
+
include Enumerable
|
36
|
+
include BELParser::Parsers::Buffer
|
37
|
+
include BELParser::Parsers::AST::Sexp
|
38
|
+
include BELParser::Parsers::Tracer
|
39
|
+
|
40
|
+
def initialize(content)
|
41
|
+
@content = content
|
42
|
+
# begin: ragel
|
43
|
+
|
44
|
+
class << self
|
45
|
+
attr_accessor :_bel_trans_keys
|
46
|
+
private :_bel_trans_keys, :_bel_trans_keys=
|
47
|
+
end
|
48
|
+
self._bel_trans_keys = [
|
49
|
+
0, 0, 76, 78, 10, 78,
|
50
|
+
0
|
51
|
+
]
|
52
|
+
|
53
|
+
class << self
|
54
|
+
attr_accessor :_bel_key_spans
|
55
|
+
private :_bel_key_spans, :_bel_key_spans=
|
56
|
+
end
|
57
|
+
self._bel_key_spans = [
|
58
|
+
0, 3, 69
|
59
|
+
]
|
60
|
+
|
61
|
+
class << self
|
62
|
+
attr_accessor :_bel_index_offsets
|
63
|
+
private :_bel_index_offsets, :_bel_index_offsets=
|
64
|
+
end
|
65
|
+
self._bel_index_offsets = [
|
66
|
+
0, 0, 4
|
67
|
+
]
|
68
|
+
|
69
|
+
class << self
|
70
|
+
attr_accessor :_bel_indicies
|
71
|
+
private :_bel_indicies, :_bel_indicies=
|
72
|
+
end
|
73
|
+
self._bel_indicies = [
|
74
|
+
1, 0, 1, 0, 3, 2, 2, 2,
|
75
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
76
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
77
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
78
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
79
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
80
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
81
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
82
|
+
2, 2, 2, 2, 2, 2, 4, 2,
|
83
|
+
4, 2, 0
|
84
|
+
]
|
85
|
+
|
86
|
+
class << self
|
87
|
+
attr_accessor :_bel_trans_targs
|
88
|
+
private :_bel_trans_targs, :_bel_trans_targs=
|
89
|
+
end
|
90
|
+
self._bel_trans_targs = [
|
91
|
+
2, 0, 2, 2, 0
|
92
|
+
]
|
93
|
+
|
94
|
+
class << self
|
95
|
+
attr_accessor :_bel_trans_actions
|
96
|
+
private :_bel_trans_actions, :_bel_trans_actions=
|
97
|
+
end
|
98
|
+
self._bel_trans_actions = [
|
99
|
+
1, 0, 0, 3, 4
|
100
|
+
]
|
101
|
+
|
102
|
+
class << self
|
103
|
+
attr_accessor :_bel_eof_actions
|
104
|
+
private :_bel_eof_actions, :_bel_eof_actions=
|
105
|
+
end
|
106
|
+
self._bel_eof_actions = [
|
107
|
+
0, 0, 2
|
108
|
+
]
|
109
|
+
|
110
|
+
class << self
|
111
|
+
attr_accessor :bel_start
|
112
|
+
end
|
113
|
+
self.bel_start = 1;
|
114
|
+
class << self
|
115
|
+
attr_accessor :bel_first_final
|
116
|
+
end
|
117
|
+
self.bel_first_final = 2;
|
118
|
+
class << self
|
119
|
+
attr_accessor :bel_error
|
120
|
+
end
|
121
|
+
self.bel_error = 0;
|
122
|
+
|
123
|
+
class << self
|
124
|
+
attr_accessor :bel_en_multi_ident_node
|
125
|
+
end
|
126
|
+
self.bel_en_multi_ident_node = 1;
|
127
|
+
|
128
|
+
|
129
|
+
# end: ragel
|
130
|
+
end
|
131
|
+
|
132
|
+
def each
|
133
|
+
@buffers = {}
|
134
|
+
@incomplete = {}
|
135
|
+
data = @content.unpack('C*')
|
136
|
+
p = 0
|
137
|
+
id_start = 0
|
138
|
+
id_end = 0
|
139
|
+
pe = data.length
|
140
|
+
eof = data.length
|
141
|
+
|
142
|
+
identifier_started = false
|
143
|
+
# begin: ragel
|
144
|
+
|
145
|
+
begin
|
146
|
+
p ||= 0
|
147
|
+
pe ||= data.length
|
148
|
+
cs = bel_start
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
begin
|
153
|
+
testEof = false
|
154
|
+
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
155
|
+
_goto_level = 0
|
156
|
+
_resume = 10
|
157
|
+
_eof_trans = 15
|
158
|
+
_again = 20
|
159
|
+
_test_eof = 30
|
160
|
+
_out = 40
|
161
|
+
while true
|
162
|
+
if _goto_level <= 0
|
163
|
+
if p == pe
|
164
|
+
_goto_level = _test_eof
|
165
|
+
next
|
166
|
+
end
|
167
|
+
if cs == 0
|
168
|
+
_goto_level = _out
|
169
|
+
next
|
170
|
+
end
|
171
|
+
end
|
172
|
+
if _goto_level <= _resume
|
173
|
+
_keys = cs << 1
|
174
|
+
_inds = _bel_index_offsets[cs]
|
175
|
+
_slen = _bel_key_spans[cs]
|
176
|
+
_wide = data[p].ord
|
177
|
+
_trans = if ( _slen > 0 &&
|
178
|
+
_bel_trans_keys[_keys] <= _wide &&
|
179
|
+
_wide <= _bel_trans_keys[_keys + 1]
|
180
|
+
) then
|
181
|
+
_bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
|
182
|
+
else
|
183
|
+
_bel_indicies[ _inds + _slen ]
|
184
|
+
end
|
185
|
+
cs = _bel_trans_targs[_trans]
|
186
|
+
if _bel_trans_actions[_trans] != 0
|
187
|
+
case _bel_trans_actions[_trans]
|
188
|
+
when 1 then
|
189
|
+
begin
|
190
|
+
|
191
|
+
trace('IDENTIFIER start_multi_identifier')
|
192
|
+
@multi_identifier_started = true
|
193
|
+
multi_id_start = p;
|
194
|
+
end
|
195
|
+
when 3 then
|
196
|
+
begin
|
197
|
+
|
198
|
+
trace('IDENTIFIER end_multi_identifier')
|
199
|
+
# exclude the NL from the chars
|
200
|
+
multi_id_end = p - 1
|
201
|
+
chars = data[multi_id_start...multi_id_end]
|
202
|
+
completed = !chars.empty?
|
203
|
+
ast_node = multi_identifier(utf8_string(chars), complete: completed, character_range: [multi_id_start, multi_id_end])
|
204
|
+
@buffers[:multi_ident] = ast_node
|
205
|
+
end
|
206
|
+
when 4 then
|
207
|
+
begin
|
208
|
+
|
209
|
+
trace('IDENTIFIER multi_ident_node_err')
|
210
|
+
multi_id_end = p
|
211
|
+
chars = data[multi_id_start...multi_id_end]
|
212
|
+
ast_node = multi_identifier(utf8_string(chars), complete: false, character_range: [multi_id_start, multi_id_end])
|
213
|
+
yield ast_node
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
if _goto_level <= _again
|
219
|
+
if cs == 0
|
220
|
+
_goto_level = _out
|
221
|
+
next
|
222
|
+
end
|
223
|
+
p += 1
|
224
|
+
if p != pe
|
225
|
+
_goto_level = _resume
|
226
|
+
next
|
227
|
+
end
|
228
|
+
end
|
229
|
+
if _goto_level <= _test_eof
|
230
|
+
if p == eof
|
231
|
+
case _bel_eof_actions[cs]
|
232
|
+
when 2 then
|
233
|
+
begin
|
234
|
+
|
235
|
+
trace('IDENTIFIER end_multi_identifier')
|
236
|
+
# exclude the NL from the chars
|
237
|
+
multi_id_end = p - 1
|
238
|
+
chars = data[multi_id_start...multi_id_end]
|
239
|
+
completed = !chars.empty?
|
240
|
+
ast_node = multi_identifier(utf8_string(chars), complete: completed, character_range: [multi_id_start, multi_id_end])
|
241
|
+
@buffers[:multi_ident] = ast_node
|
242
|
+
end
|
243
|
+
begin
|
244
|
+
|
245
|
+
trace('IDENTIFIER yield_multi_identifier')
|
246
|
+
yield @buffers[:multi_ident]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
if _goto_level <= _out
|
253
|
+
break
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# end: ragel
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if __FILE__ == $0
|
267
|
+
$stdin.each_line do |line|
|
268
|
+
BELParser::Parsers::Common::MultiIdentifier.parse(line) { |obj|
|
269
|
+
puts obj.inspect
|
270
|
+
}
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
# vim: ft=ruby ts=2 sw=2:
|
275
|
+
# encoding: utf-8
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# begin: ragel
|
2
|
+
=begin
|
3
|
+
%%{
|
4
|
+
machine bel;
|
5
|
+
|
6
|
+
include 'common.rl';
|
7
|
+
|
8
|
+
action start_multi_identifier {
|
9
|
+
trace('IDENTIFIER start_multi_identifier')
|
10
|
+
@multi_identifier_started = true
|
11
|
+
multi_id_start = p;
|
12
|
+
}
|
13
|
+
|
14
|
+
action end_multi_identifier {
|
15
|
+
trace('IDENTIFIER end_multi_identifier')
|
16
|
+
# exclude the NL from the chars
|
17
|
+
multi_id_end = p - 1
|
18
|
+
chars = data[multi_id_start...multi_id_end]
|
19
|
+
completed = !chars.empty?
|
20
|
+
ast_node = multi_identifier(utf8_string(chars), complete: completed, character_range: [multi_id_start, multi_id_end])
|
21
|
+
@buffers[:multi_ident] = ast_node
|
22
|
+
}
|
23
|
+
|
24
|
+
action an_ident_err {
|
25
|
+
trace('IDENTIFIER a_multi_ident_err')
|
26
|
+
multi_id_end = p
|
27
|
+
chars = data[multi_id_start...multi_id_end]
|
28
|
+
ast_node = multi_identifier(utf8_string(chars), complete: false, character_range: [multi_id_start, multi_id_end])
|
29
|
+
@buffers[:multi_ident] = ast_node
|
30
|
+
}
|
31
|
+
|
32
|
+
action multi_ident_node_err {
|
33
|
+
trace('IDENTIFIER multi_ident_node_err')
|
34
|
+
multi_id_end = p
|
35
|
+
chars = data[multi_id_start...multi_id_end]
|
36
|
+
ast_node = multi_identifier(utf8_string(chars), complete: false, character_range: [multi_id_start, multi_id_end])
|
37
|
+
yield ast_node
|
38
|
+
}
|
39
|
+
|
40
|
+
action yield_multi_identifier {
|
41
|
+
trace('IDENTIFIER yield_multi_identifier')
|
42
|
+
yield @buffers[:multi_ident]
|
43
|
+
}
|
44
|
+
|
45
|
+
action a_multi_ident_eof {
|
46
|
+
trace('IDENTIFIER a_multi_ident_eof')
|
47
|
+
if @multi_identifier_started
|
48
|
+
multi_id_end = p
|
49
|
+
chars = data[multi_id_start...multi_id_end]
|
50
|
+
completed = !chars.empty?
|
51
|
+
ast_node = multi_identifier(utf8_string(chars), complete: completed, character_range: [multi_id_start, multi_id_end])
|
52
|
+
@buffers[:multi_ident] = ast_node
|
53
|
+
end
|
54
|
+
}
|
55
|
+
|
56
|
+
multi_ident =
|
57
|
+
ALL_BUT_NL
|
58
|
+
>start_multi_identifier
|
59
|
+
%end_multi_identifier
|
60
|
+
;
|
61
|
+
|
62
|
+
multi_ident_node :=
|
63
|
+
multi_ident
|
64
|
+
NL?
|
65
|
+
$err(multi_ident_node_err)
|
66
|
+
%yield_multi_identifier
|
67
|
+
;
|
68
|
+
}%%
|
69
|
+
=end
|
70
|
+
# end: ragel
|
71
|
+
|
72
|
+
require_relative '../ast/node'
|
73
|
+
require_relative '../mixin/buffer'
|
74
|
+
require_relative '../nonblocking_io_wrapper'
|
75
|
+
require_relative '../tracer'
|
76
|
+
|
77
|
+
module BELParser
|
78
|
+
module Parsers
|
79
|
+
module Common
|
80
|
+
module MultiIdentifier
|
81
|
+
|
82
|
+
class << self
|
83
|
+
|
84
|
+
MAX_LENGTH = 1024 * 128 # 128K
|
85
|
+
|
86
|
+
def parse(content)
|
87
|
+
return nil unless content
|
88
|
+
|
89
|
+
Parser.new(content).each do |obj|
|
90
|
+
yield obj
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
class Parser
|
98
|
+
include Enumerable
|
99
|
+
include BELParser::Parsers::Buffer
|
100
|
+
include BELParser::Parsers::AST::Sexp
|
101
|
+
include BELParser::Parsers::Tracer
|
102
|
+
|
103
|
+
def initialize(content)
|
104
|
+
@content = content
|
105
|
+
# begin: ragel
|
106
|
+
%% write data;
|
107
|
+
# end: ragel
|
108
|
+
end
|
109
|
+
|
110
|
+
def each
|
111
|
+
@buffers = {}
|
112
|
+
@incomplete = {}
|
113
|
+
data = @content.unpack('C*')
|
114
|
+
p = 0
|
115
|
+
id_start = 0
|
116
|
+
id_end = 0
|
117
|
+
pe = data.length
|
118
|
+
eof = data.length
|
119
|
+
|
120
|
+
identifier_started = false
|
121
|
+
# begin: ragel
|
122
|
+
%% write init;
|
123
|
+
%% write exec;
|
124
|
+
# end: ragel
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
if __FILE__ == $0
|
133
|
+
$stdin.each_line do |line|
|
134
|
+
BELParser::Parsers::Common::MultiIdentifier.parse(line) { |obj|
|
135
|
+
puts obj.inspect
|
136
|
+
}
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# vim: ft=ruby ts=2 sw=2:
|
141
|
+
# encoding: utf-8
|
@@ -212,7 +212,7 @@ begin
|
|
212
212
|
trace('STRING string_node_err')
|
213
213
|
p_end = p
|
214
214
|
chars = data[p_start...p_end]
|
215
|
-
ast_node = string(utf8_string(chars), complete: false)
|
215
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
216
216
|
yield ast_node
|
217
217
|
end
|
218
218
|
when 6 then
|
@@ -227,7 +227,7 @@ begin
|
|
227
227
|
trace('STRING string_end')
|
228
228
|
completed = @string_opened && @string_closed
|
229
229
|
chars = data[p_start...p_end]
|
230
|
-
ast_node = string(utf8_string(chars), complete: true)
|
230
|
+
ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
|
231
231
|
@buffers[:string] = ast_node
|
232
232
|
end
|
233
233
|
begin
|
@@ -253,7 +253,7 @@ begin
|
|
253
253
|
trace('STRING string_end')
|
254
254
|
completed = @string_opened && @string_closed
|
255
255
|
chars = data[p_start...p_end]
|
256
|
-
ast_node = string(utf8_string(chars), complete: true)
|
256
|
+
ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
|
257
257
|
@buffers[:string] = ast_node
|
258
258
|
end
|
259
259
|
begin
|
@@ -284,7 +284,7 @@ begin
|
|
284
284
|
trace('STRING string_node_err')
|
285
285
|
p_end = p
|
286
286
|
chars = data[p_start...p_end]
|
287
|
-
ast_node = string(utf8_string(chars), complete: false)
|
287
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
288
288
|
yield ast_node
|
289
289
|
end
|
290
290
|
begin
|
@@ -298,7 +298,7 @@ begin
|
|
298
298
|
trace('STRING eof_string')
|
299
299
|
p_end = p
|
300
300
|
chars = data[p_start...p_end]
|
301
|
-
ast_node = string(utf8_string(chars), complete: false)
|
301
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
302
302
|
@buffers[:string] = ast_node
|
303
303
|
end
|
304
304
|
begin
|
@@ -306,7 +306,7 @@ begin
|
|
306
306
|
trace('STRING string_node_err')
|
307
307
|
p_end = p
|
308
308
|
chars = data[p_start...p_end]
|
309
|
-
ast_node = string(utf8_string(chars), complete: false)
|
309
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
310
310
|
yield ast_node
|
311
311
|
end
|
312
312
|
begin
|
@@ -9,7 +9,7 @@
|
|
9
9
|
trace('STRING string_end')
|
10
10
|
completed = @string_opened && @string_closed
|
11
11
|
chars = data[p_start...p_end]
|
12
|
-
ast_node = string(utf8_string(chars), complete: true)
|
12
|
+
ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
|
13
13
|
@buffers[:string] = ast_node
|
14
14
|
}
|
15
15
|
|
@@ -34,7 +34,7 @@
|
|
34
34
|
trace('STRING eof_string')
|
35
35
|
p_end = p
|
36
36
|
chars = data[p_start...p_end]
|
37
|
-
ast_node = string(utf8_string(chars), complete: false)
|
37
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
38
38
|
@buffers[:string] = ast_node
|
39
39
|
}
|
40
40
|
|
@@ -47,7 +47,7 @@
|
|
47
47
|
trace('STRING a_string_err')
|
48
48
|
p_end = p
|
49
49
|
chars = data[p_start...p_end]
|
50
|
-
ast_node = string(utf8_string(chars), complete: false)
|
50
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
51
51
|
@buffers[:string] = ast_node
|
52
52
|
}
|
53
53
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
trace('STRING string_node_err')
|
56
56
|
p_end = p
|
57
57
|
chars = data[p_start...p_end]
|
58
|
-
ast_node = string(utf8_string(chars), complete: false)
|
58
|
+
ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
|
59
59
|
yield ast_node
|
60
60
|
}
|
61
61
|
|