bel_parser 1.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/.gemspec +28 -0
  3. data/CHANGELOG.md +10 -0
  4. data/LICENSE +191 -0
  5. data/README.md +9 -0
  6. data/VERSION +1 -0
  7. data/bin/bel2_termcheck +39 -0
  8. data/lib/bel_parser.rb +17 -0
  9. data/lib/bel_parser/ast_filter.rb +27 -0
  10. data/lib/bel_parser/ast_generator.rb +86 -0
  11. data/lib/bel_parser/ast_validator.rb +40 -0
  12. data/lib/bel_parser/expression/parser.rb +42 -0
  13. data/lib/bel_parser/expression/term_semantics.rb +36 -0
  14. data/lib/bel_parser/language.rb +7 -0
  15. data/lib/bel_parser/language/function.rb +59 -0
  16. data/lib/bel_parser/language/quoting.rb +236 -0
  17. data/lib/bel_parser/language/semantic_ast.rb +604 -0
  18. data/lib/bel_parser/language/semantics/analyzer.rb +59 -0
  19. data/lib/bel_parser/language/signature.rb +39 -0
  20. data/lib/bel_parser/language/specification.rb +49 -0
  21. data/lib/bel_parser/language/syntax/expression/incomplete_node.rb +14 -0
  22. data/lib/bel_parser/language/syntax/expression/invalid_term_function.rb +22 -0
  23. data/lib/bel_parser/language/version1.rb +50 -0
  24. data/lib/bel_parser/language/version1/functions/abundance.rb +85 -0
  25. data/lib/bel_parser/language/version1/functions/biological_process.rb +85 -0
  26. data/lib/bel_parser/language/version1/functions/catalytic_activity.rb +110 -0
  27. data/lib/bel_parser/language/version1/functions/cell_secretion.rb +80 -0
  28. data/lib/bel_parser/language/version1/functions/cell_surface_expression.rb +80 -0
  29. data/lib/bel_parser/language/version1/functions/chaperone_activity.rb +110 -0
  30. data/lib/bel_parser/language/version1/functions/complex_abundance.rb +115 -0
  31. data/lib/bel_parser/language/version1/functions/composite_abundance.rb +80 -0
  32. data/lib/bel_parser/language/version1/functions/degradation.rb +80 -0
  33. data/lib/bel_parser/language/version1/functions/fusion.rb +302 -0
  34. data/lib/bel_parser/language/version1/functions/gene_abundance.rb +125 -0
  35. data/lib/bel_parser/language/version1/functions/gtp_bound_activity.rb +110 -0
  36. data/lib/bel_parser/language/version1/functions/kinase_activity.rb +110 -0
  37. data/lib/bel_parser/language/version1/functions/list.rb +115 -0
  38. data/lib/bel_parser/language/version1/functions/micro_rna_abundance.rb +85 -0
  39. data/lib/bel_parser/language/version1/functions/molecular_activity.rb +80 -0
  40. data/lib/bel_parser/language/version1/functions/pathology.rb +85 -0
  41. data/lib/bel_parser/language/version1/functions/peptidase_activity.rb +110 -0
  42. data/lib/bel_parser/language/version1/functions/phosphatase_activity.rb +110 -0
  43. data/lib/bel_parser/language/version1/functions/products.rb +80 -0
  44. data/lib/bel_parser/language/version1/functions/protein_abundance.rb +245 -0
  45. data/lib/bel_parser/language/version1/functions/protein_modification.rb +167 -0
  46. data/lib/bel_parser/language/version1/functions/reactants.rb +80 -0
  47. data/lib/bel_parser/language/version1/functions/reaction.rb +85 -0
  48. data/lib/bel_parser/language/version1/functions/ribosylation_activity.rb +110 -0
  49. data/lib/bel_parser/language/version1/functions/rna_abundance.rb +125 -0
  50. data/lib/bel_parser/language/version1/functions/substitution.rb +96 -0
  51. data/lib/bel_parser/language/version1/functions/transcriptional_activity.rb +110 -0
  52. data/lib/bel_parser/language/version1/functions/translocation.rb +100 -0
  53. data/lib/bel_parser/language/version1/functions/transport_activity.rb +110 -0
  54. data/lib/bel_parser/language/version1/functions/truncation.rb +82 -0
  55. data/lib/bel_parser/language/version1/return_types/abundance.rb +20 -0
  56. data/lib/bel_parser/language/version1/return_types/any.rb +74 -0
  57. data/lib/bel_parser/language/version1/return_types/biological_process.rb +17 -0
  58. data/lib/bel_parser/language/version1/return_types/catalytic_activity.rb +20 -0
  59. data/lib/bel_parser/language/version1/return_types/chaperone_activity.rb +20 -0
  60. data/lib/bel_parser/language/version1/return_types/complex_abundance.rb +17 -0
  61. data/lib/bel_parser/language/version1/return_types/fusion.rb +17 -0
  62. data/lib/bel_parser/language/version1/return_types/gene_abundance.rb +17 -0
  63. data/lib/bel_parser/language/version1/return_types/gtp_bound_activity.rb +20 -0
  64. data/lib/bel_parser/language/version1/return_types/kinase_activity.rb +20 -0
  65. data/lib/bel_parser/language/version1/return_types/list.rb +17 -0
  66. data/lib/bel_parser/language/version1/return_types/micro_rna_abundance.rb +17 -0
  67. data/lib/bel_parser/language/version1/return_types/molecular_activity.rb +20 -0
  68. data/lib/bel_parser/language/version1/return_types/pathology.rb +17 -0
  69. data/lib/bel_parser/language/version1/return_types/peptidase_activity.rb +20 -0
  70. data/lib/bel_parser/language/version1/return_types/phosphatase_activity.rb +20 -0
  71. data/lib/bel_parser/language/version1/return_types/products.rb +17 -0
  72. data/lib/bel_parser/language/version1/return_types/protein_abundance.rb +17 -0
  73. data/lib/bel_parser/language/version1/return_types/protein_modification.rb +17 -0
  74. data/lib/bel_parser/language/version1/return_types/reactants.rb +17 -0
  75. data/lib/bel_parser/language/version1/return_types/ribosylation_activity.rb +20 -0
  76. data/lib/bel_parser/language/version1/return_types/rna_abundance.rb +17 -0
  77. data/lib/bel_parser/language/version1/return_types/substitution.rb +17 -0
  78. data/lib/bel_parser/language/version1/return_types/transcriptional_activity.rb +20 -0
  79. data/lib/bel_parser/language/version1/return_types/transport_activity.rb +20 -0
  80. data/lib/bel_parser/language/version1/return_types/truncation.rb +17 -0
  81. data/lib/bel_parser/language/version2.rb +50 -0
  82. data/lib/bel_parser/language/version2/functions/abundance.rb +165 -0
  83. data/lib/bel_parser/language/version2/functions/activity.rb +115 -0
  84. data/lib/bel_parser/language/version2/functions/biological_process.rb +85 -0
  85. data/lib/bel_parser/language/version2/functions/cell_secretion.rb +80 -0
  86. data/lib/bel_parser/language/version2/functions/cell_surface_expression.rb +80 -0
  87. data/lib/bel_parser/language/version2/functions/complex_abundance.rb +190 -0
  88. data/lib/bel_parser/language/version2/functions/composite_abundance.rb +80 -0
  89. data/lib/bel_parser/language/version2/functions/degradation.rb +80 -0
  90. data/lib/bel_parser/language/version2/functions/fragment.rb +119 -0
  91. data/lib/bel_parser/language/version2/functions/from_location.rb +85 -0
  92. data/lib/bel_parser/language/version2/functions/fusion.rb +227 -0
  93. data/lib/bel_parser/language/version2/functions/gene_abundance.rb +195 -0
  94. data/lib/bel_parser/language/version2/functions/list.rb +115 -0
  95. data/lib/bel_parser/language/version2/functions/location.rb +85 -0
  96. data/lib/bel_parser/language/version2/functions/micro_rna_abundance.rb +165 -0
  97. data/lib/bel_parser/language/version2/functions/molecular_activity.rb +83 -0
  98. data/lib/bel_parser/language/version2/functions/pathology.rb +85 -0
  99. data/lib/bel_parser/language/version2/functions/products.rb +80 -0
  100. data/lib/bel_parser/language/version2/functions/protein_abundance.rb +285 -0
  101. data/lib/bel_parser/language/version2/functions/protein_modification.rb +167 -0
  102. data/lib/bel_parser/language/version2/functions/reactants.rb +80 -0
  103. data/lib/bel_parser/language/version2/functions/reaction.rb +85 -0
  104. data/lib/bel_parser/language/version2/functions/rna_abundance.rb +195 -0
  105. data/lib/bel_parser/language/version2/functions/to_location.rb +85 -0
  106. data/lib/bel_parser/language/version2/functions/translocation.rb +90 -0
  107. data/lib/bel_parser/language/version2/functions/variant.rb +83 -0
  108. data/lib/bel_parser/language/version2/return_types/abundance.rb +20 -0
  109. data/lib/bel_parser/language/version2/return_types/activity.rb +20 -0
  110. data/lib/bel_parser/language/version2/return_types/any.rb +74 -0
  111. data/lib/bel_parser/language/version2/return_types/biological_process.rb +17 -0
  112. data/lib/bel_parser/language/version2/return_types/complex_abundance.rb +17 -0
  113. data/lib/bel_parser/language/version2/return_types/fragment.rb +20 -0
  114. data/lib/bel_parser/language/version2/return_types/from_location.rb +20 -0
  115. data/lib/bel_parser/language/version2/return_types/fusion.rb +17 -0
  116. data/lib/bel_parser/language/version2/return_types/gene_abundance.rb +17 -0
  117. data/lib/bel_parser/language/version2/return_types/list.rb +17 -0
  118. data/lib/bel_parser/language/version2/return_types/location.rb +20 -0
  119. data/lib/bel_parser/language/version2/return_types/micro_rna_abundance.rb +17 -0
  120. data/lib/bel_parser/language/version2/return_types/molecular_activity.rb +20 -0
  121. data/lib/bel_parser/language/version2/return_types/pathology.rb +17 -0
  122. data/lib/bel_parser/language/version2/return_types/products.rb +17 -0
  123. data/lib/bel_parser/language/version2/return_types/protein_abundance.rb +17 -0
  124. data/lib/bel_parser/language/version2/return_types/protein_modification.rb +17 -0
  125. data/lib/bel_parser/language/version2/return_types/reactants.rb +17 -0
  126. data/lib/bel_parser/language/version2/return_types/rna_abundance.rb +17 -0
  127. data/lib/bel_parser/language/version2/return_types/to_location.rb +20 -0
  128. data/lib/bel_parser/language/version2/return_types/variant.rb +20 -0
  129. data/lib/bel_parser/mixin/line_continuator.rb +15 -0
  130. data/lib/bel_parser/mixin/line_mapping.rb +14 -0
  131. data/lib/bel_parser/parser.rb +54 -0
  132. data/lib/bel_parser/parsers/ast/mapped_traversal.rb +36 -0
  133. data/lib/bel_parser/parsers/ast/node.rb +705 -0
  134. data/lib/bel_parser/parsers/ast/sexp.rb +8 -0
  135. data/lib/bel_parser/parsers/ast/traversal.rb +21 -0
  136. data/lib/bel_parser/parsers/bel_script.rb +4 -0
  137. data/lib/bel_parser/parsers/bel_script/define_annotation.rb +5476 -0
  138. data/lib/bel_parser/parsers/bel_script/define_annotation.rl +141 -0
  139. data/lib/bel_parser/parsers/bel_script/define_namespace.rb +1780 -0
  140. data/lib/bel_parser/parsers/bel_script/define_namespace.rl +121 -0
  141. data/lib/bel_parser/parsers/bel_script/set.rb +4556 -0
  142. data/lib/bel_parser/parsers/bel_script/set.rl +116 -0
  143. data/lib/bel_parser/parsers/bel_script/unset.rb +706 -0
  144. data/lib/bel_parser/parsers/bel_script/unset.rl +95 -0
  145. data/lib/bel_parser/parsers/common.rb +5 -0
  146. data/lib/bel_parser/parsers/common/blank_line.rb +211 -0
  147. data/lib/bel_parser/parsers/common/blank_line.rl +81 -0
  148. data/lib/bel_parser/parsers/common/comment_line.rb +245 -0
  149. data/lib/bel_parser/parsers/common/comment_line.rl +97 -0
  150. data/lib/bel_parser/parsers/common/common.rb +7 -0
  151. data/lib/bel_parser/parsers/common/common.rl +13 -0
  152. data/lib/bel_parser/parsers/common/identifier.rb +289 -0
  153. data/lib/bel_parser/parsers/common/identifier.rl +106 -0
  154. data/lib/bel_parser/parsers/common/list.rb +2142 -0
  155. data/lib/bel_parser/parsers/common/list.rl +144 -0
  156. data/lib/bel_parser/parsers/common/string.rb +271 -0
  157. data/lib/bel_parser/parsers/common/string.rl +107 -0
  158. data/lib/bel_parser/parsers/expression.rb +7 -0
  159. data/lib/bel_parser/parsers/expression/comment.rb +239 -0
  160. data/lib/bel_parser/parsers/expression/comment.rl +97 -0
  161. data/lib/bel_parser/parsers/expression/parameter.rb +1506 -0
  162. data/lib/bel_parser/parsers/expression/parameter.rl +97 -0
  163. data/lib/bel_parser/parsers/expression/relationship.rb +254 -0
  164. data/lib/bel_parser/parsers/expression/relationship.rl +98 -0
  165. data/lib/bel_parser/parsers/expression/statement_nested.rb +17802 -0
  166. data/lib/bel_parser/parsers/expression/statement_nested.rl +141 -0
  167. data/lib/bel_parser/parsers/expression/statement_observed_term.rb +7291 -0
  168. data/lib/bel_parser/parsers/expression/statement_observed_term.rl +92 -0
  169. data/lib/bel_parser/parsers/expression/statement_simple.rb +10475 -0
  170. data/lib/bel_parser/parsers/expression/statement_simple.rl +112 -0
  171. data/lib/bel_parser/parsers/expression/term.rb +3989 -0
  172. data/lib/bel_parser/parsers/expression/term.rl +157 -0
  173. data/lib/bel_parser/parsers/line_parser.rb +92 -0
  174. data/lib/bel_parser/parsers/mixin/buffer.rb +10 -0
  175. data/lib/bel_parser/parsers/nonblocking_io_wrapper.rb +50 -0
  176. data/lib/bel_parser/script/parser.rb +49 -0
  177. data/lib/bel_parser/vendor/ast.rb +17 -0
  178. data/lib/bel_parser/vendor/ast/node.rb +254 -0
  179. data/lib/bel_parser/vendor/ast/processor.rb +12 -0
  180. data/lib/bel_parser/vendor/ast/processor/mixin.rb +282 -0
  181. data/lib/bel_parser/vendor/ast/sexp.rb +30 -0
  182. metadata +226 -0
@@ -0,0 +1,7 @@
1
+ require_relative 'expression/parameter'
2
+ require_relative 'expression/term'
3
+ require_relative 'expression/relationship'
4
+ require_relative 'expression/comment'
5
+ require_relative 'expression/statement_observed_term'
6
+ require_relative 'expression/statement_simple'
7
+ require_relative 'expression/statement_nested'
@@ -0,0 +1,239 @@
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
+
13
+ module BELParser
14
+ module Parsers
15
+ module Expression
16
+ module Comment
17
+
18
+ class << self
19
+
20
+ MAX_LENGTH = 1024 * 128 # 128K
21
+
22
+ def parse(content)
23
+ return nil unless content
24
+
25
+ Parser.new(content).each do |obj|
26
+ yield obj
27
+ end
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ class Parser
34
+ include Enumerable
35
+ include BELParser::Parsers::Buffer
36
+ include BELParser::Parsers::AST::Sexp
37
+
38
+ def initialize(content)
39
+ @content = content
40
+ # begin: ragel
41
+
42
+ class << self
43
+ attr_accessor :_bel_trans_keys
44
+ private :_bel_trans_keys, :_bel_trans_keys=
45
+ end
46
+ self._bel_trans_keys = [
47
+ 0, 0, 10, 47, 47, 47,
48
+ 10, 10, 10, 10, 0,
49
+ 0, 0
50
+ ]
51
+
52
+ class << self
53
+ attr_accessor :_bel_key_spans
54
+ private :_bel_key_spans, :_bel_key_spans=
55
+ end
56
+ self._bel_key_spans = [
57
+ 0, 38, 1, 1, 1, 0
58
+ ]
59
+
60
+ class << self
61
+ attr_accessor :_bel_index_offsets
62
+ private :_bel_index_offsets, :_bel_index_offsets=
63
+ end
64
+ self._bel_index_offsets = [
65
+ 0, 0, 39, 41, 43, 45
66
+ ]
67
+
68
+ class << self
69
+ attr_accessor :_bel_indicies
70
+ private :_bel_indicies, :_bel_indicies=
71
+ end
72
+ self._bel_indicies = [
73
+ 0, 1, 1, 1, 1, 1, 1, 1,
74
+ 1, 1, 1, 1, 1, 1, 1, 1,
75
+ 1, 1, 1, 1, 1, 1, 1, 1,
76
+ 1, 1, 1, 1, 1, 1, 1, 1,
77
+ 1, 1, 1, 1, 1, 2, 1, 3,
78
+ 1, 1, 4, 6, 5, 1, 0
79
+ ]
80
+
81
+ class << self
82
+ attr_accessor :_bel_trans_targs
83
+ private :_bel_trans_targs, :_bel_trans_targs=
84
+ end
85
+ self._bel_trans_targs = [
86
+ 5, 0, 2, 3, 4, 4, 5
87
+ ]
88
+
89
+ class << self
90
+ attr_accessor :_bel_trans_actions
91
+ private :_bel_trans_actions, :_bel_trans_actions=
92
+ end
93
+ self._bel_trans_actions = [
94
+ 1, 0, 0, 0, 2, 3, 4
95
+ ]
96
+
97
+ class << self
98
+ attr_accessor :bel_start
99
+ end
100
+ self.bel_start = 1;
101
+ class << self
102
+ attr_accessor :bel_first_final
103
+ end
104
+ self.bel_first_final = 5;
105
+ class << self
106
+ attr_accessor :bel_error
107
+ end
108
+ self.bel_error = 0;
109
+
110
+ class << self
111
+ attr_accessor :bel_en_comment
112
+ end
113
+ self.bel_en_comment = 1;
114
+
115
+
116
+ # end: ragel
117
+ end
118
+
119
+ def each
120
+ @buffers = {}
121
+ stack = []
122
+ data = @content.unpack('C*')
123
+ p = 0
124
+ pe = data.length
125
+
126
+ # begin: ragel
127
+
128
+ begin
129
+ p ||= 0
130
+ pe ||= data.length
131
+ cs = bel_start
132
+ end
133
+
134
+
135
+ begin
136
+ testEof = false
137
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
138
+ _goto_level = 0
139
+ _resume = 10
140
+ _eof_trans = 15
141
+ _again = 20
142
+ _test_eof = 30
143
+ _out = 40
144
+ while true
145
+ if _goto_level <= 0
146
+ if p == pe
147
+ _goto_level = _test_eof
148
+ next
149
+ end
150
+ if cs == 0
151
+ _goto_level = _out
152
+ next
153
+ end
154
+ end
155
+ if _goto_level <= _resume
156
+ _keys = cs << 1
157
+ _inds = _bel_index_offsets[cs]
158
+ _slen = _bel_key_spans[cs]
159
+ _wide = data[p].ord
160
+ _trans = if ( _slen > 0 &&
161
+ _bel_trans_keys[_keys] <= _wide &&
162
+ _wide <= _bel_trans_keys[_keys + 1]
163
+ ) then
164
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
165
+ else
166
+ _bel_indicies[ _inds + _slen ]
167
+ end
168
+ cs = _bel_trans_targs[_trans]
169
+ if _bel_trans_actions[_trans] != 0
170
+ case _bel_trans_actions[_trans]
171
+ when 3 then
172
+ begin
173
+
174
+ @buffers[:comment] << data[p].ord
175
+ end
176
+ when 1 then
177
+ begin
178
+
179
+ yield @buffers[:comment] || comment(nil)
180
+ end
181
+ when 2 then
182
+ begin
183
+
184
+ @buffers[:comment] = []
185
+ end
186
+ begin
187
+
188
+ @buffers[:comment] << data[p].ord
189
+ end
190
+ when 4 then
191
+ begin
192
+
193
+ @buffers[:comment] = comment(
194
+ utf8_string(@buffers[:comment]))
195
+ end
196
+ begin
197
+
198
+ yield @buffers[:comment] || comment(nil)
199
+ end
200
+ end
201
+ end
202
+ end
203
+ if _goto_level <= _again
204
+ if cs == 0
205
+ _goto_level = _out
206
+ next
207
+ end
208
+ p += 1
209
+ if p != pe
210
+ _goto_level = _resume
211
+ next
212
+ end
213
+ end
214
+ if _goto_level <= _test_eof
215
+ end
216
+ if _goto_level <= _out
217
+ break
218
+ end
219
+ end
220
+ end
221
+
222
+ # end: ragel
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
229
+
230
+ if __FILE__ == $0
231
+ $stdin.each_line do |line|
232
+ BELParser::Parsers::Expression::Comment.parse(line) { |obj|
233
+ puts obj.inspect
234
+ }
235
+ end
236
+ end
237
+
238
+ # vim: ft=ruby ts=2 sw=2:
239
+ # encoding: utf-8
@@ -0,0 +1,97 @@
1
+ # begin: ragel
2
+ =begin
3
+ %%{
4
+ machine bel;
5
+
6
+ include 'common.rl';
7
+
8
+ action start_comment {
9
+ @buffers[:comment] = []
10
+ }
11
+
12
+ action append_comment {
13
+ @buffers[:comment] << fc
14
+ }
15
+
16
+ action finish_comment {
17
+ @buffers[:comment] = comment(
18
+ utf8_string(@buffers[:comment]))
19
+ }
20
+
21
+ action yield_comment {
22
+ yield @buffers[:comment] || comment(nil)
23
+ }
24
+
25
+ COMMENT = '//' ^NL+ >start_comment $append_comment %finish_comment;
26
+
27
+ comment :=
28
+ COMMENT? %yield_comment
29
+ NL;
30
+ }%%
31
+ =end
32
+ # end: ragel
33
+
34
+ require_relative '../ast/node'
35
+ require_relative '../mixin/buffer'
36
+ require_relative '../nonblocking_io_wrapper'
37
+
38
+ module BELParser
39
+ module Parsers
40
+ module Expression
41
+ module Comment
42
+
43
+ class << self
44
+
45
+ MAX_LENGTH = 1024 * 128 # 128K
46
+
47
+ def parse(content)
48
+ return nil unless content
49
+
50
+ Parser.new(content).each do |obj|
51
+ yield obj
52
+ end
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ class Parser
59
+ include Enumerable
60
+ include BELParser::Parsers::Buffer
61
+ include BELParser::Parsers::AST::Sexp
62
+
63
+ def initialize(content)
64
+ @content = content
65
+ # begin: ragel
66
+ %% write data;
67
+ # end: ragel
68
+ end
69
+
70
+ def each
71
+ @buffers = {}
72
+ stack = []
73
+ data = @content.unpack('C*')
74
+ p = 0
75
+ pe = data.length
76
+
77
+ # begin: ragel
78
+ %% write init;
79
+ %% write exec;
80
+ # end: ragel
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ if __FILE__ == $0
89
+ $stdin.each_line do |line|
90
+ BELParser::Parsers::Expression::Comment.parse(line) { |obj|
91
+ puts obj.inspect
92
+ }
93
+ end
94
+ end
95
+
96
+ # vim: ft=ruby ts=2 sw=2:
97
+ # encoding: utf-8
@@ -0,0 +1,1506 @@
1
+
2
+ # begin: ragel
3
+ =begin
4
+
5
+ class << self
6
+ attr_accessor :_bel_trans_keys
7
+ private :_bel_trans_keys, :_bel_trans_keys=
8
+ end
9
+ self._bel_trans_keys = [
10
+ 0, 0, 9, 122, 9, 122,
11
+ 34, 92, 10, 10, 92,
12
+ 92, 10, 122, 10, 122,
13
+ 48, 122, 10, 122, 34, 34,
14
+ 34, 92, 10, 10, 92,
15
+ 92, 0, 0, 0, 0,
16
+ 0, 0, 0
17
+ ]
18
+
19
+ class << self
20
+ attr_accessor :_bel_key_spans
21
+ private :_bel_key_spans, :_bel_key_spans=
22
+ end
23
+ self._bel_key_spans = [
24
+ 0, 114, 114, 59, 1, 1, 113, 113,
25
+ 75, 113, 1, 59, 1, 1, 0, 0,
26
+ 0
27
+ ]
28
+
29
+ class << self
30
+ attr_accessor :_bel_index_offsets
31
+ private :_bel_index_offsets, :_bel_index_offsets=
32
+ end
33
+ self._bel_index_offsets = [
34
+ 0, 0, 115, 230, 290, 292, 294, 408,
35
+ 522, 598, 712, 714, 774, 776, 778, 779,
36
+ 780
37
+ ]
38
+
39
+ class << self
40
+ attr_accessor :_bel_indicies
41
+ private :_bel_indicies, :_bel_indicies=
42
+ end
43
+ self._bel_indicies = [
44
+ 1, 0, 0, 0, 0, 0, 0, 0,
45
+ 0, 0, 0, 0, 0, 0, 0, 0,
46
+ 0, 0, 0, 0, 0, 0, 0, 1,
47
+ 0, 2, 0, 0, 0, 0, 0, 0,
48
+ 0, 0, 0, 0, 0, 0, 0, 3,
49
+ 3, 3, 3, 3, 3, 3, 3, 3,
50
+ 3, 0, 0, 0, 0, 0, 0, 0,
51
+ 3, 3, 3, 3, 3, 3, 3, 3,
52
+ 3, 3, 3, 3, 3, 3, 3, 3,
53
+ 3, 3, 3, 3, 3, 3, 3, 3,
54
+ 3, 3, 0, 0, 0, 0, 3, 0,
55
+ 3, 3, 3, 3, 3, 3, 3, 3,
56
+ 3, 3, 3, 3, 3, 3, 3, 3,
57
+ 3, 3, 3, 3, 3, 3, 3, 3,
58
+ 3, 3, 0, 1, 4, 4, 4, 4,
59
+ 4, 4, 4, 4, 4, 4, 4, 4,
60
+ 4, 4, 4, 4, 4, 4, 4, 4,
61
+ 4, 4, 1, 4, 2, 4, 4, 4,
62
+ 4, 4, 4, 4, 4, 4, 4, 4,
63
+ 4, 4, 5, 5, 5, 5, 5, 5,
64
+ 5, 5, 5, 5, 4, 4, 4, 4,
65
+ 4, 4, 4, 5, 5, 5, 5, 5,
66
+ 5, 5, 5, 5, 5, 5, 5, 5,
67
+ 5, 5, 5, 5, 5, 5, 5, 5,
68
+ 5, 5, 5, 5, 5, 4, 4, 4,
69
+ 4, 5, 4, 5, 5, 5, 5, 5,
70
+ 5, 5, 5, 5, 5, 5, 5, 5,
71
+ 5, 5, 5, 5, 5, 5, 5, 5,
72
+ 5, 5, 5, 5, 5, 4, 7, 6,
73
+ 6, 6, 6, 6, 6, 6, 6, 6,
74
+ 6, 6, 6, 6, 6, 6, 6, 6,
75
+ 6, 6, 6, 6, 6, 6, 6, 6,
76
+ 6, 6, 6, 6, 6, 6, 6, 6,
77
+ 6, 6, 6, 6, 6, 6, 6, 6,
78
+ 6, 6, 6, 6, 6, 6, 6, 6,
79
+ 6, 6, 6, 6, 6, 6, 6, 6,
80
+ 8, 6, 10, 9, 8, 6, 12, 11,
81
+ 11, 11, 11, 11, 11, 11, 11, 11,
82
+ 11, 11, 11, 11, 11, 11, 11, 11,
83
+ 11, 11, 11, 11, 11, 11, 11, 11,
84
+ 11, 11, 11, 11, 11, 11, 11, 11,
85
+ 11, 11, 11, 11, 13, 13, 13, 13,
86
+ 13, 13, 13, 13, 13, 13, 11, 11,
87
+ 11, 11, 11, 11, 11, 13, 13, 13,
88
+ 13, 13, 13, 13, 13, 13, 13, 13,
89
+ 13, 13, 13, 13, 13, 13, 13, 13,
90
+ 13, 13, 13, 13, 13, 13, 13, 11,
91
+ 11, 11, 11, 13, 11, 13, 13, 13,
92
+ 13, 13, 13, 13, 13, 13, 13, 13,
93
+ 13, 13, 13, 13, 13, 13, 13, 13,
94
+ 13, 13, 13, 13, 13, 13, 13, 11,
95
+ 12, 11, 11, 11, 11, 11, 11, 11,
96
+ 11, 11, 11, 11, 11, 11, 11, 11,
97
+ 11, 11, 11, 11, 11, 11, 11, 11,
98
+ 11, 11, 11, 11, 11, 11, 11, 11,
99
+ 11, 11, 11, 11, 11, 11, 14, 14,
100
+ 14, 14, 14, 14, 14, 14, 14, 14,
101
+ 15, 11, 11, 11, 11, 11, 11, 14,
102
+ 14, 14, 14, 14, 14, 14, 14, 14,
103
+ 14, 14, 14, 14, 14, 14, 14, 14,
104
+ 14, 14, 14, 14, 14, 14, 14, 14,
105
+ 14, 11, 11, 11, 11, 14, 11, 14,
106
+ 14, 14, 14, 14, 14, 14, 14, 14,
107
+ 14, 14, 14, 14, 14, 14, 14, 14,
108
+ 14, 14, 14, 14, 14, 14, 14, 14,
109
+ 14, 11, 17, 17, 17, 17, 17, 17,
110
+ 17, 17, 17, 17, 16, 16, 16, 16,
111
+ 16, 16, 16, 17, 17, 17, 17, 17,
112
+ 17, 17, 17, 17, 17, 17, 17, 17,
113
+ 17, 17, 17, 17, 17, 17, 17, 17,
114
+ 17, 17, 17, 17, 17, 16, 16, 16,
115
+ 16, 17, 16, 17, 17, 17, 17, 17,
116
+ 17, 17, 17, 17, 17, 17, 17, 17,
117
+ 17, 17, 17, 17, 17, 17, 17, 17,
118
+ 17, 17, 17, 17, 17, 16, 18, 16,
119
+ 16, 16, 16, 16, 16, 16, 16, 16,
120
+ 16, 16, 16, 16, 16, 16, 16, 16,
121
+ 16, 16, 16, 16, 16, 16, 16, 16,
122
+ 16, 16, 16, 16, 16, 16, 16, 16,
123
+ 16, 16, 16, 16, 19, 19, 19, 19,
124
+ 19, 19, 19, 19, 19, 19, 16, 16,
125
+ 16, 16, 16, 16, 16, 19, 19, 19,
126
+ 19, 19, 19, 19, 19, 19, 19, 19,
127
+ 19, 19, 19, 19, 19, 19, 19, 19,
128
+ 19, 19, 19, 19, 19, 19, 19, 16,
129
+ 16, 16, 16, 19, 16, 19, 19, 19,
130
+ 19, 19, 19, 19, 19, 19, 19, 19,
131
+ 19, 19, 19, 19, 19, 19, 19, 19,
132
+ 19, 19, 19, 19, 19, 19, 19, 16,
133
+ 21, 20, 23, 22, 22, 22, 22, 22,
134
+ 22, 22, 22, 22, 22, 22, 22, 22,
135
+ 22, 22, 22, 22, 22, 22, 22, 22,
136
+ 22, 22, 22, 22, 22, 22, 22, 22,
137
+ 22, 22, 22, 22, 22, 22, 22, 22,
138
+ 22, 22, 22, 22, 22, 22, 22, 22,
139
+ 22, 22, 22, 22, 22, 22, 22, 22,
140
+ 22, 22, 22, 22, 24, 22, 25, 20,
141
+ 24, 22, 26, 26, 26, 0
142
+ ]
143
+
144
+ class << self
145
+ attr_accessor :_bel_trans_targs
146
+ private :_bel_trans_targs, :_bel_trans_targs=
147
+ end
148
+ self._bel_trans_targs = [
149
+ 0, 2, 3, 7, 0, 6, 3, 4,
150
+ 5, 0, 14, 0, 14, 6, 7, 2,
151
+ 0, 9, 15, 9, 0, 11, 11, 12,
152
+ 13, 16, 0
153
+ ]
154
+
155
+ class << self
156
+ attr_accessor :_bel_trans_actions
157
+ private :_bel_trans_actions, :_bel_trans_actions=
158
+ end
159
+ self._bel_trans_actions = [
160
+ 1, 0, 2, 3, 4, 3, 6, 6,
161
+ 6, 5, 7, 8, 9, 10, 10, 11,
162
+ 12, 3, 13, 10, 14, 2, 6, 6,
163
+ 6, 15, 0
164
+ ]
165
+
166
+ class << self
167
+ attr_accessor :_bel_eof_actions
168
+ private :_bel_eof_actions, :_bel_eof_actions=
169
+ end
170
+ self._bel_eof_actions = [
171
+ 0, 1, 4, 5, 5, 5, 8, 8,
172
+ 12, 12, 14, 14, 14, 14, 0, 0,
173
+ 0
174
+ ]
175
+
176
+ class << self
177
+ attr_accessor :bel_start
178
+ end
179
+ self.bel_start = 1;
180
+ class << self
181
+ attr_accessor :bel_first_final
182
+ end
183
+ self.bel_first_final = 14;
184
+ class << self
185
+ attr_accessor :bel_error
186
+ end
187
+ self.bel_error = 0;
188
+
189
+ class << self
190
+ attr_accessor :bel_en_ident
191
+ end
192
+ self.bel_en_ident = 8;
193
+ class << self
194
+ attr_accessor :bel_en_string
195
+ end
196
+ self.bel_en_string = 10;
197
+ class << self
198
+ attr_accessor :bel_en_bel_parameter
199
+ end
200
+ self.bel_en_bel_parameter = 1;
201
+
202
+
203
+ begin
204
+ p ||= 0
205
+ pe ||= data.length
206
+ cs = bel_start
207
+ end
208
+
209
+ begin
210
+ testEof = false
211
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
212
+ _goto_level = 0
213
+ _resume = 10
214
+ _eof_trans = 15
215
+ _again = 20
216
+ _test_eof = 30
217
+ _out = 40
218
+ while true
219
+ if _goto_level <= 0
220
+ if p == pe
221
+ _goto_level = _test_eof
222
+ next
223
+ end
224
+ if cs == 0
225
+ _goto_level = _out
226
+ next
227
+ end
228
+ end
229
+ if _goto_level <= _resume
230
+ _keys = cs << 1
231
+ _inds = _bel_index_offsets[cs]
232
+ _slen = _bel_key_spans[cs]
233
+ _wide = data[p].ord
234
+ _trans = if ( _slen > 0 &&
235
+ _bel_trans_keys[_keys] <= _wide &&
236
+ _wide <= _bel_trans_keys[_keys + 1]
237
+ ) then
238
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
239
+ else
240
+ _bel_indicies[ _inds + _slen ]
241
+ end
242
+ cs = _bel_trans_targs[_trans]
243
+ if _bel_trans_actions[_trans] != 0
244
+ case _bel_trans_actions[_trans]
245
+ when 10 then
246
+ begin
247
+
248
+ (@buffers[:ident] ||= []) << data[p].ord
249
+ end
250
+ when 8 then
251
+ begin
252
+
253
+ unless @buffers[:ident].is_a?(::AST::Node)
254
+ @buffers[:ident] ||= []
255
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
256
+ end
257
+ end
258
+ when 6 then
259
+ begin
260
+
261
+ (@buffers[:string] ||= []) << data[p].ord
262
+ end
263
+ when 5 then
264
+ begin
265
+
266
+ @buffers[:string] ||= []
267
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
268
+ end
269
+ when 3 then
270
+ begin
271
+
272
+ @buffers[:ident] = []
273
+ end
274
+ begin
275
+
276
+ (@buffers[:ident] ||= []) << data[p].ord
277
+ end
278
+ when 13 then
279
+ begin
280
+
281
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
282
+ end
283
+ begin
284
+
285
+ yield @buffers[:ident]
286
+ end
287
+ when 11 then
288
+ begin
289
+
290
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
291
+ end
292
+ begin
293
+
294
+ @buffers[:parameter] = parameter(prefix(@buffers[:ident]))
295
+ end
296
+ when 12 then
297
+ begin
298
+
299
+ unless @buffers[:ident].is_a?(::AST::Node)
300
+ @buffers[:ident] ||= []
301
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
302
+ end
303
+ end
304
+ begin
305
+
306
+ @buffers[:ident] ||= []
307
+ yield @buffers[:ident]
308
+ end
309
+ when 1 then
310
+ begin
311
+
312
+ unless @buffers[:ident].is_a?(::AST::Node)
313
+ @buffers[:ident] ||= []
314
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
315
+ end
316
+ end
317
+ begin
318
+
319
+ @buffers[:string] ||= []
320
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
321
+ end
322
+ when 2 then
323
+ begin
324
+
325
+ @buffers[:string] = []
326
+ end
327
+ begin
328
+
329
+ (@buffers[:string] ||= []) << data[p].ord
330
+ end
331
+ when 15 then
332
+ begin
333
+
334
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
335
+ end
336
+ begin
337
+
338
+ yield @buffers[:string]
339
+ end
340
+ when 4 then
341
+ begin
342
+
343
+ @buffers[:string] ||= []
344
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
345
+ end
346
+ begin
347
+
348
+ unless @buffers[:ident].is_a?(::AST::Node)
349
+ @buffers[:ident] ||= []
350
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
351
+ end
352
+ end
353
+ when 14 then
354
+ begin
355
+
356
+ @buffers[:string] ||= []
357
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
358
+ end
359
+ begin
360
+
361
+ @buffers[:string] ||= []
362
+ yield @buffers[:string]
363
+ end
364
+ when 9 then
365
+ begin
366
+
367
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
368
+ end
369
+ begin
370
+
371
+ @buffers[:parameter] ||= parameter(prefix(nil))
372
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:ident])
373
+ end
374
+ begin
375
+
376
+ yield @buffers[:parameter]
377
+ end
378
+ when 7 then
379
+ begin
380
+
381
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
382
+ end
383
+ begin
384
+
385
+ @buffers[:parameter] ||= parameter(prefix(nil))
386
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:string])
387
+ end
388
+ begin
389
+
390
+ yield @buffers[:parameter]
391
+ end
392
+ end
393
+ end
394
+ end
395
+ if _goto_level <= _again
396
+ if cs == 0
397
+ _goto_level = _out
398
+ next
399
+ end
400
+ p += 1
401
+ if p != pe
402
+ _goto_level = _resume
403
+ next
404
+ end
405
+ end
406
+ if _goto_level <= _test_eof
407
+ if p == eof
408
+ case _bel_eof_actions[cs]
409
+ when 8 then
410
+ begin
411
+
412
+ unless @buffers[:ident].is_a?(::AST::Node)
413
+ @buffers[:ident] ||= []
414
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
415
+ end
416
+ end
417
+ when 5 then
418
+ begin
419
+
420
+ @buffers[:string] ||= []
421
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
422
+ end
423
+ when 12 then
424
+ begin
425
+
426
+ unless @buffers[:ident].is_a?(::AST::Node)
427
+ @buffers[:ident] ||= []
428
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
429
+ end
430
+ end
431
+ begin
432
+
433
+ @buffers[:ident] ||= []
434
+ yield @buffers[:ident]
435
+ end
436
+ when 1 then
437
+ begin
438
+
439
+ unless @buffers[:ident].is_a?(::AST::Node)
440
+ @buffers[:ident] ||= []
441
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
442
+ end
443
+ end
444
+ begin
445
+
446
+ @buffers[:string] ||= []
447
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
448
+ end
449
+ when 4 then
450
+ begin
451
+
452
+ @buffers[:string] ||= []
453
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
454
+ end
455
+ begin
456
+
457
+ unless @buffers[:ident].is_a?(::AST::Node)
458
+ @buffers[:ident] ||= []
459
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
460
+ end
461
+ end
462
+ when 14 then
463
+ begin
464
+
465
+ @buffers[:string] ||= []
466
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
467
+ end
468
+ begin
469
+
470
+ @buffers[:string] ||= []
471
+ yield @buffers[:string]
472
+ end
473
+ end
474
+ end
475
+
476
+ end
477
+ if _goto_level <= _out
478
+ break
479
+ end
480
+ end
481
+ end
482
+
483
+ class << self
484
+ attr_accessor :_bel_trans_keys
485
+ private :_bel_trans_keys, :_bel_trans_keys=
486
+ end
487
+ self._bel_trans_keys = [
488
+ 0, 0, 9, 122, 9, 122,
489
+ 34, 92, 10, 10, 92,
490
+ 92, 10, 122, 10, 122,
491
+ 48, 122, 10, 122, 34, 34,
492
+ 34, 92, 10, 10, 92,
493
+ 92, 0, 0, 0, 0,
494
+ 0, 0, 0
495
+ ]
496
+
497
+ class << self
498
+ attr_accessor :_bel_key_spans
499
+ private :_bel_key_spans, :_bel_key_spans=
500
+ end
501
+ self._bel_key_spans = [
502
+ 0, 114, 114, 59, 1, 1, 113, 113,
503
+ 75, 113, 1, 59, 1, 1, 0, 0,
504
+ 0
505
+ ]
506
+
507
+ class << self
508
+ attr_accessor :_bel_index_offsets
509
+ private :_bel_index_offsets, :_bel_index_offsets=
510
+ end
511
+ self._bel_index_offsets = [
512
+ 0, 0, 115, 230, 290, 292, 294, 408,
513
+ 522, 598, 712, 714, 774, 776, 778, 779,
514
+ 780
515
+ ]
516
+
517
+ class << self
518
+ attr_accessor :_bel_indicies
519
+ private :_bel_indicies, :_bel_indicies=
520
+ end
521
+ self._bel_indicies = [
522
+ 1, 0, 0, 0, 0, 0, 0, 0,
523
+ 0, 0, 0, 0, 0, 0, 0, 0,
524
+ 0, 0, 0, 0, 0, 0, 0, 1,
525
+ 0, 2, 0, 0, 0, 0, 0, 0,
526
+ 0, 0, 0, 0, 0, 0, 0, 3,
527
+ 3, 3, 3, 3, 3, 3, 3, 3,
528
+ 3, 0, 0, 0, 0, 0, 0, 0,
529
+ 3, 3, 3, 3, 3, 3, 3, 3,
530
+ 3, 3, 3, 3, 3, 3, 3, 3,
531
+ 3, 3, 3, 3, 3, 3, 3, 3,
532
+ 3, 3, 0, 0, 0, 0, 3, 0,
533
+ 3, 3, 3, 3, 3, 3, 3, 3,
534
+ 3, 3, 3, 3, 3, 3, 3, 3,
535
+ 3, 3, 3, 3, 3, 3, 3, 3,
536
+ 3, 3, 0, 1, 4, 4, 4, 4,
537
+ 4, 4, 4, 4, 4, 4, 4, 4,
538
+ 4, 4, 4, 4, 4, 4, 4, 4,
539
+ 4, 4, 1, 4, 2, 4, 4, 4,
540
+ 4, 4, 4, 4, 4, 4, 4, 4,
541
+ 4, 4, 5, 5, 5, 5, 5, 5,
542
+ 5, 5, 5, 5, 4, 4, 4, 4,
543
+ 4, 4, 4, 5, 5, 5, 5, 5,
544
+ 5, 5, 5, 5, 5, 5, 5, 5,
545
+ 5, 5, 5, 5, 5, 5, 5, 5,
546
+ 5, 5, 5, 5, 5, 4, 4, 4,
547
+ 4, 5, 4, 5, 5, 5, 5, 5,
548
+ 5, 5, 5, 5, 5, 5, 5, 5,
549
+ 5, 5, 5, 5, 5, 5, 5, 5,
550
+ 5, 5, 5, 5, 5, 4, 7, 6,
551
+ 6, 6, 6, 6, 6, 6, 6, 6,
552
+ 6, 6, 6, 6, 6, 6, 6, 6,
553
+ 6, 6, 6, 6, 6, 6, 6, 6,
554
+ 6, 6, 6, 6, 6, 6, 6, 6,
555
+ 6, 6, 6, 6, 6, 6, 6, 6,
556
+ 6, 6, 6, 6, 6, 6, 6, 6,
557
+ 6, 6, 6, 6, 6, 6, 6, 6,
558
+ 8, 6, 10, 9, 8, 6, 12, 11,
559
+ 11, 11, 11, 11, 11, 11, 11, 11,
560
+ 11, 11, 11, 11, 11, 11, 11, 11,
561
+ 11, 11, 11, 11, 11, 11, 11, 11,
562
+ 11, 11, 11, 11, 11, 11, 11, 11,
563
+ 11, 11, 11, 11, 13, 13, 13, 13,
564
+ 13, 13, 13, 13, 13, 13, 11, 11,
565
+ 11, 11, 11, 11, 11, 13, 13, 13,
566
+ 13, 13, 13, 13, 13, 13, 13, 13,
567
+ 13, 13, 13, 13, 13, 13, 13, 13,
568
+ 13, 13, 13, 13, 13, 13, 13, 11,
569
+ 11, 11, 11, 13, 11, 13, 13, 13,
570
+ 13, 13, 13, 13, 13, 13, 13, 13,
571
+ 13, 13, 13, 13, 13, 13, 13, 13,
572
+ 13, 13, 13, 13, 13, 13, 13, 11,
573
+ 12, 11, 11, 11, 11, 11, 11, 11,
574
+ 11, 11, 11, 11, 11, 11, 11, 11,
575
+ 11, 11, 11, 11, 11, 11, 11, 11,
576
+ 11, 11, 11, 11, 11, 11, 11, 11,
577
+ 11, 11, 11, 11, 11, 11, 14, 14,
578
+ 14, 14, 14, 14, 14, 14, 14, 14,
579
+ 15, 11, 11, 11, 11, 11, 11, 14,
580
+ 14, 14, 14, 14, 14, 14, 14, 14,
581
+ 14, 14, 14, 14, 14, 14, 14, 14,
582
+ 14, 14, 14, 14, 14, 14, 14, 14,
583
+ 14, 11, 11, 11, 11, 14, 11, 14,
584
+ 14, 14, 14, 14, 14, 14, 14, 14,
585
+ 14, 14, 14, 14, 14, 14, 14, 14,
586
+ 14, 14, 14, 14, 14, 14, 14, 14,
587
+ 14, 11, 17, 17, 17, 17, 17, 17,
588
+ 17, 17, 17, 17, 16, 16, 16, 16,
589
+ 16, 16, 16, 17, 17, 17, 17, 17,
590
+ 17, 17, 17, 17, 17, 17, 17, 17,
591
+ 17, 17, 17, 17, 17, 17, 17, 17,
592
+ 17, 17, 17, 17, 17, 16, 16, 16,
593
+ 16, 17, 16, 17, 17, 17, 17, 17,
594
+ 17, 17, 17, 17, 17, 17, 17, 17,
595
+ 17, 17, 17, 17, 17, 17, 17, 17,
596
+ 17, 17, 17, 17, 17, 16, 18, 16,
597
+ 16, 16, 16, 16, 16, 16, 16, 16,
598
+ 16, 16, 16, 16, 16, 16, 16, 16,
599
+ 16, 16, 16, 16, 16, 16, 16, 16,
600
+ 16, 16, 16, 16, 16, 16, 16, 16,
601
+ 16, 16, 16, 16, 19, 19, 19, 19,
602
+ 19, 19, 19, 19, 19, 19, 16, 16,
603
+ 16, 16, 16, 16, 16, 19, 19, 19,
604
+ 19, 19, 19, 19, 19, 19, 19, 19,
605
+ 19, 19, 19, 19, 19, 19, 19, 19,
606
+ 19, 19, 19, 19, 19, 19, 19, 16,
607
+ 16, 16, 16, 19, 16, 19, 19, 19,
608
+ 19, 19, 19, 19, 19, 19, 19, 19,
609
+ 19, 19, 19, 19, 19, 19, 19, 19,
610
+ 19, 19, 19, 19, 19, 19, 19, 16,
611
+ 21, 20, 23, 22, 22, 22, 22, 22,
612
+ 22, 22, 22, 22, 22, 22, 22, 22,
613
+ 22, 22, 22, 22, 22, 22, 22, 22,
614
+ 22, 22, 22, 22, 22, 22, 22, 22,
615
+ 22, 22, 22, 22, 22, 22, 22, 22,
616
+ 22, 22, 22, 22, 22, 22, 22, 22,
617
+ 22, 22, 22, 22, 22, 22, 22, 22,
618
+ 22, 22, 22, 22, 24, 22, 25, 20,
619
+ 24, 22, 26, 26, 26, 0
620
+ ]
621
+
622
+ class << self
623
+ attr_accessor :_bel_trans_targs
624
+ private :_bel_trans_targs, :_bel_trans_targs=
625
+ end
626
+ self._bel_trans_targs = [
627
+ 0, 2, 3, 7, 0, 6, 3, 4,
628
+ 5, 0, 14, 0, 14, 6, 7, 2,
629
+ 0, 9, 15, 9, 0, 11, 11, 12,
630
+ 13, 16, 0
631
+ ]
632
+
633
+ class << self
634
+ attr_accessor :_bel_trans_actions
635
+ private :_bel_trans_actions, :_bel_trans_actions=
636
+ end
637
+ self._bel_trans_actions = [
638
+ 1, 0, 2, 3, 4, 3, 6, 6,
639
+ 6, 5, 7, 8, 9, 10, 10, 11,
640
+ 12, 3, 13, 10, 14, 2, 6, 6,
641
+ 6, 15, 0
642
+ ]
643
+
644
+ class << self
645
+ attr_accessor :_bel_eof_actions
646
+ private :_bel_eof_actions, :_bel_eof_actions=
647
+ end
648
+ self._bel_eof_actions = [
649
+ 0, 1, 4, 5, 5, 5, 8, 8,
650
+ 12, 12, 14, 14, 14, 14, 0, 0,
651
+ 0
652
+ ]
653
+
654
+ class << self
655
+ attr_accessor :bel_start
656
+ end
657
+ self.bel_start = 1;
658
+ class << self
659
+ attr_accessor :bel_first_final
660
+ end
661
+ self.bel_first_final = 14;
662
+ class << self
663
+ attr_accessor :bel_error
664
+ end
665
+ self.bel_error = 0;
666
+
667
+ class << self
668
+ attr_accessor :bel_en_ident
669
+ end
670
+ self.bel_en_ident = 8;
671
+ class << self
672
+ attr_accessor :bel_en_string
673
+ end
674
+ self.bel_en_string = 10;
675
+ class << self
676
+ attr_accessor :bel_en_bel_parameter
677
+ end
678
+ self.bel_en_bel_parameter = 1;
679
+
680
+
681
+ begin
682
+ p ||= 0
683
+ pe ||= data.length
684
+ cs = bel_start
685
+ end
686
+
687
+ begin
688
+ testEof = false
689
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
690
+ _goto_level = 0
691
+ _resume = 10
692
+ _eof_trans = 15
693
+ _again = 20
694
+ _test_eof = 30
695
+ _out = 40
696
+ while true
697
+ if _goto_level <= 0
698
+ if p == pe
699
+ _goto_level = _test_eof
700
+ next
701
+ end
702
+ if cs == 0
703
+ _goto_level = _out
704
+ next
705
+ end
706
+ end
707
+ if _goto_level <= _resume
708
+ _keys = cs << 1
709
+ _inds = _bel_index_offsets[cs]
710
+ _slen = _bel_key_spans[cs]
711
+ _wide = data[p].ord
712
+ _trans = if ( _slen > 0 &&
713
+ _bel_trans_keys[_keys] <= _wide &&
714
+ _wide <= _bel_trans_keys[_keys + 1]
715
+ ) then
716
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
717
+ else
718
+ _bel_indicies[ _inds + _slen ]
719
+ end
720
+ cs = _bel_trans_targs[_trans]
721
+ if _bel_trans_actions[_trans] != 0
722
+ case _bel_trans_actions[_trans]
723
+ when 10 then
724
+ begin
725
+
726
+ (@buffers[:ident] ||= []) << data[p].ord
727
+ end
728
+ when 8 then
729
+ begin
730
+
731
+ unless @buffers[:ident].is_a?(::AST::Node)
732
+ @buffers[:ident] ||= []
733
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
734
+ end
735
+ end
736
+ when 6 then
737
+ begin
738
+
739
+ (@buffers[:string] ||= []) << data[p].ord
740
+ end
741
+ when 5 then
742
+ begin
743
+
744
+ @buffers[:string] ||= []
745
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
746
+ end
747
+ when 3 then
748
+ begin
749
+
750
+ @buffers[:ident] = []
751
+ end
752
+ begin
753
+
754
+ (@buffers[:ident] ||= []) << data[p].ord
755
+ end
756
+ when 13 then
757
+ begin
758
+
759
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
760
+ end
761
+ begin
762
+
763
+ yield @buffers[:ident]
764
+ end
765
+ when 11 then
766
+ begin
767
+
768
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
769
+ end
770
+ begin
771
+
772
+ @buffers[:parameter] = parameter(prefix(@buffers[:ident]))
773
+ end
774
+ when 12 then
775
+ begin
776
+
777
+ unless @buffers[:ident].is_a?(::AST::Node)
778
+ @buffers[:ident] ||= []
779
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
780
+ end
781
+ end
782
+ begin
783
+
784
+ @buffers[:ident] ||= []
785
+ yield @buffers[:ident]
786
+ end
787
+ when 1 then
788
+ begin
789
+
790
+ unless @buffers[:ident].is_a?(::AST::Node)
791
+ @buffers[:ident] ||= []
792
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
793
+ end
794
+ end
795
+ begin
796
+
797
+ @buffers[:string] ||= []
798
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
799
+ end
800
+ when 2 then
801
+ begin
802
+
803
+ @buffers[:string] = []
804
+ end
805
+ begin
806
+
807
+ (@buffers[:string] ||= []) << data[p].ord
808
+ end
809
+ when 15 then
810
+ begin
811
+
812
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
813
+ end
814
+ begin
815
+
816
+ yield @buffers[:string]
817
+ end
818
+ when 4 then
819
+ begin
820
+
821
+ @buffers[:string] ||= []
822
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
823
+ end
824
+ begin
825
+
826
+ unless @buffers[:ident].is_a?(::AST::Node)
827
+ @buffers[:ident] ||= []
828
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
829
+ end
830
+ end
831
+ when 14 then
832
+ begin
833
+
834
+ @buffers[:string] ||= []
835
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
836
+ end
837
+ begin
838
+
839
+ @buffers[:string] ||= []
840
+ yield @buffers[:string]
841
+ end
842
+ when 9 then
843
+ begin
844
+
845
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
846
+ end
847
+ begin
848
+
849
+ @buffers[:parameter] ||= parameter(prefix(nil))
850
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:ident])
851
+ end
852
+ begin
853
+
854
+ yield @buffers[:parameter]
855
+ end
856
+ when 7 then
857
+ begin
858
+
859
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
860
+ end
861
+ begin
862
+
863
+ @buffers[:parameter] ||= parameter(prefix(nil))
864
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:string])
865
+ end
866
+ begin
867
+
868
+ yield @buffers[:parameter]
869
+ end
870
+ end
871
+ end
872
+ end
873
+ if _goto_level <= _again
874
+ if cs == 0
875
+ _goto_level = _out
876
+ next
877
+ end
878
+ p += 1
879
+ if p != pe
880
+ _goto_level = _resume
881
+ next
882
+ end
883
+ end
884
+ if _goto_level <= _test_eof
885
+ if p == eof
886
+ case _bel_eof_actions[cs]
887
+ when 8 then
888
+ begin
889
+
890
+ unless @buffers[:ident].is_a?(::AST::Node)
891
+ @buffers[:ident] ||= []
892
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
893
+ end
894
+ end
895
+ when 5 then
896
+ begin
897
+
898
+ @buffers[:string] ||= []
899
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
900
+ end
901
+ when 12 then
902
+ begin
903
+
904
+ unless @buffers[:ident].is_a?(::AST::Node)
905
+ @buffers[:ident] ||= []
906
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
907
+ end
908
+ end
909
+ begin
910
+
911
+ @buffers[:ident] ||= []
912
+ yield @buffers[:ident]
913
+ end
914
+ when 1 then
915
+ begin
916
+
917
+ unless @buffers[:ident].is_a?(::AST::Node)
918
+ @buffers[:ident] ||= []
919
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
920
+ end
921
+ end
922
+ begin
923
+
924
+ @buffers[:string] ||= []
925
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
926
+ end
927
+ when 4 then
928
+ begin
929
+
930
+ @buffers[:string] ||= []
931
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
932
+ end
933
+ begin
934
+
935
+ unless @buffers[:ident].is_a?(::AST::Node)
936
+ @buffers[:ident] ||= []
937
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
938
+ end
939
+ end
940
+ when 14 then
941
+ begin
942
+
943
+ @buffers[:string] ||= []
944
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
945
+ end
946
+ begin
947
+
948
+ @buffers[:string] ||= []
949
+ yield @buffers[:string]
950
+ end
951
+ end
952
+ end
953
+
954
+ end
955
+ if _goto_level <= _out
956
+ break
957
+ end
958
+ end
959
+ end
960
+
961
+
962
+ =end
963
+ # end: ragel
964
+
965
+ require_relative '../ast/node'
966
+ require_relative '../mixin/buffer'
967
+ require_relative '../nonblocking_io_wrapper'
968
+
969
+ module BELParser
970
+ module Parsers
971
+ module Expression
972
+ module Parameter
973
+
974
+ class << self
975
+
976
+ MAX_LENGTH = 1024 * 128 # 128K
977
+
978
+ def parse(content)
979
+ return nil unless content
980
+
981
+ Parser.new(content).each do |obj|
982
+ yield obj
983
+ end
984
+ end
985
+ end
986
+
987
+ private
988
+
989
+ class Parser
990
+ include Enumerable
991
+ include BELParser::Parsers::Buffer
992
+ include BELParser::Parsers::AST::Sexp
993
+
994
+ def initialize(content)
995
+ @content = content
996
+ # begin: ragel
997
+
998
+ class << self
999
+ attr_accessor :_bel_trans_keys
1000
+ private :_bel_trans_keys, :_bel_trans_keys=
1001
+ end
1002
+ self._bel_trans_keys = [
1003
+ 0, 0, 9, 122, 9, 122,
1004
+ 34, 92, 10, 10, 92,
1005
+ 92, 10, 122, 10, 122,
1006
+ 48, 122, 10, 122, 34, 34,
1007
+ 34, 92, 10, 10, 92,
1008
+ 92, 0, 0, 0, 0,
1009
+ 0, 0, 0
1010
+ ]
1011
+
1012
+ class << self
1013
+ attr_accessor :_bel_key_spans
1014
+ private :_bel_key_spans, :_bel_key_spans=
1015
+ end
1016
+ self._bel_key_spans = [
1017
+ 0, 114, 114, 59, 1, 1, 113, 113,
1018
+ 75, 113, 1, 59, 1, 1, 0, 0,
1019
+ 0
1020
+ ]
1021
+
1022
+ class << self
1023
+ attr_accessor :_bel_index_offsets
1024
+ private :_bel_index_offsets, :_bel_index_offsets=
1025
+ end
1026
+ self._bel_index_offsets = [
1027
+ 0, 0, 115, 230, 290, 292, 294, 408,
1028
+ 522, 598, 712, 714, 774, 776, 778, 779,
1029
+ 780
1030
+ ]
1031
+
1032
+ class << self
1033
+ attr_accessor :_bel_indicies
1034
+ private :_bel_indicies, :_bel_indicies=
1035
+ end
1036
+ self._bel_indicies = [
1037
+ 1, 0, 0, 0, 0, 0, 0, 0,
1038
+ 0, 0, 0, 0, 0, 0, 0, 0,
1039
+ 0, 0, 0, 0, 0, 0, 0, 1,
1040
+ 0, 2, 0, 0, 0, 0, 0, 0,
1041
+ 0, 0, 0, 0, 0, 0, 0, 3,
1042
+ 3, 3, 3, 3, 3, 3, 3, 3,
1043
+ 3, 0, 0, 0, 0, 0, 0, 0,
1044
+ 3, 3, 3, 3, 3, 3, 3, 3,
1045
+ 3, 3, 3, 3, 3, 3, 3, 3,
1046
+ 3, 3, 3, 3, 3, 3, 3, 3,
1047
+ 3, 3, 0, 0, 0, 0, 3, 0,
1048
+ 3, 3, 3, 3, 3, 3, 3, 3,
1049
+ 3, 3, 3, 3, 3, 3, 3, 3,
1050
+ 3, 3, 3, 3, 3, 3, 3, 3,
1051
+ 3, 3, 0, 1, 4, 4, 4, 4,
1052
+ 4, 4, 4, 4, 4, 4, 4, 4,
1053
+ 4, 4, 4, 4, 4, 4, 4, 4,
1054
+ 4, 4, 1, 4, 2, 4, 4, 4,
1055
+ 4, 4, 4, 4, 4, 4, 4, 4,
1056
+ 4, 4, 5, 5, 5, 5, 5, 5,
1057
+ 5, 5, 5, 5, 4, 4, 4, 4,
1058
+ 4, 4, 4, 5, 5, 5, 5, 5,
1059
+ 5, 5, 5, 5, 5, 5, 5, 5,
1060
+ 5, 5, 5, 5, 5, 5, 5, 5,
1061
+ 5, 5, 5, 5, 5, 4, 4, 4,
1062
+ 4, 5, 4, 5, 5, 5, 5, 5,
1063
+ 5, 5, 5, 5, 5, 5, 5, 5,
1064
+ 5, 5, 5, 5, 5, 5, 5, 5,
1065
+ 5, 5, 5, 5, 5, 4, 7, 6,
1066
+ 6, 6, 6, 6, 6, 6, 6, 6,
1067
+ 6, 6, 6, 6, 6, 6, 6, 6,
1068
+ 6, 6, 6, 6, 6, 6, 6, 6,
1069
+ 6, 6, 6, 6, 6, 6, 6, 6,
1070
+ 6, 6, 6, 6, 6, 6, 6, 6,
1071
+ 6, 6, 6, 6, 6, 6, 6, 6,
1072
+ 6, 6, 6, 6, 6, 6, 6, 6,
1073
+ 8, 6, 10, 9, 8, 6, 12, 11,
1074
+ 11, 11, 11, 11, 11, 11, 11, 11,
1075
+ 11, 11, 11, 11, 11, 11, 11, 11,
1076
+ 11, 11, 11, 11, 11, 11, 11, 11,
1077
+ 11, 11, 11, 11, 11, 11, 11, 11,
1078
+ 11, 11, 11, 11, 13, 13, 13, 13,
1079
+ 13, 13, 13, 13, 13, 13, 11, 11,
1080
+ 11, 11, 11, 11, 11, 13, 13, 13,
1081
+ 13, 13, 13, 13, 13, 13, 13, 13,
1082
+ 13, 13, 13, 13, 13, 13, 13, 13,
1083
+ 13, 13, 13, 13, 13, 13, 13, 11,
1084
+ 11, 11, 11, 13, 11, 13, 13, 13,
1085
+ 13, 13, 13, 13, 13, 13, 13, 13,
1086
+ 13, 13, 13, 13, 13, 13, 13, 13,
1087
+ 13, 13, 13, 13, 13, 13, 13, 11,
1088
+ 12, 11, 11, 11, 11, 11, 11, 11,
1089
+ 11, 11, 11, 11, 11, 11, 11, 11,
1090
+ 11, 11, 11, 11, 11, 11, 11, 11,
1091
+ 11, 11, 11, 11, 11, 11, 11, 11,
1092
+ 11, 11, 11, 11, 11, 11, 14, 14,
1093
+ 14, 14, 14, 14, 14, 14, 14, 14,
1094
+ 15, 11, 11, 11, 11, 11, 11, 14,
1095
+ 14, 14, 14, 14, 14, 14, 14, 14,
1096
+ 14, 14, 14, 14, 14, 14, 14, 14,
1097
+ 14, 14, 14, 14, 14, 14, 14, 14,
1098
+ 14, 11, 11, 11, 11, 14, 11, 14,
1099
+ 14, 14, 14, 14, 14, 14, 14, 14,
1100
+ 14, 14, 14, 14, 14, 14, 14, 14,
1101
+ 14, 14, 14, 14, 14, 14, 14, 14,
1102
+ 14, 11, 17, 17, 17, 17, 17, 17,
1103
+ 17, 17, 17, 17, 16, 16, 16, 16,
1104
+ 16, 16, 16, 17, 17, 17, 17, 17,
1105
+ 17, 17, 17, 17, 17, 17, 17, 17,
1106
+ 17, 17, 17, 17, 17, 17, 17, 17,
1107
+ 17, 17, 17, 17, 17, 16, 16, 16,
1108
+ 16, 17, 16, 17, 17, 17, 17, 17,
1109
+ 17, 17, 17, 17, 17, 17, 17, 17,
1110
+ 17, 17, 17, 17, 17, 17, 17, 17,
1111
+ 17, 17, 17, 17, 17, 16, 18, 16,
1112
+ 16, 16, 16, 16, 16, 16, 16, 16,
1113
+ 16, 16, 16, 16, 16, 16, 16, 16,
1114
+ 16, 16, 16, 16, 16, 16, 16, 16,
1115
+ 16, 16, 16, 16, 16, 16, 16, 16,
1116
+ 16, 16, 16, 16, 19, 19, 19, 19,
1117
+ 19, 19, 19, 19, 19, 19, 16, 16,
1118
+ 16, 16, 16, 16, 16, 19, 19, 19,
1119
+ 19, 19, 19, 19, 19, 19, 19, 19,
1120
+ 19, 19, 19, 19, 19, 19, 19, 19,
1121
+ 19, 19, 19, 19, 19, 19, 19, 16,
1122
+ 16, 16, 16, 19, 16, 19, 19, 19,
1123
+ 19, 19, 19, 19, 19, 19, 19, 19,
1124
+ 19, 19, 19, 19, 19, 19, 19, 19,
1125
+ 19, 19, 19, 19, 19, 19, 19, 16,
1126
+ 21, 20, 23, 22, 22, 22, 22, 22,
1127
+ 22, 22, 22, 22, 22, 22, 22, 22,
1128
+ 22, 22, 22, 22, 22, 22, 22, 22,
1129
+ 22, 22, 22, 22, 22, 22, 22, 22,
1130
+ 22, 22, 22, 22, 22, 22, 22, 22,
1131
+ 22, 22, 22, 22, 22, 22, 22, 22,
1132
+ 22, 22, 22, 22, 22, 22, 22, 22,
1133
+ 22, 22, 22, 22, 24, 22, 25, 20,
1134
+ 24, 22, 26, 26, 26, 0
1135
+ ]
1136
+
1137
+ class << self
1138
+ attr_accessor :_bel_trans_targs
1139
+ private :_bel_trans_targs, :_bel_trans_targs=
1140
+ end
1141
+ self._bel_trans_targs = [
1142
+ 0, 2, 3, 7, 0, 6, 3, 4,
1143
+ 5, 0, 14, 0, 14, 6, 7, 2,
1144
+ 0, 9, 15, 9, 0, 11, 11, 12,
1145
+ 13, 16, 0
1146
+ ]
1147
+
1148
+ class << self
1149
+ attr_accessor :_bel_trans_actions
1150
+ private :_bel_trans_actions, :_bel_trans_actions=
1151
+ end
1152
+ self._bel_trans_actions = [
1153
+ 1, 0, 2, 3, 4, 3, 6, 6,
1154
+ 6, 5, 7, 8, 9, 10, 10, 11,
1155
+ 12, 3, 13, 10, 14, 2, 6, 6,
1156
+ 6, 15, 0
1157
+ ]
1158
+
1159
+ class << self
1160
+ attr_accessor :_bel_eof_actions
1161
+ private :_bel_eof_actions, :_bel_eof_actions=
1162
+ end
1163
+ self._bel_eof_actions = [
1164
+ 0, 1, 4, 5, 5, 5, 8, 8,
1165
+ 12, 12, 14, 14, 14, 14, 0, 0,
1166
+ 0
1167
+ ]
1168
+
1169
+ class << self
1170
+ attr_accessor :bel_start
1171
+ end
1172
+ self.bel_start = 1;
1173
+ class << self
1174
+ attr_accessor :bel_first_final
1175
+ end
1176
+ self.bel_first_final = 14;
1177
+ class << self
1178
+ attr_accessor :bel_error
1179
+ end
1180
+ self.bel_error = 0;
1181
+
1182
+ class << self
1183
+ attr_accessor :bel_en_ident
1184
+ end
1185
+ self.bel_en_ident = 8;
1186
+ class << self
1187
+ attr_accessor :bel_en_string
1188
+ end
1189
+ self.bel_en_string = 10;
1190
+ class << self
1191
+ attr_accessor :bel_en_bel_parameter
1192
+ end
1193
+ self.bel_en_bel_parameter = 1;
1194
+
1195
+
1196
+ # end: ragel
1197
+ end
1198
+
1199
+ def each
1200
+ @buffers = {}
1201
+ data = @content.unpack('C*')
1202
+ p = 0
1203
+ pe = data.length
1204
+ eof = data.length
1205
+
1206
+ # begin: ragel
1207
+
1208
+ begin
1209
+ p ||= 0
1210
+ pe ||= data.length
1211
+ cs = bel_start
1212
+ end
1213
+
1214
+
1215
+ begin
1216
+ testEof = false
1217
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
1218
+ _goto_level = 0
1219
+ _resume = 10
1220
+ _eof_trans = 15
1221
+ _again = 20
1222
+ _test_eof = 30
1223
+ _out = 40
1224
+ while true
1225
+ if _goto_level <= 0
1226
+ if p == pe
1227
+ _goto_level = _test_eof
1228
+ next
1229
+ end
1230
+ if cs == 0
1231
+ _goto_level = _out
1232
+ next
1233
+ end
1234
+ end
1235
+ if _goto_level <= _resume
1236
+ _keys = cs << 1
1237
+ _inds = _bel_index_offsets[cs]
1238
+ _slen = _bel_key_spans[cs]
1239
+ _wide = data[p].ord
1240
+ _trans = if ( _slen > 0 &&
1241
+ _bel_trans_keys[_keys] <= _wide &&
1242
+ _wide <= _bel_trans_keys[_keys + 1]
1243
+ ) then
1244
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
1245
+ else
1246
+ _bel_indicies[ _inds + _slen ]
1247
+ end
1248
+ cs = _bel_trans_targs[_trans]
1249
+ if _bel_trans_actions[_trans] != 0
1250
+ case _bel_trans_actions[_trans]
1251
+ when 10 then
1252
+ begin
1253
+
1254
+ (@buffers[:ident] ||= []) << data[p].ord
1255
+ end
1256
+ when 8 then
1257
+ begin
1258
+
1259
+ unless @buffers[:ident].is_a?(::AST::Node)
1260
+ @buffers[:ident] ||= []
1261
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1262
+ end
1263
+ end
1264
+ when 6 then
1265
+ begin
1266
+
1267
+ (@buffers[:string] ||= []) << data[p].ord
1268
+ end
1269
+ when 5 then
1270
+ begin
1271
+
1272
+ @buffers[:string] ||= []
1273
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1274
+ end
1275
+ when 3 then
1276
+ begin
1277
+
1278
+ @buffers[:ident] = []
1279
+ end
1280
+ begin
1281
+
1282
+ (@buffers[:ident] ||= []) << data[p].ord
1283
+ end
1284
+ when 13 then
1285
+ begin
1286
+
1287
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1288
+ end
1289
+ begin
1290
+
1291
+ yield @buffers[:ident]
1292
+ end
1293
+ when 11 then
1294
+ begin
1295
+
1296
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1297
+ end
1298
+ begin
1299
+
1300
+ @buffers[:parameter] = parameter(prefix(@buffers[:ident]))
1301
+ end
1302
+ when 12 then
1303
+ begin
1304
+
1305
+ unless @buffers[:ident].is_a?(::AST::Node)
1306
+ @buffers[:ident] ||= []
1307
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1308
+ end
1309
+ end
1310
+ begin
1311
+
1312
+ @buffers[:ident] ||= []
1313
+ yield @buffers[:ident]
1314
+ end
1315
+ when 1 then
1316
+ begin
1317
+
1318
+ unless @buffers[:ident].is_a?(::AST::Node)
1319
+ @buffers[:ident] ||= []
1320
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1321
+ end
1322
+ end
1323
+ begin
1324
+
1325
+ @buffers[:string] ||= []
1326
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1327
+ end
1328
+ when 2 then
1329
+ begin
1330
+
1331
+ @buffers[:string] = []
1332
+ end
1333
+ begin
1334
+
1335
+ (@buffers[:string] ||= []) << data[p].ord
1336
+ end
1337
+ when 15 then
1338
+ begin
1339
+
1340
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1341
+ end
1342
+ begin
1343
+
1344
+ yield @buffers[:string]
1345
+ end
1346
+ when 4 then
1347
+ begin
1348
+
1349
+ @buffers[:string] ||= []
1350
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1351
+ end
1352
+ begin
1353
+
1354
+ unless @buffers[:ident].is_a?(::AST::Node)
1355
+ @buffers[:ident] ||= []
1356
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1357
+ end
1358
+ end
1359
+ when 14 then
1360
+ begin
1361
+
1362
+ @buffers[:string] ||= []
1363
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1364
+ end
1365
+ begin
1366
+
1367
+ @buffers[:string] ||= []
1368
+ yield @buffers[:string]
1369
+ end
1370
+ when 9 then
1371
+ begin
1372
+
1373
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1374
+ end
1375
+ begin
1376
+
1377
+ @buffers[:parameter] ||= parameter(prefix(nil))
1378
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:ident])
1379
+ end
1380
+ begin
1381
+
1382
+ yield @buffers[:parameter]
1383
+ end
1384
+ when 7 then
1385
+ begin
1386
+
1387
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1388
+ end
1389
+ begin
1390
+
1391
+ @buffers[:parameter] ||= parameter(prefix(nil))
1392
+ @buffers[:parameter] = @buffers[:parameter] << value(@buffers[:string])
1393
+ end
1394
+ begin
1395
+
1396
+ yield @buffers[:parameter]
1397
+ end
1398
+ end
1399
+ end
1400
+ end
1401
+ if _goto_level <= _again
1402
+ if cs == 0
1403
+ _goto_level = _out
1404
+ next
1405
+ end
1406
+ p += 1
1407
+ if p != pe
1408
+ _goto_level = _resume
1409
+ next
1410
+ end
1411
+ end
1412
+ if _goto_level <= _test_eof
1413
+ if p == eof
1414
+ case _bel_eof_actions[cs]
1415
+ when 8 then
1416
+ begin
1417
+
1418
+ unless @buffers[:ident].is_a?(::AST::Node)
1419
+ @buffers[:ident] ||= []
1420
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1421
+ end
1422
+ end
1423
+ when 5 then
1424
+ begin
1425
+
1426
+ @buffers[:string] ||= []
1427
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1428
+ end
1429
+ when 12 then
1430
+ begin
1431
+
1432
+ unless @buffers[:ident].is_a?(::AST::Node)
1433
+ @buffers[:ident] ||= []
1434
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1435
+ end
1436
+ end
1437
+ begin
1438
+
1439
+ @buffers[:ident] ||= []
1440
+ yield @buffers[:ident]
1441
+ end
1442
+ when 1 then
1443
+ begin
1444
+
1445
+ unless @buffers[:ident].is_a?(::AST::Node)
1446
+ @buffers[:ident] ||= []
1447
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1448
+ end
1449
+ end
1450
+ begin
1451
+
1452
+ @buffers[:string] ||= []
1453
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1454
+ end
1455
+ when 4 then
1456
+ begin
1457
+
1458
+ @buffers[:string] ||= []
1459
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1460
+ end
1461
+ begin
1462
+
1463
+ unless @buffers[:ident].is_a?(::AST::Node)
1464
+ @buffers[:ident] ||= []
1465
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1466
+ end
1467
+ end
1468
+ when 14 then
1469
+ begin
1470
+
1471
+ @buffers[:string] ||= []
1472
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1473
+ end
1474
+ begin
1475
+
1476
+ @buffers[:string] ||= []
1477
+ yield @buffers[:string]
1478
+ end
1479
+ end
1480
+ end
1481
+
1482
+ end
1483
+ if _goto_level <= _out
1484
+ break
1485
+ end
1486
+ end
1487
+ end
1488
+
1489
+ # end: ragel
1490
+ end
1491
+ end
1492
+ end
1493
+ end
1494
+ end
1495
+ end
1496
+
1497
+ if __FILE__ == $0
1498
+ $stdin.each_line do |line|
1499
+ BELParser::Parsers::Expression::Parameter.parse(line) { |obj|
1500
+ puts obj.inspect
1501
+ }
1502
+ end
1503
+ end
1504
+
1505
+ # vim: ft=ruby ts=2 sw=2:
1506
+ # encoding: utf-8