bel_parser 1.0.0.alpha.27-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (332) hide show
  1. checksums.yaml +7 -0
  2. data/.gemspec-java +32 -0
  3. data/CHANGELOG.md +10 -0
  4. data/LICENSE +191 -0
  5. data/README.md +20 -0
  6. data/VERSION +1 -0
  7. data/bin/bel2_validator +62 -0
  8. data/bin/bel_script_reader +132 -0
  9. data/lib/bel/translator/plugins/bel_script.rb +38 -0
  10. data/lib/bel/translator/plugins/bel_script/bel_citation_serialization.rb +125 -0
  11. data/lib/bel/translator/plugins/bel_script/bel_discrete_serialization.rb +109 -0
  12. data/lib/bel/translator/plugins/bel_script/bel_top_down_serialization.rb +100 -0
  13. data/lib/bel/translator/plugins/bel_script/nanopub_serialization.rb +79 -0
  14. data/lib/bel/translator/plugins/bel_script/reader.rb +39 -0
  15. data/lib/bel/translator/plugins/bel_script/translator.rb +37 -0
  16. data/lib/bel/translator/plugins/bel_script/writer.rb +180 -0
  17. data/lib/bel_parser.rb +23 -0
  18. data/lib/bel_parser/ast_filter.rb +44 -0
  19. data/lib/bel_parser/ast_generator.rb +83 -0
  20. data/lib/bel_parser/expression.rb +3 -0
  21. data/lib/bel_parser/expression/filter.rb +31 -0
  22. data/lib/bel_parser/expression/parser.rb +72 -0
  23. data/lib/bel_parser/expression/validator.rb +79 -0
  24. data/lib/bel_parser/language.rb +114 -0
  25. data/lib/bel_parser/language/amino_acid.rb +68 -0
  26. data/lib/bel_parser/language/apply_namespace_encoding.rb +98 -0
  27. data/lib/bel_parser/language/base_specification.rb +82 -0
  28. data/lib/bel_parser/language/covalent_protein_modification.rb +56 -0
  29. data/lib/bel_parser/language/expression_validator.rb +68 -0
  30. data/lib/bel_parser/language/function.rb +67 -0
  31. data/lib/bel_parser/language/relationship.rb +102 -0
  32. data/lib/bel_parser/language/semantics.rb +40 -0
  33. data/lib/bel_parser/language/semantics/deeply_nested_statement.rb +65 -0
  34. data/lib/bel_parser/language/semantics/function_deprecation.rb +43 -0
  35. data/lib/bel_parser/language/semantics/list_function_subject.rb +45 -0
  36. data/lib/bel_parser/language/semantics/multiple_subject_object.rb +55 -0
  37. data/lib/bel_parser/language/semantics/non_causal_nested_statement.rb +50 -0
  38. data/lib/bel_parser/language/semantics/non_object_list.rb +56 -0
  39. data/lib/bel_parser/language/semantics/relationship_deprecation.rb +44 -0
  40. data/lib/bel_parser/language/semantics/relationship_not_listable.rb +60 -0
  41. data/lib/bel_parser/language/semantics/signature_mapping.rb +83 -0
  42. data/lib/bel_parser/language/semantics_ast.rb +784 -0
  43. data/lib/bel_parser/language/semantics_ast_warnings.rb +180 -0
  44. data/lib/bel_parser/language/semantics_function.rb +16 -0
  45. data/lib/bel_parser/language/semantics_match.rb +28 -0
  46. data/lib/bel_parser/language/semantics_result.rb +33 -0
  47. data/lib/bel_parser/language/semantics_type_warning.rb +22 -0
  48. data/lib/bel_parser/language/semantics_warning.rb +27 -0
  49. data/lib/bel_parser/language/signature.rb +39 -0
  50. data/lib/bel_parser/language/specification.rb +118 -0
  51. data/lib/bel_parser/language/syntax.rb +38 -0
  52. data/lib/bel_parser/language/syntax/invalid_function.rb +39 -0
  53. data/lib/bel_parser/language/syntax/invalid_relationship.rb +42 -0
  54. data/lib/bel_parser/language/syntax/undefined_namespace.rb +49 -0
  55. data/lib/bel_parser/language/syntax/undefined_namespace_value.rb +44 -0
  56. data/lib/bel_parser/language/syntax_error.rb +32 -0
  57. data/lib/bel_parser/language/syntax_function.rb +16 -0
  58. data/lib/bel_parser/language/syntax_result.rb +32 -0
  59. data/lib/bel_parser/language/syntax_warning.rb +27 -0
  60. data/lib/bel_parser/language/version1_0.rb +20 -0
  61. data/lib/bel_parser/language/version1_0/functions/abundance.rb +83 -0
  62. data/lib/bel_parser/language/version1_0/functions/biological_process.rb +83 -0
  63. data/lib/bel_parser/language/version1_0/functions/catalytic_activity.rb +114 -0
  64. data/lib/bel_parser/language/version1_0/functions/cell_secretion.rb +83 -0
  65. data/lib/bel_parser/language/version1_0/functions/cell_surface_expression.rb +83 -0
  66. data/lib/bel_parser/language/version1_0/functions/chaperone_activity.rb +114 -0
  67. data/lib/bel_parser/language/version1_0/functions/complex_abundance.rb +115 -0
  68. data/lib/bel_parser/language/version1_0/functions/composite_abundance.rb +81 -0
  69. data/lib/bel_parser/language/version1_0/functions/degradation.rb +83 -0
  70. data/lib/bel_parser/language/version1_0/functions/fusion.rb +287 -0
  71. data/lib/bel_parser/language/version1_0/functions/gene_abundance.rb +122 -0
  72. data/lib/bel_parser/language/version1_0/functions/gtp_bound_activity.rb +113 -0
  73. data/lib/bel_parser/language/version1_0/functions/kinase_activity.rb +114 -0
  74. data/lib/bel_parser/language/version1_0/functions/list.rb +114 -0
  75. data/lib/bel_parser/language/version1_0/functions/micro_rna_abundance.rb +85 -0
  76. data/lib/bel_parser/language/version1_0/functions/molecular_activity.rb +82 -0
  77. data/lib/bel_parser/language/version1_0/functions/pathology.rb +83 -0
  78. data/lib/bel_parser/language/version1_0/functions/peptidase_activity.rb +112 -0
  79. data/lib/bel_parser/language/version1_0/functions/phosphatase_activity.rb +112 -0
  80. data/lib/bel_parser/language/version1_0/functions/products.rb +79 -0
  81. data/lib/bel_parser/language/version1_0/functions/protein_abundance.rb +234 -0
  82. data/lib/bel_parser/language/version1_0/functions/protein_modification.rb +179 -0
  83. data/lib/bel_parser/language/version1_0/functions/reactants.rb +79 -0
  84. data/lib/bel_parser/language/version1_0/functions/reaction.rb +86 -0
  85. data/lib/bel_parser/language/version1_0/functions/ribosylation_activity.rb +114 -0
  86. data/lib/bel_parser/language/version1_0/functions/rna_abundance.rb +122 -0
  87. data/lib/bel_parser/language/version1_0/functions/substitution.rb +93 -0
  88. data/lib/bel_parser/language/version1_0/functions/transcriptional_activity.rb +114 -0
  89. data/lib/bel_parser/language/version1_0/functions/translocation.rb +98 -0
  90. data/lib/bel_parser/language/version1_0/functions/transport_activity.rb +115 -0
  91. data/lib/bel_parser/language/version1_0/functions/truncation.rb +81 -0
  92. data/lib/bel_parser/language/version1_0/relationships/acts_in.rb +61 -0
  93. data/lib/bel_parser/language/version1_0/relationships/analogous.rb +41 -0
  94. data/lib/bel_parser/language/version1_0/relationships/association.rb +42 -0
  95. data/lib/bel_parser/language/version1_0/relationships/biomarker_for.rb +42 -0
  96. data/lib/bel_parser/language/version1_0/relationships/causes_no_change.rb +50 -0
  97. data/lib/bel_parser/language/version1_0/relationships/decreases.rb +63 -0
  98. data/lib/bel_parser/language/version1_0/relationships/directly_decreases.rb +56 -0
  99. data/lib/bel_parser/language/version1_0/relationships/directly_increases.rb +56 -0
  100. data/lib/bel_parser/language/version1_0/relationships/has_component.rb +62 -0
  101. data/lib/bel_parser/language/version1_0/relationships/has_components.rb +61 -0
  102. data/lib/bel_parser/language/version1_0/relationships/has_member.rb +48 -0
  103. data/lib/bel_parser/language/version1_0/relationships/has_members.rb +57 -0
  104. data/lib/bel_parser/language/version1_0/relationships/has_modification.rb +54 -0
  105. data/lib/bel_parser/language/version1_0/relationships/has_product.rb +60 -0
  106. data/lib/bel_parser/language/version1_0/relationships/has_variant.rb +54 -0
  107. data/lib/bel_parser/language/version1_0/relationships/includes.rb +59 -0
  108. data/lib/bel_parser/language/version1_0/relationships/increases.rb +63 -0
  109. data/lib/bel_parser/language/version1_0/relationships/is_a.rb +48 -0
  110. data/lib/bel_parser/language/version1_0/relationships/negative_correlation.rb +50 -0
  111. data/lib/bel_parser/language/version1_0/relationships/orthologous.rb +48 -0
  112. data/lib/bel_parser/language/version1_0/relationships/positive_correlation.rb +46 -0
  113. data/lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb +44 -0
  114. data/lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb +53 -0
  115. data/lib/bel_parser/language/version1_0/relationships/reactant_in.rb +60 -0
  116. data/lib/bel_parser/language/version1_0/relationships/sub_process_of.rb +55 -0
  117. data/lib/bel_parser/language/version1_0/relationships/transcribed_to.rb +53 -0
  118. data/lib/bel_parser/language/version1_0/relationships/translated_to.rb +54 -0
  119. data/lib/bel_parser/language/version1_0/relationships/translocates.rb +57 -0
  120. data/lib/bel_parser/language/version1_0/return_types/abundance.rb +20 -0
  121. data/lib/bel_parser/language/version1_0/return_types/any.rb +74 -0
  122. data/lib/bel_parser/language/version1_0/return_types/biological_process.rb +17 -0
  123. data/lib/bel_parser/language/version1_0/return_types/catalytic_activity.rb +20 -0
  124. data/lib/bel_parser/language/version1_0/return_types/chaperone_activity.rb +20 -0
  125. data/lib/bel_parser/language/version1_0/return_types/complex_abundance.rb +17 -0
  126. data/lib/bel_parser/language/version1_0/return_types/fusion.rb +17 -0
  127. data/lib/bel_parser/language/version1_0/return_types/gene_abundance.rb +17 -0
  128. data/lib/bel_parser/language/version1_0/return_types/gtp_bound_activity.rb +20 -0
  129. data/lib/bel_parser/language/version1_0/return_types/kinase_activity.rb +20 -0
  130. data/lib/bel_parser/language/version1_0/return_types/list.rb +17 -0
  131. data/lib/bel_parser/language/version1_0/return_types/micro_rna_abundance.rb +17 -0
  132. data/lib/bel_parser/language/version1_0/return_types/molecular_activity.rb +20 -0
  133. data/lib/bel_parser/language/version1_0/return_types/pathology.rb +17 -0
  134. data/lib/bel_parser/language/version1_0/return_types/peptidase_activity.rb +20 -0
  135. data/lib/bel_parser/language/version1_0/return_types/phosphatase_activity.rb +20 -0
  136. data/lib/bel_parser/language/version1_0/return_types/products.rb +17 -0
  137. data/lib/bel_parser/language/version1_0/return_types/protein_abundance.rb +17 -0
  138. data/lib/bel_parser/language/version1_0/return_types/protein_modification.rb +17 -0
  139. data/lib/bel_parser/language/version1_0/return_types/reactants.rb +17 -0
  140. data/lib/bel_parser/language/version1_0/return_types/ribosylation_activity.rb +20 -0
  141. data/lib/bel_parser/language/version1_0/return_types/rna_abundance.rb +17 -0
  142. data/lib/bel_parser/language/version1_0/return_types/substitution.rb +17 -0
  143. data/lib/bel_parser/language/version1_0/return_types/transcriptional_activity.rb +20 -0
  144. data/lib/bel_parser/language/version1_0/return_types/transport_activity.rb +20 -0
  145. data/lib/bel_parser/language/version1_0/return_types/truncation.rb +17 -0
  146. data/lib/bel_parser/language/version1_0/value_encodings/abundance.rb +21 -0
  147. data/lib/bel_parser/language/version1_0/value_encodings/any.rb +74 -0
  148. data/lib/bel_parser/language/version1_0/value_encodings/biological_process.rb +21 -0
  149. data/lib/bel_parser/language/version1_0/value_encodings/complex_abundance.rb +21 -0
  150. data/lib/bel_parser/language/version1_0/value_encodings/gene_abundance.rb +21 -0
  151. data/lib/bel_parser/language/version1_0/value_encodings/micro_rna_abundance.rb +21 -0
  152. data/lib/bel_parser/language/version1_0/value_encodings/pathology.rb +21 -0
  153. data/lib/bel_parser/language/version1_0/value_encodings/protein_abundance.rb +21 -0
  154. data/lib/bel_parser/language/version1_0/value_encodings/rna_abundance.rb +21 -0
  155. data/lib/bel_parser/language/version2_0.rb +20 -0
  156. data/lib/bel_parser/language/version2_0/functions/abundance.rb +161 -0
  157. data/lib/bel_parser/language/version2_0/functions/activity.rb +118 -0
  158. data/lib/bel_parser/language/version2_0/functions/biological_process.rb +84 -0
  159. data/lib/bel_parser/language/version2_0/functions/cell_secretion.rb +83 -0
  160. data/lib/bel_parser/language/version2_0/functions/cell_surface_expression.rb +83 -0
  161. data/lib/bel_parser/language/version2_0/functions/complex_abundance.rb +190 -0
  162. data/lib/bel_parser/language/version2_0/functions/composite_abundance.rb +81 -0
  163. data/lib/bel_parser/language/version2_0/functions/degradation.rb +83 -0
  164. data/lib/bel_parser/language/version2_0/functions/fragment.rb +116 -0
  165. data/lib/bel_parser/language/version2_0/functions/from_location.rb +85 -0
  166. data/lib/bel_parser/language/version2_0/functions/fusion.rb +203 -0
  167. data/lib/bel_parser/language/version2_0/functions/gene_abundance.rb +192 -0
  168. data/lib/bel_parser/language/version2_0/functions/list.rb +114 -0
  169. data/lib/bel_parser/language/version2_0/functions/location.rb +83 -0
  170. data/lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb +163 -0
  171. data/lib/bel_parser/language/version2_0/functions/molecular_activity.rb +86 -0
  172. data/lib/bel_parser/language/version2_0/functions/pathology.rb +83 -0
  173. data/lib/bel_parser/language/version2_0/functions/products.rb +79 -0
  174. data/lib/bel_parser/language/version2_0/functions/protein_abundance.rb +270 -0
  175. data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +172 -0
  176. data/lib/bel_parser/language/version2_0/functions/reactants.rb +79 -0
  177. data/lib/bel_parser/language/version2_0/functions/reaction.rb +86 -0
  178. data/lib/bel_parser/language/version2_0/functions/rna_abundance.rb +192 -0
  179. data/lib/bel_parser/language/version2_0/functions/to_location.rb +84 -0
  180. data/lib/bel_parser/language/version2_0/functions/translocation.rb +91 -0
  181. data/lib/bel_parser/language/version2_0/functions/variant.rb +80 -0
  182. data/lib/bel_parser/language/version2_0/relationships/acts_in.rb +61 -0
  183. data/lib/bel_parser/language/version2_0/relationships/analogous.rb +45 -0
  184. data/lib/bel_parser/language/version2_0/relationships/association.rb +42 -0
  185. data/lib/bel_parser/language/version2_0/relationships/biomarker_for.rb +46 -0
  186. data/lib/bel_parser/language/version2_0/relationships/causes_no_change.rb +50 -0
  187. data/lib/bel_parser/language/version2_0/relationships/decreases.rb +63 -0
  188. data/lib/bel_parser/language/version2_0/relationships/directly_decreases.rb +56 -0
  189. data/lib/bel_parser/language/version2_0/relationships/directly_increases.rb +56 -0
  190. data/lib/bel_parser/language/version2_0/relationships/has_component.rb +62 -0
  191. data/lib/bel_parser/language/version2_0/relationships/has_components.rb +61 -0
  192. data/lib/bel_parser/language/version2_0/relationships/has_member.rb +48 -0
  193. data/lib/bel_parser/language/version2_0/relationships/has_members.rb +57 -0
  194. data/lib/bel_parser/language/version2_0/relationships/has_modification.rb +54 -0
  195. data/lib/bel_parser/language/version2_0/relationships/has_product.rb +60 -0
  196. data/lib/bel_parser/language/version2_0/relationships/has_variant.rb +54 -0
  197. data/lib/bel_parser/language/version2_0/relationships/includes.rb +59 -0
  198. data/lib/bel_parser/language/version2_0/relationships/increases.rb +63 -0
  199. data/lib/bel_parser/language/version2_0/relationships/is_a.rb +48 -0
  200. data/lib/bel_parser/language/version2_0/relationships/negative_correlation.rb +50 -0
  201. data/lib/bel_parser/language/version2_0/relationships/orthologous.rb +48 -0
  202. data/lib/bel_parser/language/version2_0/relationships/positive_correlation.rb +46 -0
  203. data/lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb +48 -0
  204. data/lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb +53 -0
  205. data/lib/bel_parser/language/version2_0/relationships/reactant_in.rb +60 -0
  206. data/lib/bel_parser/language/version2_0/relationships/regulates.rb +51 -0
  207. data/lib/bel_parser/language/version2_0/relationships/sub_process_of.rb +55 -0
  208. data/lib/bel_parser/language/version2_0/relationships/transcribed_to.rb +53 -0
  209. data/lib/bel_parser/language/version2_0/relationships/translated_to.rb +54 -0
  210. data/lib/bel_parser/language/version2_0/relationships/translocates.rb +57 -0
  211. data/lib/bel_parser/language/version2_0/return_types/abundance.rb +20 -0
  212. data/lib/bel_parser/language/version2_0/return_types/activity.rb +20 -0
  213. data/lib/bel_parser/language/version2_0/return_types/any.rb +74 -0
  214. data/lib/bel_parser/language/version2_0/return_types/biological_process.rb +17 -0
  215. data/lib/bel_parser/language/version2_0/return_types/complex_abundance.rb +17 -0
  216. data/lib/bel_parser/language/version2_0/return_types/fragment.rb +20 -0
  217. data/lib/bel_parser/language/version2_0/return_types/from_location.rb +20 -0
  218. data/lib/bel_parser/language/version2_0/return_types/fusion.rb +17 -0
  219. data/lib/bel_parser/language/version2_0/return_types/gene_abundance.rb +17 -0
  220. data/lib/bel_parser/language/version2_0/return_types/list.rb +17 -0
  221. data/lib/bel_parser/language/version2_0/return_types/location.rb +20 -0
  222. data/lib/bel_parser/language/version2_0/return_types/micro_rna_abundance.rb +17 -0
  223. data/lib/bel_parser/language/version2_0/return_types/molecular_activity.rb +20 -0
  224. data/lib/bel_parser/language/version2_0/return_types/pathology.rb +17 -0
  225. data/lib/bel_parser/language/version2_0/return_types/products.rb +17 -0
  226. data/lib/bel_parser/language/version2_0/return_types/protein_abundance.rb +17 -0
  227. data/lib/bel_parser/language/version2_0/return_types/protein_modification.rb +17 -0
  228. data/lib/bel_parser/language/version2_0/return_types/reactants.rb +17 -0
  229. data/lib/bel_parser/language/version2_0/return_types/rna_abundance.rb +17 -0
  230. data/lib/bel_parser/language/version2_0/return_types/to_location.rb +20 -0
  231. data/lib/bel_parser/language/version2_0/return_types/variant.rb +20 -0
  232. data/lib/bel_parser/language/version2_0/value_encodings/abundance.rb +21 -0
  233. data/lib/bel_parser/language/version2_0/value_encodings/activity.rb +21 -0
  234. data/lib/bel_parser/language/version2_0/value_encodings/any.rb +74 -0
  235. data/lib/bel_parser/language/version2_0/value_encodings/biological_process.rb +21 -0
  236. data/lib/bel_parser/language/version2_0/value_encodings/complex_abundance.rb +21 -0
  237. data/lib/bel_parser/language/version2_0/value_encodings/gene_abundance.rb +21 -0
  238. data/lib/bel_parser/language/version2_0/value_encodings/location.rb +21 -0
  239. data/lib/bel_parser/language/version2_0/value_encodings/micro_rna_abundance.rb +21 -0
  240. data/lib/bel_parser/language/version2_0/value_encodings/pathology.rb +21 -0
  241. data/lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb +21 -0
  242. data/lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb +21 -0
  243. data/lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb +21 -0
  244. data/lib/bel_parser/mixin/line_continuator.rb +15 -0
  245. data/lib/bel_parser/mixin/line_mapping.rb +14 -0
  246. data/lib/bel_parser/parsers/ast/node.rb +987 -0
  247. data/lib/bel_parser/parsers/ast/sexp.rb +8 -0
  248. data/lib/bel_parser/parsers/bel_script.rb +5 -0
  249. data/lib/bel_parser/parsers/bel_script/define_annotation.rb +5920 -0
  250. data/lib/bel_parser/parsers/bel_script/define_annotation.rl +141 -0
  251. data/lib/bel_parser/parsers/bel_script/define_namespace.rb +1780 -0
  252. data/lib/bel_parser/parsers/bel_script/define_namespace.rl +121 -0
  253. data/lib/bel_parser/parsers/bel_script/set.rb +5008 -0
  254. data/lib/bel_parser/parsers/bel_script/set.rl +116 -0
  255. data/lib/bel_parser/parsers/bel_script/set_document.rb +7722 -0
  256. data/lib/bel_parser/parsers/bel_script/set_document.rl +97 -0
  257. data/lib/bel_parser/parsers/bel_script/unset.rb +706 -0
  258. data/lib/bel_parser/parsers/bel_script/unset.rl +95 -0
  259. data/lib/bel_parser/parsers/common.rb +5 -0
  260. data/lib/bel_parser/parsers/common/blank_line.rb +211 -0
  261. data/lib/bel_parser/parsers/common/blank_line.rl +81 -0
  262. data/lib/bel_parser/parsers/common/comment_line.rb +245 -0
  263. data/lib/bel_parser/parsers/common/comment_line.rl +97 -0
  264. data/lib/bel_parser/parsers/common/common.rb +7 -0
  265. data/lib/bel_parser/parsers/common/common.rl +13 -0
  266. data/lib/bel_parser/parsers/common/identifier.rb +289 -0
  267. data/lib/bel_parser/parsers/common/identifier.rl +106 -0
  268. data/lib/bel_parser/parsers/common/list.rb +2388 -0
  269. data/lib/bel_parser/parsers/common/list.rl +146 -0
  270. data/lib/bel_parser/parsers/common/string.rb +271 -0
  271. data/lib/bel_parser/parsers/common/string.rl +107 -0
  272. data/lib/bel_parser/parsers/expression.rb +7 -0
  273. data/lib/bel_parser/parsers/expression/comment.rb +239 -0
  274. data/lib/bel_parser/parsers/expression/comment.rl +97 -0
  275. data/lib/bel_parser/parsers/expression/nested_statement.rb +17802 -0
  276. data/lib/bel_parser/parsers/expression/nested_statement.rl +141 -0
  277. data/lib/bel_parser/parsers/expression/observed_term.rb +7291 -0
  278. data/lib/bel_parser/parsers/expression/observed_term.rl +92 -0
  279. data/lib/bel_parser/parsers/expression/parameter.rb +1506 -0
  280. data/lib/bel_parser/parsers/expression/parameter.rl +97 -0
  281. data/lib/bel_parser/parsers/expression/relationship.rb +254 -0
  282. data/lib/bel_parser/parsers/expression/relationship.rl +98 -0
  283. data/lib/bel_parser/parsers/expression/simple_statement.rb +10475 -0
  284. data/lib/bel_parser/parsers/expression/simple_statement.rl +112 -0
  285. data/lib/bel_parser/parsers/expression/term.rb +3989 -0
  286. data/lib/bel_parser/parsers/expression/term.rl +157 -0
  287. data/lib/bel_parser/parsers/line_parser.rb +92 -0
  288. data/lib/bel_parser/parsers/mixin/buffer.rb +10 -0
  289. data/lib/bel_parser/parsers/nonblocking_io_wrapper.rb +50 -0
  290. data/lib/bel_parser/parsers/serializer.rb +205 -0
  291. data/lib/bel_parser/quoting.rb +177 -0
  292. data/lib/bel_parser/resource/concept.rb +56 -0
  293. data/lib/bel_parser/resource/concept_scheme.rb +35 -0
  294. data/lib/bel_parser/resource/dataset.rb +34 -0
  295. data/lib/bel_parser/resource/eager_reader.rb +89 -0
  296. data/lib/bel_parser/resource/eager_sparql_reader.rb +51 -0
  297. data/lib/bel_parser/resource/file_resource.rb +21 -0
  298. data/lib/bel_parser/resource/file_resource_value.rb +24 -0
  299. data/lib/bel_parser/resource/jena_tdb_reader.rb +246 -0
  300. data/lib/bel_parser/resource/lru_cache.rb +111 -0
  301. data/lib/bel_parser/resource/lru_reader.rb +34 -0
  302. data/lib/bel_parser/resource/reader.rb +18 -0
  303. data/lib/bel_parser/resource/resource_url_reader.rb +181 -0
  304. data/lib/bel_parser/resource/sparql_reader.rb +179 -0
  305. data/lib/bel_parser/resource/value.rb +31 -0
  306. data/lib/bel_parser/script.rb +8 -0
  307. data/lib/bel_parser/script/filter.rb +35 -0
  308. data/lib/bel_parser/script/first_node.rb +21 -0
  309. data/lib/bel_parser/script/keywords.rb +32 -0
  310. data/lib/bel_parser/script/nanopub_mapper.rb +182 -0
  311. data/lib/bel_parser/script/parser.rb +51 -0
  312. data/lib/bel_parser/script/state/annotation_definition.rb +62 -0
  313. data/lib/bel_parser/script/state/bel_version.rb +36 -0
  314. data/lib/bel_parser/script/state/document_property.rb +29 -0
  315. data/lib/bel_parser/script/state/namespace_definition.rb +32 -0
  316. data/lib/bel_parser/script/state/set.rb +82 -0
  317. data/lib/bel_parser/script/state/unset.rb +46 -0
  318. data/lib/bel_parser/script/state_aggregator.rb +49 -0
  319. data/lib/bel_parser/script/state_function.rb +10 -0
  320. data/lib/bel_parser/script/syntax/expression_validation.rb +46 -0
  321. data/lib/bel_parser/script/syntax/invalid_regex_pattern.rb +49 -0
  322. data/lib/bel_parser/script/syntax/undefined_annotation.rb +61 -0
  323. data/lib/bel_parser/script/syntax/undefined_annotation_value.rb +84 -0
  324. data/lib/bel_parser/script/syntax/unresolvable_namespace.rb +54 -0
  325. data/lib/bel_parser/script/syntax/unsupported_bel_version.rb +59 -0
  326. data/lib/bel_parser/script/validator.rb +65 -0
  327. data/lib/bel_parser/vendor/ast.rb +17 -0
  328. data/lib/bel_parser/vendor/ast/node.rb +254 -0
  329. data/lib/bel_parser/vendor/ast/processor.rb +12 -0
  330. data/lib/bel_parser/vendor/ast/processor/mixin.rb +282 -0
  331. data/lib/bel_parser/vendor/ast/sexp.rb +30 -0
  332. metadata +390 -0
@@ -0,0 +1,2388 @@
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, 123, 123, 9, 125,
11
+ 34, 92, 9, 125, 9,
12
+ 125, 9, 122, 9, 125,
13
+ 10, 10, 92, 92, 48, 122,
14
+ 10, 122, 34, 34, 34,
15
+ 92, 10, 10, 92, 92,
16
+ 0, 0, 0, 0, 0, 0,
17
+ 0
18
+ ]
19
+
20
+ class << self
21
+ attr_accessor :_bel_key_spans
22
+ private :_bel_key_spans, :_bel_key_spans=
23
+ end
24
+ self._bel_key_spans = [
25
+ 0, 1, 117, 59, 117, 117, 114, 117,
26
+ 1, 1, 75, 113, 1, 59, 1, 1,
27
+ 0, 0, 0
28
+ ]
29
+
30
+ class << self
31
+ attr_accessor :_bel_index_offsets
32
+ private :_bel_index_offsets, :_bel_index_offsets=
33
+ end
34
+ self._bel_index_offsets = [
35
+ 0, 0, 2, 120, 180, 298, 416, 531,
36
+ 649, 651, 653, 729, 843, 845, 905, 907,
37
+ 909, 910, 911
38
+ ]
39
+
40
+ class << self
41
+ attr_accessor :_bel_indicies
42
+ private :_bel_indicies, :_bel_indicies=
43
+ end
44
+ self._bel_indicies = [
45
+ 1, 0, 3, 2, 2, 2, 2, 2,
46
+ 2, 2, 2, 2, 2, 2, 2, 2,
47
+ 2, 2, 2, 2, 2, 2, 2, 2,
48
+ 2, 3, 2, 4, 2, 2, 2, 2,
49
+ 2, 2, 2, 2, 2, 5, 2, 2,
50
+ 2, 6, 6, 6, 6, 6, 6, 6,
51
+ 6, 6, 6, 2, 2, 2, 2, 2,
52
+ 2, 2, 6, 6, 6, 6, 6, 6,
53
+ 6, 6, 6, 6, 6, 6, 6, 6,
54
+ 6, 6, 6, 6, 6, 6, 6, 6,
55
+ 6, 6, 6, 6, 2, 2, 2, 2,
56
+ 6, 2, 6, 6, 6, 6, 6, 6,
57
+ 6, 6, 6, 6, 6, 6, 6, 6,
58
+ 6, 6, 6, 6, 6, 6, 6, 6,
59
+ 6, 6, 6, 6, 2, 2, 7, 2,
60
+ 9, 8, 8, 8, 8, 8, 8, 8,
61
+ 8, 8, 8, 8, 8, 8, 8, 8,
62
+ 8, 8, 8, 8, 8, 8, 8, 8,
63
+ 8, 8, 8, 8, 8, 8, 8, 8,
64
+ 8, 8, 8, 8, 8, 8, 8, 8,
65
+ 8, 8, 8, 8, 8, 8, 8, 8,
66
+ 8, 8, 8, 8, 8, 8, 8, 8,
67
+ 8, 8, 10, 8, 12, 11, 11, 11,
68
+ 11, 11, 11, 11, 11, 11, 11, 11,
69
+ 11, 11, 11, 11, 11, 11, 11, 11,
70
+ 11, 11, 11, 12, 11, 11, 11, 11,
71
+ 11, 11, 11, 11, 11, 11, 11, 13,
72
+ 11, 11, 11, 11, 11, 11, 11, 11,
73
+ 11, 11, 11, 11, 11, 11, 11, 11,
74
+ 11, 11, 11, 11, 11, 11, 11, 11,
75
+ 11, 11, 11, 11, 11, 11, 11, 11,
76
+ 11, 11, 11, 11, 11, 11, 11, 11,
77
+ 11, 11, 11, 11, 11, 11, 11, 11,
78
+ 11, 11, 11, 11, 11, 11, 11, 11,
79
+ 11, 11, 11, 11, 11, 11, 11, 11,
80
+ 11, 11, 11, 11, 11, 11, 11, 11,
81
+ 11, 11, 11, 11, 11, 11, 11, 11,
82
+ 14, 11, 15, 0, 0, 0, 0, 0,
83
+ 0, 0, 0, 0, 0, 0, 0, 0,
84
+ 0, 0, 0, 0, 0, 0, 0, 0,
85
+ 0, 15, 0, 0, 0, 0, 0, 0,
86
+ 0, 0, 0, 0, 0, 16, 0, 0,
87
+ 0, 0, 0, 0, 0, 0, 0, 0,
88
+ 0, 0, 0, 0, 0, 0, 0, 0,
89
+ 0, 0, 0, 0, 0, 0, 0, 0,
90
+ 0, 0, 0, 0, 0, 0, 0, 0,
91
+ 0, 0, 0, 0, 0, 0, 0, 0,
92
+ 0, 0, 0, 0, 0, 0, 0, 0,
93
+ 0, 0, 0, 0, 0, 0, 0, 0,
94
+ 0, 0, 0, 0, 0, 0, 0, 0,
95
+ 0, 0, 0, 0, 0, 0, 0, 0,
96
+ 0, 0, 0, 0, 0, 0, 17, 0,
97
+ 18, 2, 2, 2, 2, 2, 2, 2,
98
+ 2, 2, 2, 2, 2, 2, 2, 2,
99
+ 2, 2, 2, 2, 2, 2, 2, 18,
100
+ 2, 4, 2, 2, 2, 2, 2, 2,
101
+ 2, 2, 2, 2, 2, 2, 2, 6,
102
+ 6, 6, 6, 6, 6, 6, 6, 6,
103
+ 6, 2, 2, 2, 2, 2, 2, 2,
104
+ 6, 6, 6, 6, 6, 6, 6, 6,
105
+ 6, 6, 6, 6, 6, 6, 6, 6,
106
+ 6, 6, 6, 6, 6, 6, 6, 6,
107
+ 6, 6, 2, 2, 2, 2, 6, 2,
108
+ 6, 6, 6, 6, 6, 6, 6, 6,
109
+ 6, 6, 6, 6, 6, 6, 6, 6,
110
+ 6, 6, 6, 6, 6, 6, 6, 6,
111
+ 6, 6, 2, 20, 19, 19, 19, 19,
112
+ 19, 19, 19, 19, 19, 19, 19, 19,
113
+ 19, 19, 19, 19, 19, 19, 19, 19,
114
+ 19, 19, 20, 19, 19, 19, 19, 19,
115
+ 19, 19, 19, 19, 19, 19, 21, 19,
116
+ 19, 19, 22, 22, 22, 22, 22, 22,
117
+ 22, 22, 22, 22, 19, 19, 19, 19,
118
+ 19, 19, 19, 22, 22, 22, 22, 22,
119
+ 22, 22, 22, 22, 22, 22, 22, 22,
120
+ 22, 22, 22, 22, 22, 22, 22, 22,
121
+ 22, 22, 22, 22, 22, 19, 19, 19,
122
+ 19, 22, 19, 22, 22, 22, 22, 22,
123
+ 22, 22, 22, 22, 22, 22, 22, 22,
124
+ 22, 22, 22, 22, 22, 22, 22, 22,
125
+ 22, 22, 22, 22, 22, 19, 19, 23,
126
+ 19, 24, 0, 10, 8, 26, 26, 26,
127
+ 26, 26, 26, 26, 26, 26, 26, 25,
128
+ 25, 25, 25, 25, 25, 25, 26, 26,
129
+ 26, 26, 26, 26, 26, 26, 26, 26,
130
+ 26, 26, 26, 26, 26, 26, 26, 26,
131
+ 26, 26, 26, 26, 26, 26, 26, 26,
132
+ 25, 25, 25, 25, 26, 25, 26, 26,
133
+ 26, 26, 26, 26, 26, 26, 26, 26,
134
+ 26, 26, 26, 26, 26, 26, 26, 26,
135
+ 26, 26, 26, 26, 26, 26, 26, 26,
136
+ 25, 27, 25, 25, 25, 25, 25, 25,
137
+ 25, 25, 25, 25, 25, 25, 25, 25,
138
+ 25, 25, 25, 25, 25, 25, 25, 25,
139
+ 25, 25, 25, 25, 25, 25, 25, 25,
140
+ 25, 25, 25, 25, 25, 25, 25, 28,
141
+ 28, 28, 28, 28, 28, 28, 28, 28,
142
+ 28, 25, 25, 25, 25, 25, 25, 25,
143
+ 28, 28, 28, 28, 28, 28, 28, 28,
144
+ 28, 28, 28, 28, 28, 28, 28, 28,
145
+ 28, 28, 28, 28, 28, 28, 28, 28,
146
+ 28, 28, 25, 25, 25, 25, 28, 25,
147
+ 28, 28, 28, 28, 28, 28, 28, 28,
148
+ 28, 28, 28, 28, 28, 28, 28, 28,
149
+ 28, 28, 28, 28, 28, 28, 28, 28,
150
+ 28, 28, 25, 30, 29, 32, 31, 31,
151
+ 31, 31, 31, 31, 31, 31, 31, 31,
152
+ 31, 31, 31, 31, 31, 31, 31, 31,
153
+ 31, 31, 31, 31, 31, 31, 31, 31,
154
+ 31, 31, 31, 31, 31, 31, 31, 31,
155
+ 31, 31, 31, 31, 31, 31, 31, 31,
156
+ 31, 31, 31, 31, 31, 31, 31, 31,
157
+ 31, 31, 31, 31, 31, 31, 31, 33,
158
+ 31, 34, 29, 33, 31, 35, 35, 35,
159
+ 0
160
+ ]
161
+
162
+ class << self
163
+ attr_accessor :_bel_trans_targs
164
+ private :_bel_trans_targs, :_bel_trans_targs=
165
+ end
166
+ self._bel_trans_targs = [
167
+ 0, 2, 0, 2, 3, 6, 7, 8,
168
+ 3, 4, 9, 0, 5, 6, 8, 5,
169
+ 6, 8, 6, 0, 5, 6, 7, 8,
170
+ 16, 0, 11, 17, 11, 0, 13, 13,
171
+ 14, 15, 18, 0
172
+ ]
173
+
174
+ class << self
175
+ attr_accessor :_bel_trans_actions
176
+ private :_bel_trans_actions, :_bel_trans_actions=
177
+ end
178
+ self._bel_trans_actions = [
179
+ 1, 2, 3, 4, 5, 6, 7, 8,
180
+ 10, 10, 10, 9, 11, 12, 13, 0,
181
+ 14, 15, 0, 16, 17, 18, 19, 20,
182
+ 21, 22, 7, 23, 19, 24, 5, 10,
183
+ 10, 10, 25, 0
184
+ ]
185
+
186
+ class << self
187
+ attr_accessor :_bel_eof_actions
188
+ private :_bel_eof_actions, :_bel_eof_actions=
189
+ end
190
+ self._bel_eof_actions = [
191
+ 0, 1, 3, 9, 9, 1, 3, 16,
192
+ 1, 9, 22, 22, 24, 24, 24, 24,
193
+ 0, 0, 0
194
+ ]
195
+
196
+ class << self
197
+ attr_accessor :bel_start
198
+ end
199
+ self.bel_start = 1;
200
+ class << self
201
+ attr_accessor :bel_first_final
202
+ end
203
+ self.bel_first_final = 16;
204
+ class << self
205
+ attr_accessor :bel_error
206
+ end
207
+ self.bel_error = 0;
208
+
209
+ class << self
210
+ attr_accessor :bel_en_ident
211
+ end
212
+ self.bel_en_ident = 10;
213
+ class << self
214
+ attr_accessor :bel_en_string
215
+ end
216
+ self.bel_en_string = 12;
217
+ class << self
218
+ attr_accessor :bel_en_list
219
+ end
220
+ self.bel_en_list = 1;
221
+
222
+
223
+ begin
224
+ p ||= 0
225
+ pe ||= data.length
226
+ cs = bel_start
227
+ end
228
+
229
+ begin
230
+ testEof = false
231
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
232
+ _goto_level = 0
233
+ _resume = 10
234
+ _eof_trans = 15
235
+ _again = 20
236
+ _test_eof = 30
237
+ _out = 40
238
+ while true
239
+ if _goto_level <= 0
240
+ if p == pe
241
+ _goto_level = _test_eof
242
+ next
243
+ end
244
+ if cs == 0
245
+ _goto_level = _out
246
+ next
247
+ end
248
+ end
249
+ if _goto_level <= _resume
250
+ _keys = cs << 1
251
+ _inds = _bel_index_offsets[cs]
252
+ _slen = _bel_key_spans[cs]
253
+ _wide = data[p].ord
254
+ _trans = if ( _slen > 0 &&
255
+ _bel_trans_keys[_keys] <= _wide &&
256
+ _wide <= _bel_trans_keys[_keys + 1]
257
+ ) then
258
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
259
+ else
260
+ _bel_indicies[ _inds + _slen ]
261
+ end
262
+ cs = _bel_trans_targs[_trans]
263
+ if _bel_trans_actions[_trans] != 0
264
+ case _bel_trans_actions[_trans]
265
+ when 19 then
266
+ begin
267
+
268
+ (@buffers[:ident] ||= []) << data[p].ord
269
+ end
270
+ when 10 then
271
+ begin
272
+
273
+ (@buffers[:string] ||= []) << data[p].ord
274
+ end
275
+ when 14 then
276
+ begin
277
+
278
+ @buffers.delete(:string)
279
+ @buffers.delete(:ident)
280
+ end
281
+ when 2 then
282
+ begin
283
+
284
+ @buffers[:list] = list()
285
+ end
286
+ when 4 then
287
+ begin
288
+
289
+ # Append list argument if its value is not empty.
290
+ if @buffers[:list_arg]
291
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
292
+ if list_arg_value != ''
293
+ @buffers[:list] <<= @buffers[:list_arg]
294
+ end
295
+ end
296
+ end
297
+ when 15 then
298
+ begin
299
+
300
+ #TODO: Mark @buffers[:list] as complete.
301
+ end
302
+ when 21 then
303
+ begin
304
+
305
+ yield @buffers[:list]
306
+ end
307
+ when 1 then
308
+ begin
309
+
310
+ @buffers[:list] ||= list()
311
+ yield @buffers[:list]
312
+ end
313
+ when 7 then
314
+ begin
315
+
316
+ @buffers[:ident] = []
317
+ end
318
+ begin
319
+
320
+ (@buffers[:ident] ||= []) << data[p].ord
321
+ end
322
+ when 23 then
323
+ begin
324
+
325
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
326
+ end
327
+ begin
328
+
329
+ yield @buffers[:ident]
330
+ end
331
+ when 22 then
332
+ begin
333
+
334
+ unless @buffers[:ident].is_a?(::AST::Node)
335
+ @buffers[:ident] ||= []
336
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
337
+ end
338
+ end
339
+ begin
340
+
341
+ @buffers[:ident] ||= []
342
+ yield @buffers[:ident]
343
+ end
344
+ when 5 then
345
+ begin
346
+
347
+ @buffers[:string] = []
348
+ end
349
+ begin
350
+
351
+ (@buffers[:string] ||= []) << data[p].ord
352
+ end
353
+ when 25 then
354
+ begin
355
+
356
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
357
+ end
358
+ begin
359
+
360
+ yield @buffers[:string]
361
+ end
362
+ when 24 then
363
+ begin
364
+
365
+ @buffers[:string] ||= []
366
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
367
+ end
368
+ begin
369
+
370
+ @buffers[:string] ||= []
371
+ yield @buffers[:string]
372
+ end
373
+ when 6 then
374
+ begin
375
+
376
+ # Append list argument if its value is not empty.
377
+ if @buffers[:list_arg]
378
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
379
+ if list_arg_value != ''
380
+ @buffers[:list] <<= @buffers[:list_arg]
381
+ end
382
+ end
383
+ end
384
+ begin
385
+
386
+ @buffers.delete(:string)
387
+ @buffers.delete(:ident)
388
+ end
389
+ when 8 then
390
+ begin
391
+
392
+ # Append list argument if its value is not empty.
393
+ if @buffers[:list_arg]
394
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
395
+ if list_arg_value != ''
396
+ @buffers[:list] <<= @buffers[:list_arg]
397
+ end
398
+ end
399
+ end
400
+ begin
401
+
402
+ #TODO: Mark @buffers[:list] as complete.
403
+ end
404
+ when 17 then
405
+ begin
406
+
407
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
408
+ end
409
+ begin
410
+
411
+ @buffers[:list_arg] = list_item(@buffers[:ident])
412
+ end
413
+ begin
414
+
415
+ # Append list argument if its value is not empty.
416
+ if @buffers[:list_arg]
417
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
418
+ if list_arg_value != ''
419
+ @buffers[:list] <<= @buffers[:list_arg]
420
+ end
421
+ end
422
+ end
423
+ when 11 then
424
+ begin
425
+
426
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
427
+ end
428
+ begin
429
+
430
+ @buffers[:list_arg] = list_item(@buffers[:string])
431
+ end
432
+ begin
433
+
434
+ # Append list argument if its value is not empty.
435
+ if @buffers[:list_arg]
436
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
437
+ if list_arg_value != ''
438
+ @buffers[:list] <<= @buffers[:list_arg]
439
+ end
440
+ end
441
+ end
442
+ when 18 then
443
+ begin
444
+
445
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
446
+ end
447
+ begin
448
+
449
+ @buffers[:list_arg] = list_item(@buffers[:ident])
450
+ end
451
+ begin
452
+
453
+ # Append list argument if its value is not empty.
454
+ if @buffers[:list_arg]
455
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
456
+ if list_arg_value != ''
457
+ @buffers[:list] <<= @buffers[:list_arg]
458
+ end
459
+ end
460
+ end
461
+ begin
462
+
463
+ @buffers.delete(:string)
464
+ @buffers.delete(:ident)
465
+ end
466
+ when 20 then
467
+ begin
468
+
469
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
470
+ end
471
+ begin
472
+
473
+ @buffers[:list_arg] = list_item(@buffers[:ident])
474
+ end
475
+ begin
476
+
477
+ # Append list argument if its value is not empty.
478
+ if @buffers[:list_arg]
479
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
480
+ if list_arg_value != ''
481
+ @buffers[:list] <<= @buffers[:list_arg]
482
+ end
483
+ end
484
+ end
485
+ begin
486
+
487
+ #TODO: Mark @buffers[:list] as complete.
488
+ end
489
+ when 16 then
490
+ begin
491
+
492
+ unless @buffers[:ident].is_a?(::AST::Node)
493
+ @buffers[:ident] ||= []
494
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
495
+ end
496
+ end
497
+ begin
498
+
499
+ #TODO: Mark @buffers[:list_arg] identifier as error.
500
+ @buffers[:list_arg] = list_item(@buffers[:ident])
501
+ end
502
+ begin
503
+
504
+ # Append list argument if its value is not empty.
505
+ if @buffers[:list_arg]
506
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
507
+ if list_arg_value != ''
508
+ @buffers[:list] <<= @buffers[:list_arg]
509
+ end
510
+ end
511
+ end
512
+ begin
513
+
514
+ @buffers[:list] ||= list()
515
+ yield @buffers[:list]
516
+ end
517
+ when 12 then
518
+ begin
519
+
520
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
521
+ end
522
+ begin
523
+
524
+ @buffers[:list_arg] = list_item(@buffers[:string])
525
+ end
526
+ begin
527
+
528
+ # Append list argument if its value is not empty.
529
+ if @buffers[:list_arg]
530
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
531
+ if list_arg_value != ''
532
+ @buffers[:list] <<= @buffers[:list_arg]
533
+ end
534
+ end
535
+ end
536
+ begin
537
+
538
+ @buffers.delete(:string)
539
+ @buffers.delete(:ident)
540
+ end
541
+ when 13 then
542
+ begin
543
+
544
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
545
+ end
546
+ begin
547
+
548
+ @buffers[:list_arg] = list_item(@buffers[:string])
549
+ end
550
+ begin
551
+
552
+ # Append list argument if its value is not empty.
553
+ if @buffers[:list_arg]
554
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
555
+ if list_arg_value != ''
556
+ @buffers[:list] <<= @buffers[:list_arg]
557
+ end
558
+ end
559
+ end
560
+ begin
561
+
562
+ #TODO: Mark @buffers[:list] as complete.
563
+ end
564
+ when 9 then
565
+ begin
566
+
567
+ @buffers[:string] ||= []
568
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
569
+ end
570
+ begin
571
+
572
+ #TODO: Mark @buffers[:list_arg] string as error.
573
+ @buffers[:list_arg] = list_item(@buffers[:string])
574
+ end
575
+ begin
576
+
577
+ # Append list argument if its value is not empty.
578
+ if @buffers[:list_arg]
579
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
580
+ if list_arg_value != ''
581
+ @buffers[:list] <<= @buffers[:list_arg]
582
+ end
583
+ end
584
+ end
585
+ begin
586
+
587
+ @buffers[:list] ||= list()
588
+ yield @buffers[:list]
589
+ end
590
+ when 3 then
591
+ begin
592
+
593
+ @buffers[:string] ||= []
594
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
595
+ end
596
+ begin
597
+
598
+ #TODO: Mark @buffers[:list_arg] string as error.
599
+ @buffers[:list_arg] = list_item(@buffers[:string])
600
+ end
601
+ begin
602
+
603
+ unless @buffers[:ident].is_a?(::AST::Node)
604
+ @buffers[:ident] ||= []
605
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
606
+ end
607
+ end
608
+ begin
609
+
610
+ #TODO: Mark @buffers[:list_arg] identifier as error.
611
+ @buffers[:list_arg] = list_item(@buffers[:ident])
612
+ end
613
+ begin
614
+
615
+ # Append list argument if its value is not empty.
616
+ if @buffers[:list_arg]
617
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
618
+ if list_arg_value != ''
619
+ @buffers[:list] <<= @buffers[:list_arg]
620
+ end
621
+ end
622
+ end
623
+ begin
624
+
625
+ @buffers[:list] ||= list()
626
+ yield @buffers[:list]
627
+ end
628
+ end
629
+ end
630
+ end
631
+ if _goto_level <= _again
632
+ if cs == 0
633
+ _goto_level = _out
634
+ next
635
+ end
636
+ p += 1
637
+ if p != pe
638
+ _goto_level = _resume
639
+ next
640
+ end
641
+ end
642
+ if _goto_level <= _test_eof
643
+ if p == eof
644
+ case _bel_eof_actions[cs]
645
+ when 1 then
646
+ begin
647
+
648
+ @buffers[:list] ||= list()
649
+ yield @buffers[:list]
650
+ end
651
+ when 22 then
652
+ begin
653
+
654
+ unless @buffers[:ident].is_a?(::AST::Node)
655
+ @buffers[:ident] ||= []
656
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
657
+ end
658
+ end
659
+ begin
660
+
661
+ @buffers[:ident] ||= []
662
+ yield @buffers[:ident]
663
+ end
664
+ when 24 then
665
+ begin
666
+
667
+ @buffers[:string] ||= []
668
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
669
+ end
670
+ begin
671
+
672
+ @buffers[:string] ||= []
673
+ yield @buffers[:string]
674
+ end
675
+ when 16 then
676
+ begin
677
+
678
+ unless @buffers[:ident].is_a?(::AST::Node)
679
+ @buffers[:ident] ||= []
680
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
681
+ end
682
+ end
683
+ begin
684
+
685
+ #TODO: Mark @buffers[:list_arg] identifier as error.
686
+ @buffers[:list_arg] = list_item(@buffers[:ident])
687
+ end
688
+ begin
689
+
690
+ # Append list argument if its value is not empty.
691
+ if @buffers[:list_arg]
692
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
693
+ if list_arg_value != ''
694
+ @buffers[:list] <<= @buffers[:list_arg]
695
+ end
696
+ end
697
+ end
698
+ begin
699
+
700
+ @buffers[:list] ||= list()
701
+ yield @buffers[:list]
702
+ end
703
+ when 9 then
704
+ begin
705
+
706
+ @buffers[:string] ||= []
707
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
708
+ end
709
+ begin
710
+
711
+ #TODO: Mark @buffers[:list_arg] string as error.
712
+ @buffers[:list_arg] = list_item(@buffers[:string])
713
+ end
714
+ begin
715
+
716
+ # Append list argument if its value is not empty.
717
+ if @buffers[:list_arg]
718
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
719
+ if list_arg_value != ''
720
+ @buffers[:list] <<= @buffers[:list_arg]
721
+ end
722
+ end
723
+ end
724
+ begin
725
+
726
+ @buffers[:list] ||= list()
727
+ yield @buffers[:list]
728
+ end
729
+ when 3 then
730
+ begin
731
+
732
+ @buffers[:string] ||= []
733
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
734
+ end
735
+ begin
736
+
737
+ #TODO: Mark @buffers[:list_arg] string as error.
738
+ @buffers[:list_arg] = list_item(@buffers[:string])
739
+ end
740
+ begin
741
+
742
+ unless @buffers[:ident].is_a?(::AST::Node)
743
+ @buffers[:ident] ||= []
744
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
745
+ end
746
+ end
747
+ begin
748
+
749
+ #TODO: Mark @buffers[:list_arg] identifier as error.
750
+ @buffers[:list_arg] = list_item(@buffers[:ident])
751
+ end
752
+ begin
753
+
754
+ # Append list argument if its value is not empty.
755
+ if @buffers[:list_arg]
756
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
757
+ if list_arg_value != ''
758
+ @buffers[:list] <<= @buffers[:list_arg]
759
+ end
760
+ end
761
+ end
762
+ begin
763
+
764
+ @buffers[:list] ||= list()
765
+ yield @buffers[:list]
766
+ end
767
+ end
768
+ end
769
+
770
+ end
771
+ if _goto_level <= _out
772
+ break
773
+ end
774
+ end
775
+ end
776
+
777
+ class << self
778
+ attr_accessor :_bel_trans_keys
779
+ private :_bel_trans_keys, :_bel_trans_keys=
780
+ end
781
+ self._bel_trans_keys = [
782
+ 0, 0, 123, 123, 9, 125,
783
+ 34, 92, 9, 125, 9,
784
+ 125, 9, 122, 9, 125,
785
+ 10, 10, 92, 92, 48, 122,
786
+ 10, 122, 34, 34, 34,
787
+ 92, 10, 10, 92, 92,
788
+ 0, 0, 0, 0, 0, 0,
789
+ 0
790
+ ]
791
+
792
+ class << self
793
+ attr_accessor :_bel_key_spans
794
+ private :_bel_key_spans, :_bel_key_spans=
795
+ end
796
+ self._bel_key_spans = [
797
+ 0, 1, 117, 59, 117, 117, 114, 117,
798
+ 1, 1, 75, 113, 1, 59, 1, 1,
799
+ 0, 0, 0
800
+ ]
801
+
802
+ class << self
803
+ attr_accessor :_bel_index_offsets
804
+ private :_bel_index_offsets, :_bel_index_offsets=
805
+ end
806
+ self._bel_index_offsets = [
807
+ 0, 0, 2, 120, 180, 298, 416, 531,
808
+ 649, 651, 653, 729, 843, 845, 905, 907,
809
+ 909, 910, 911
810
+ ]
811
+
812
+ class << self
813
+ attr_accessor :_bel_indicies
814
+ private :_bel_indicies, :_bel_indicies=
815
+ end
816
+ self._bel_indicies = [
817
+ 1, 0, 3, 2, 2, 2, 2, 2,
818
+ 2, 2, 2, 2, 2, 2, 2, 2,
819
+ 2, 2, 2, 2, 2, 2, 2, 2,
820
+ 2, 3, 2, 4, 2, 2, 2, 2,
821
+ 2, 2, 2, 2, 2, 5, 2, 2,
822
+ 2, 6, 6, 6, 6, 6, 6, 6,
823
+ 6, 6, 6, 2, 2, 2, 2, 2,
824
+ 2, 2, 6, 6, 6, 6, 6, 6,
825
+ 6, 6, 6, 6, 6, 6, 6, 6,
826
+ 6, 6, 6, 6, 6, 6, 6, 6,
827
+ 6, 6, 6, 6, 2, 2, 2, 2,
828
+ 6, 2, 6, 6, 6, 6, 6, 6,
829
+ 6, 6, 6, 6, 6, 6, 6, 6,
830
+ 6, 6, 6, 6, 6, 6, 6, 6,
831
+ 6, 6, 6, 6, 2, 2, 7, 2,
832
+ 9, 8, 8, 8, 8, 8, 8, 8,
833
+ 8, 8, 8, 8, 8, 8, 8, 8,
834
+ 8, 8, 8, 8, 8, 8, 8, 8,
835
+ 8, 8, 8, 8, 8, 8, 8, 8,
836
+ 8, 8, 8, 8, 8, 8, 8, 8,
837
+ 8, 8, 8, 8, 8, 8, 8, 8,
838
+ 8, 8, 8, 8, 8, 8, 8, 8,
839
+ 8, 8, 10, 8, 12, 11, 11, 11,
840
+ 11, 11, 11, 11, 11, 11, 11, 11,
841
+ 11, 11, 11, 11, 11, 11, 11, 11,
842
+ 11, 11, 11, 12, 11, 11, 11, 11,
843
+ 11, 11, 11, 11, 11, 11, 11, 13,
844
+ 11, 11, 11, 11, 11, 11, 11, 11,
845
+ 11, 11, 11, 11, 11, 11, 11, 11,
846
+ 11, 11, 11, 11, 11, 11, 11, 11,
847
+ 11, 11, 11, 11, 11, 11, 11, 11,
848
+ 11, 11, 11, 11, 11, 11, 11, 11,
849
+ 11, 11, 11, 11, 11, 11, 11, 11,
850
+ 11, 11, 11, 11, 11, 11, 11, 11,
851
+ 11, 11, 11, 11, 11, 11, 11, 11,
852
+ 11, 11, 11, 11, 11, 11, 11, 11,
853
+ 11, 11, 11, 11, 11, 11, 11, 11,
854
+ 14, 11, 15, 0, 0, 0, 0, 0,
855
+ 0, 0, 0, 0, 0, 0, 0, 0,
856
+ 0, 0, 0, 0, 0, 0, 0, 0,
857
+ 0, 15, 0, 0, 0, 0, 0, 0,
858
+ 0, 0, 0, 0, 0, 16, 0, 0,
859
+ 0, 0, 0, 0, 0, 0, 0, 0,
860
+ 0, 0, 0, 0, 0, 0, 0, 0,
861
+ 0, 0, 0, 0, 0, 0, 0, 0,
862
+ 0, 0, 0, 0, 0, 0, 0, 0,
863
+ 0, 0, 0, 0, 0, 0, 0, 0,
864
+ 0, 0, 0, 0, 0, 0, 0, 0,
865
+ 0, 0, 0, 0, 0, 0, 0, 0,
866
+ 0, 0, 0, 0, 0, 0, 0, 0,
867
+ 0, 0, 0, 0, 0, 0, 0, 0,
868
+ 0, 0, 0, 0, 0, 0, 17, 0,
869
+ 18, 2, 2, 2, 2, 2, 2, 2,
870
+ 2, 2, 2, 2, 2, 2, 2, 2,
871
+ 2, 2, 2, 2, 2, 2, 2, 18,
872
+ 2, 4, 2, 2, 2, 2, 2, 2,
873
+ 2, 2, 2, 2, 2, 2, 2, 6,
874
+ 6, 6, 6, 6, 6, 6, 6, 6,
875
+ 6, 2, 2, 2, 2, 2, 2, 2,
876
+ 6, 6, 6, 6, 6, 6, 6, 6,
877
+ 6, 6, 6, 6, 6, 6, 6, 6,
878
+ 6, 6, 6, 6, 6, 6, 6, 6,
879
+ 6, 6, 2, 2, 2, 2, 6, 2,
880
+ 6, 6, 6, 6, 6, 6, 6, 6,
881
+ 6, 6, 6, 6, 6, 6, 6, 6,
882
+ 6, 6, 6, 6, 6, 6, 6, 6,
883
+ 6, 6, 2, 20, 19, 19, 19, 19,
884
+ 19, 19, 19, 19, 19, 19, 19, 19,
885
+ 19, 19, 19, 19, 19, 19, 19, 19,
886
+ 19, 19, 20, 19, 19, 19, 19, 19,
887
+ 19, 19, 19, 19, 19, 19, 21, 19,
888
+ 19, 19, 22, 22, 22, 22, 22, 22,
889
+ 22, 22, 22, 22, 19, 19, 19, 19,
890
+ 19, 19, 19, 22, 22, 22, 22, 22,
891
+ 22, 22, 22, 22, 22, 22, 22, 22,
892
+ 22, 22, 22, 22, 22, 22, 22, 22,
893
+ 22, 22, 22, 22, 22, 19, 19, 19,
894
+ 19, 22, 19, 22, 22, 22, 22, 22,
895
+ 22, 22, 22, 22, 22, 22, 22, 22,
896
+ 22, 22, 22, 22, 22, 22, 22, 22,
897
+ 22, 22, 22, 22, 22, 19, 19, 23,
898
+ 19, 24, 0, 10, 8, 26, 26, 26,
899
+ 26, 26, 26, 26, 26, 26, 26, 25,
900
+ 25, 25, 25, 25, 25, 25, 26, 26,
901
+ 26, 26, 26, 26, 26, 26, 26, 26,
902
+ 26, 26, 26, 26, 26, 26, 26, 26,
903
+ 26, 26, 26, 26, 26, 26, 26, 26,
904
+ 25, 25, 25, 25, 26, 25, 26, 26,
905
+ 26, 26, 26, 26, 26, 26, 26, 26,
906
+ 26, 26, 26, 26, 26, 26, 26, 26,
907
+ 26, 26, 26, 26, 26, 26, 26, 26,
908
+ 25, 27, 25, 25, 25, 25, 25, 25,
909
+ 25, 25, 25, 25, 25, 25, 25, 25,
910
+ 25, 25, 25, 25, 25, 25, 25, 25,
911
+ 25, 25, 25, 25, 25, 25, 25, 25,
912
+ 25, 25, 25, 25, 25, 25, 25, 28,
913
+ 28, 28, 28, 28, 28, 28, 28, 28,
914
+ 28, 25, 25, 25, 25, 25, 25, 25,
915
+ 28, 28, 28, 28, 28, 28, 28, 28,
916
+ 28, 28, 28, 28, 28, 28, 28, 28,
917
+ 28, 28, 28, 28, 28, 28, 28, 28,
918
+ 28, 28, 25, 25, 25, 25, 28, 25,
919
+ 28, 28, 28, 28, 28, 28, 28, 28,
920
+ 28, 28, 28, 28, 28, 28, 28, 28,
921
+ 28, 28, 28, 28, 28, 28, 28, 28,
922
+ 28, 28, 25, 30, 29, 32, 31, 31,
923
+ 31, 31, 31, 31, 31, 31, 31, 31,
924
+ 31, 31, 31, 31, 31, 31, 31, 31,
925
+ 31, 31, 31, 31, 31, 31, 31, 31,
926
+ 31, 31, 31, 31, 31, 31, 31, 31,
927
+ 31, 31, 31, 31, 31, 31, 31, 31,
928
+ 31, 31, 31, 31, 31, 31, 31, 31,
929
+ 31, 31, 31, 31, 31, 31, 31, 33,
930
+ 31, 34, 29, 33, 31, 35, 35, 35,
931
+ 0
932
+ ]
933
+
934
+ class << self
935
+ attr_accessor :_bel_trans_targs
936
+ private :_bel_trans_targs, :_bel_trans_targs=
937
+ end
938
+ self._bel_trans_targs = [
939
+ 0, 2, 0, 2, 3, 6, 7, 8,
940
+ 3, 4, 9, 0, 5, 6, 8, 5,
941
+ 6, 8, 6, 0, 5, 6, 7, 8,
942
+ 16, 0, 11, 17, 11, 0, 13, 13,
943
+ 14, 15, 18, 0
944
+ ]
945
+
946
+ class << self
947
+ attr_accessor :_bel_trans_actions
948
+ private :_bel_trans_actions, :_bel_trans_actions=
949
+ end
950
+ self._bel_trans_actions = [
951
+ 1, 2, 3, 4, 5, 6, 7, 8,
952
+ 10, 10, 10, 9, 11, 12, 13, 0,
953
+ 14, 15, 0, 16, 17, 18, 19, 20,
954
+ 21, 22, 7, 23, 19, 24, 5, 10,
955
+ 10, 10, 25, 0
956
+ ]
957
+
958
+ class << self
959
+ attr_accessor :_bel_eof_actions
960
+ private :_bel_eof_actions, :_bel_eof_actions=
961
+ end
962
+ self._bel_eof_actions = [
963
+ 0, 1, 3, 9, 9, 1, 3, 16,
964
+ 1, 9, 22, 22, 24, 24, 24, 24,
965
+ 0, 0, 0
966
+ ]
967
+
968
+ class << self
969
+ attr_accessor :bel_start
970
+ end
971
+ self.bel_start = 1;
972
+ class << self
973
+ attr_accessor :bel_first_final
974
+ end
975
+ self.bel_first_final = 16;
976
+ class << self
977
+ attr_accessor :bel_error
978
+ end
979
+ self.bel_error = 0;
980
+
981
+ class << self
982
+ attr_accessor :bel_en_ident
983
+ end
984
+ self.bel_en_ident = 10;
985
+ class << self
986
+ attr_accessor :bel_en_string
987
+ end
988
+ self.bel_en_string = 12;
989
+ class << self
990
+ attr_accessor :bel_en_list
991
+ end
992
+ self.bel_en_list = 1;
993
+
994
+
995
+ begin
996
+ p ||= 0
997
+ pe ||= data.length
998
+ cs = bel_start
999
+ end
1000
+
1001
+ begin
1002
+ testEof = false
1003
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
1004
+ _goto_level = 0
1005
+ _resume = 10
1006
+ _eof_trans = 15
1007
+ _again = 20
1008
+ _test_eof = 30
1009
+ _out = 40
1010
+ while true
1011
+ if _goto_level <= 0
1012
+ if p == pe
1013
+ _goto_level = _test_eof
1014
+ next
1015
+ end
1016
+ if cs == 0
1017
+ _goto_level = _out
1018
+ next
1019
+ end
1020
+ end
1021
+ if _goto_level <= _resume
1022
+ _keys = cs << 1
1023
+ _inds = _bel_index_offsets[cs]
1024
+ _slen = _bel_key_spans[cs]
1025
+ _wide = data[p].ord
1026
+ _trans = if ( _slen > 0 &&
1027
+ _bel_trans_keys[_keys] <= _wide &&
1028
+ _wide <= _bel_trans_keys[_keys + 1]
1029
+ ) then
1030
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
1031
+ else
1032
+ _bel_indicies[ _inds + _slen ]
1033
+ end
1034
+ cs = _bel_trans_targs[_trans]
1035
+ if _bel_trans_actions[_trans] != 0
1036
+ case _bel_trans_actions[_trans]
1037
+ when 19 then
1038
+ begin
1039
+
1040
+ (@buffers[:ident] ||= []) << data[p].ord
1041
+ end
1042
+ when 10 then
1043
+ begin
1044
+
1045
+ (@buffers[:string] ||= []) << data[p].ord
1046
+ end
1047
+ when 14 then
1048
+ begin
1049
+
1050
+ @buffers.delete(:string)
1051
+ @buffers.delete(:ident)
1052
+ end
1053
+ when 2 then
1054
+ begin
1055
+
1056
+ @buffers[:list] = list()
1057
+ end
1058
+ when 4 then
1059
+ begin
1060
+
1061
+ # Append list argument if its value is not empty.
1062
+ if @buffers[:list_arg]
1063
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1064
+ if list_arg_value != ''
1065
+ @buffers[:list] <<= @buffers[:list_arg]
1066
+ end
1067
+ end
1068
+ end
1069
+ when 15 then
1070
+ begin
1071
+
1072
+ #TODO: Mark @buffers[:list] as complete.
1073
+ end
1074
+ when 21 then
1075
+ begin
1076
+
1077
+ yield @buffers[:list]
1078
+ end
1079
+ when 1 then
1080
+ begin
1081
+
1082
+ @buffers[:list] ||= list()
1083
+ yield @buffers[:list]
1084
+ end
1085
+ when 7 then
1086
+ begin
1087
+
1088
+ @buffers[:ident] = []
1089
+ end
1090
+ begin
1091
+
1092
+ (@buffers[:ident] ||= []) << data[p].ord
1093
+ end
1094
+ when 23 then
1095
+ begin
1096
+
1097
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1098
+ end
1099
+ begin
1100
+
1101
+ yield @buffers[:ident]
1102
+ end
1103
+ when 22 then
1104
+ begin
1105
+
1106
+ unless @buffers[:ident].is_a?(::AST::Node)
1107
+ @buffers[:ident] ||= []
1108
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1109
+ end
1110
+ end
1111
+ begin
1112
+
1113
+ @buffers[:ident] ||= []
1114
+ yield @buffers[:ident]
1115
+ end
1116
+ when 5 then
1117
+ begin
1118
+
1119
+ @buffers[:string] = []
1120
+ end
1121
+ begin
1122
+
1123
+ (@buffers[:string] ||= []) << data[p].ord
1124
+ end
1125
+ when 25 then
1126
+ begin
1127
+
1128
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1129
+ end
1130
+ begin
1131
+
1132
+ yield @buffers[:string]
1133
+ end
1134
+ when 24 then
1135
+ begin
1136
+
1137
+ @buffers[:string] ||= []
1138
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1139
+ end
1140
+ begin
1141
+
1142
+ @buffers[:string] ||= []
1143
+ yield @buffers[:string]
1144
+ end
1145
+ when 6 then
1146
+ begin
1147
+
1148
+ # Append list argument if its value is not empty.
1149
+ if @buffers[:list_arg]
1150
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1151
+ if list_arg_value != ''
1152
+ @buffers[:list] <<= @buffers[:list_arg]
1153
+ end
1154
+ end
1155
+ end
1156
+ begin
1157
+
1158
+ @buffers.delete(:string)
1159
+ @buffers.delete(:ident)
1160
+ end
1161
+ when 8 then
1162
+ begin
1163
+
1164
+ # Append list argument if its value is not empty.
1165
+ if @buffers[:list_arg]
1166
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1167
+ if list_arg_value != ''
1168
+ @buffers[:list] <<= @buffers[:list_arg]
1169
+ end
1170
+ end
1171
+ end
1172
+ begin
1173
+
1174
+ #TODO: Mark @buffers[:list] as complete.
1175
+ end
1176
+ when 17 then
1177
+ begin
1178
+
1179
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1180
+ end
1181
+ begin
1182
+
1183
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1184
+ end
1185
+ begin
1186
+
1187
+ # Append list argument if its value is not empty.
1188
+ if @buffers[:list_arg]
1189
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1190
+ if list_arg_value != ''
1191
+ @buffers[:list] <<= @buffers[:list_arg]
1192
+ end
1193
+ end
1194
+ end
1195
+ when 11 then
1196
+ begin
1197
+
1198
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1199
+ end
1200
+ begin
1201
+
1202
+ @buffers[:list_arg] = list_item(@buffers[:string])
1203
+ end
1204
+ begin
1205
+
1206
+ # Append list argument if its value is not empty.
1207
+ if @buffers[:list_arg]
1208
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1209
+ if list_arg_value != ''
1210
+ @buffers[:list] <<= @buffers[:list_arg]
1211
+ end
1212
+ end
1213
+ end
1214
+ when 18 then
1215
+ begin
1216
+
1217
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1218
+ end
1219
+ begin
1220
+
1221
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1222
+ end
1223
+ begin
1224
+
1225
+ # Append list argument if its value is not empty.
1226
+ if @buffers[:list_arg]
1227
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1228
+ if list_arg_value != ''
1229
+ @buffers[:list] <<= @buffers[:list_arg]
1230
+ end
1231
+ end
1232
+ end
1233
+ begin
1234
+
1235
+ @buffers.delete(:string)
1236
+ @buffers.delete(:ident)
1237
+ end
1238
+ when 20 then
1239
+ begin
1240
+
1241
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1242
+ end
1243
+ begin
1244
+
1245
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1246
+ end
1247
+ begin
1248
+
1249
+ # Append list argument if its value is not empty.
1250
+ if @buffers[:list_arg]
1251
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1252
+ if list_arg_value != ''
1253
+ @buffers[:list] <<= @buffers[:list_arg]
1254
+ end
1255
+ end
1256
+ end
1257
+ begin
1258
+
1259
+ #TODO: Mark @buffers[:list] as complete.
1260
+ end
1261
+ when 16 then
1262
+ begin
1263
+
1264
+ unless @buffers[:ident].is_a?(::AST::Node)
1265
+ @buffers[:ident] ||= []
1266
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1267
+ end
1268
+ end
1269
+ begin
1270
+
1271
+ #TODO: Mark @buffers[:list_arg] identifier as error.
1272
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1273
+ end
1274
+ begin
1275
+
1276
+ # Append list argument if its value is not empty.
1277
+ if @buffers[:list_arg]
1278
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1279
+ if list_arg_value != ''
1280
+ @buffers[:list] <<= @buffers[:list_arg]
1281
+ end
1282
+ end
1283
+ end
1284
+ begin
1285
+
1286
+ @buffers[:list] ||= list()
1287
+ yield @buffers[:list]
1288
+ end
1289
+ when 12 then
1290
+ begin
1291
+
1292
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1293
+ end
1294
+ begin
1295
+
1296
+ @buffers[:list_arg] = list_item(@buffers[:string])
1297
+ end
1298
+ begin
1299
+
1300
+ # Append list argument if its value is not empty.
1301
+ if @buffers[:list_arg]
1302
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1303
+ if list_arg_value != ''
1304
+ @buffers[:list] <<= @buffers[:list_arg]
1305
+ end
1306
+ end
1307
+ end
1308
+ begin
1309
+
1310
+ @buffers.delete(:string)
1311
+ @buffers.delete(:ident)
1312
+ end
1313
+ when 13 then
1314
+ begin
1315
+
1316
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1317
+ end
1318
+ begin
1319
+
1320
+ @buffers[:list_arg] = list_item(@buffers[:string])
1321
+ end
1322
+ begin
1323
+
1324
+ # Append list argument if its value is not empty.
1325
+ if @buffers[:list_arg]
1326
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1327
+ if list_arg_value != ''
1328
+ @buffers[:list] <<= @buffers[:list_arg]
1329
+ end
1330
+ end
1331
+ end
1332
+ begin
1333
+
1334
+ #TODO: Mark @buffers[:list] as complete.
1335
+ end
1336
+ when 9 then
1337
+ begin
1338
+
1339
+ @buffers[:string] ||= []
1340
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1341
+ end
1342
+ begin
1343
+
1344
+ #TODO: Mark @buffers[:list_arg] string as error.
1345
+ @buffers[:list_arg] = list_item(@buffers[:string])
1346
+ end
1347
+ begin
1348
+
1349
+ # Append list argument if its value is not empty.
1350
+ if @buffers[:list_arg]
1351
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1352
+ if list_arg_value != ''
1353
+ @buffers[:list] <<= @buffers[:list_arg]
1354
+ end
1355
+ end
1356
+ end
1357
+ begin
1358
+
1359
+ @buffers[:list] ||= list()
1360
+ yield @buffers[:list]
1361
+ end
1362
+ when 3 then
1363
+ begin
1364
+
1365
+ @buffers[:string] ||= []
1366
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1367
+ end
1368
+ begin
1369
+
1370
+ #TODO: Mark @buffers[:list_arg] string as error.
1371
+ @buffers[:list_arg] = list_item(@buffers[:string])
1372
+ end
1373
+ begin
1374
+
1375
+ unless @buffers[:ident].is_a?(::AST::Node)
1376
+ @buffers[:ident] ||= []
1377
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1378
+ end
1379
+ end
1380
+ begin
1381
+
1382
+ #TODO: Mark @buffers[:list_arg] identifier as error.
1383
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1384
+ end
1385
+ begin
1386
+
1387
+ # Append list argument if its value is not empty.
1388
+ if @buffers[:list_arg]
1389
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1390
+ if list_arg_value != ''
1391
+ @buffers[:list] <<= @buffers[:list_arg]
1392
+ end
1393
+ end
1394
+ end
1395
+ begin
1396
+
1397
+ @buffers[:list] ||= list()
1398
+ yield @buffers[:list]
1399
+ end
1400
+ end
1401
+ end
1402
+ end
1403
+ if _goto_level <= _again
1404
+ if cs == 0
1405
+ _goto_level = _out
1406
+ next
1407
+ end
1408
+ p += 1
1409
+ if p != pe
1410
+ _goto_level = _resume
1411
+ next
1412
+ end
1413
+ end
1414
+ if _goto_level <= _test_eof
1415
+ if p == eof
1416
+ case _bel_eof_actions[cs]
1417
+ when 1 then
1418
+ begin
1419
+
1420
+ @buffers[:list] ||= list()
1421
+ yield @buffers[:list]
1422
+ end
1423
+ when 22 then
1424
+ begin
1425
+
1426
+ unless @buffers[:ident].is_a?(::AST::Node)
1427
+ @buffers[:ident] ||= []
1428
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1429
+ end
1430
+ end
1431
+ begin
1432
+
1433
+ @buffers[:ident] ||= []
1434
+ yield @buffers[:ident]
1435
+ end
1436
+ when 24 then
1437
+ begin
1438
+
1439
+ @buffers[:string] ||= []
1440
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1441
+ end
1442
+ begin
1443
+
1444
+ @buffers[:string] ||= []
1445
+ yield @buffers[:string]
1446
+ end
1447
+ when 16 then
1448
+ begin
1449
+
1450
+ unless @buffers[:ident].is_a?(::AST::Node)
1451
+ @buffers[:ident] ||= []
1452
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1453
+ end
1454
+ end
1455
+ begin
1456
+
1457
+ #TODO: Mark @buffers[:list_arg] identifier as error.
1458
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1459
+ end
1460
+ begin
1461
+
1462
+ # Append list argument if its value is not empty.
1463
+ if @buffers[:list_arg]
1464
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1465
+ if list_arg_value != ''
1466
+ @buffers[:list] <<= @buffers[:list_arg]
1467
+ end
1468
+ end
1469
+ end
1470
+ begin
1471
+
1472
+ @buffers[:list] ||= list()
1473
+ yield @buffers[:list]
1474
+ end
1475
+ when 9 then
1476
+ begin
1477
+
1478
+ @buffers[:string] ||= []
1479
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1480
+ end
1481
+ begin
1482
+
1483
+ #TODO: Mark @buffers[:list_arg] string as error.
1484
+ @buffers[:list_arg] = list_item(@buffers[:string])
1485
+ end
1486
+ begin
1487
+
1488
+ # Append list argument if its value is not empty.
1489
+ if @buffers[:list_arg]
1490
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1491
+ if list_arg_value != ''
1492
+ @buffers[:list] <<= @buffers[:list_arg]
1493
+ end
1494
+ end
1495
+ end
1496
+ begin
1497
+
1498
+ @buffers[:list] ||= list()
1499
+ yield @buffers[:list]
1500
+ end
1501
+ when 3 then
1502
+ begin
1503
+
1504
+ @buffers[:string] ||= []
1505
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1506
+ end
1507
+ begin
1508
+
1509
+ #TODO: Mark @buffers[:list_arg] string as error.
1510
+ @buffers[:list_arg] = list_item(@buffers[:string])
1511
+ end
1512
+ begin
1513
+
1514
+ unless @buffers[:ident].is_a?(::AST::Node)
1515
+ @buffers[:ident] ||= []
1516
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1517
+ end
1518
+ end
1519
+ begin
1520
+
1521
+ #TODO: Mark @buffers[:list_arg] identifier as error.
1522
+ @buffers[:list_arg] = list_item(@buffers[:ident])
1523
+ end
1524
+ begin
1525
+
1526
+ # Append list argument if its value is not empty.
1527
+ if @buffers[:list_arg]
1528
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1529
+ if list_arg_value != ''
1530
+ @buffers[:list] <<= @buffers[:list_arg]
1531
+ end
1532
+ end
1533
+ end
1534
+ begin
1535
+
1536
+ @buffers[:list] ||= list()
1537
+ yield @buffers[:list]
1538
+ end
1539
+ end
1540
+ end
1541
+
1542
+ end
1543
+ if _goto_level <= _out
1544
+ break
1545
+ end
1546
+ end
1547
+ end
1548
+
1549
+
1550
+ =end
1551
+ # end: ragel
1552
+
1553
+ require_relative '../ast/node'
1554
+ require_relative '../mixin/buffer'
1555
+ require_relative '../nonblocking_io_wrapper'
1556
+
1557
+ module BELParser
1558
+ module Parsers
1559
+ module Common
1560
+ module List
1561
+
1562
+ class << self
1563
+
1564
+ MAX_LENGTH = 1024 * 128 # 128K
1565
+
1566
+ def parse(content)
1567
+ return nil unless content
1568
+
1569
+ Parser.new(content).each do |obj|
1570
+ yield obj
1571
+ end
1572
+ end
1573
+ end
1574
+
1575
+ private
1576
+
1577
+ class Parser
1578
+ include Enumerable
1579
+ include BELParser::Parsers::Buffer
1580
+ include BELParser::Parsers::AST::Sexp
1581
+
1582
+ def initialize(content)
1583
+ @content = content
1584
+ # begin: ragel
1585
+
1586
+ class << self
1587
+ attr_accessor :_bel_trans_keys
1588
+ private :_bel_trans_keys, :_bel_trans_keys=
1589
+ end
1590
+ self._bel_trans_keys = [
1591
+ 0, 0, 123, 123, 9, 125,
1592
+ 34, 92, 9, 125, 9,
1593
+ 125, 9, 122, 9, 125,
1594
+ 10, 10, 92, 92, 48, 122,
1595
+ 10, 122, 34, 34, 34,
1596
+ 92, 10, 10, 92, 92,
1597
+ 0, 0, 0, 0, 0, 0,
1598
+ 0
1599
+ ]
1600
+
1601
+ class << self
1602
+ attr_accessor :_bel_key_spans
1603
+ private :_bel_key_spans, :_bel_key_spans=
1604
+ end
1605
+ self._bel_key_spans = [
1606
+ 0, 1, 117, 59, 117, 117, 114, 117,
1607
+ 1, 1, 75, 113, 1, 59, 1, 1,
1608
+ 0, 0, 0
1609
+ ]
1610
+
1611
+ class << self
1612
+ attr_accessor :_bel_index_offsets
1613
+ private :_bel_index_offsets, :_bel_index_offsets=
1614
+ end
1615
+ self._bel_index_offsets = [
1616
+ 0, 0, 2, 120, 180, 298, 416, 531,
1617
+ 649, 651, 653, 729, 843, 845, 905, 907,
1618
+ 909, 910, 911
1619
+ ]
1620
+
1621
+ class << self
1622
+ attr_accessor :_bel_indicies
1623
+ private :_bel_indicies, :_bel_indicies=
1624
+ end
1625
+ self._bel_indicies = [
1626
+ 1, 0, 3, 2, 2, 2, 2, 2,
1627
+ 2, 2, 2, 2, 2, 2, 2, 2,
1628
+ 2, 2, 2, 2, 2, 2, 2, 2,
1629
+ 2, 3, 2, 4, 2, 2, 2, 2,
1630
+ 2, 2, 2, 2, 2, 5, 2, 2,
1631
+ 2, 6, 6, 6, 6, 6, 6, 6,
1632
+ 6, 6, 6, 2, 2, 2, 2, 2,
1633
+ 2, 2, 6, 6, 6, 6, 6, 6,
1634
+ 6, 6, 6, 6, 6, 6, 6, 6,
1635
+ 6, 6, 6, 6, 6, 6, 6, 6,
1636
+ 6, 6, 6, 6, 2, 2, 2, 2,
1637
+ 6, 2, 6, 6, 6, 6, 6, 6,
1638
+ 6, 6, 6, 6, 6, 6, 6, 6,
1639
+ 6, 6, 6, 6, 6, 6, 6, 6,
1640
+ 6, 6, 6, 6, 2, 2, 7, 2,
1641
+ 9, 8, 8, 8, 8, 8, 8, 8,
1642
+ 8, 8, 8, 8, 8, 8, 8, 8,
1643
+ 8, 8, 8, 8, 8, 8, 8, 8,
1644
+ 8, 8, 8, 8, 8, 8, 8, 8,
1645
+ 8, 8, 8, 8, 8, 8, 8, 8,
1646
+ 8, 8, 8, 8, 8, 8, 8, 8,
1647
+ 8, 8, 8, 8, 8, 8, 8, 8,
1648
+ 8, 8, 10, 8, 12, 11, 11, 11,
1649
+ 11, 11, 11, 11, 11, 11, 11, 11,
1650
+ 11, 11, 11, 11, 11, 11, 11, 11,
1651
+ 11, 11, 11, 12, 11, 11, 11, 11,
1652
+ 11, 11, 11, 11, 11, 11, 11, 13,
1653
+ 11, 11, 11, 11, 11, 11, 11, 11,
1654
+ 11, 11, 11, 11, 11, 11, 11, 11,
1655
+ 11, 11, 11, 11, 11, 11, 11, 11,
1656
+ 11, 11, 11, 11, 11, 11, 11, 11,
1657
+ 11, 11, 11, 11, 11, 11, 11, 11,
1658
+ 11, 11, 11, 11, 11, 11, 11, 11,
1659
+ 11, 11, 11, 11, 11, 11, 11, 11,
1660
+ 11, 11, 11, 11, 11, 11, 11, 11,
1661
+ 11, 11, 11, 11, 11, 11, 11, 11,
1662
+ 11, 11, 11, 11, 11, 11, 11, 11,
1663
+ 14, 11, 15, 0, 0, 0, 0, 0,
1664
+ 0, 0, 0, 0, 0, 0, 0, 0,
1665
+ 0, 0, 0, 0, 0, 0, 0, 0,
1666
+ 0, 15, 0, 0, 0, 0, 0, 0,
1667
+ 0, 0, 0, 0, 0, 16, 0, 0,
1668
+ 0, 0, 0, 0, 0, 0, 0, 0,
1669
+ 0, 0, 0, 0, 0, 0, 0, 0,
1670
+ 0, 0, 0, 0, 0, 0, 0, 0,
1671
+ 0, 0, 0, 0, 0, 0, 0, 0,
1672
+ 0, 0, 0, 0, 0, 0, 0, 0,
1673
+ 0, 0, 0, 0, 0, 0, 0, 0,
1674
+ 0, 0, 0, 0, 0, 0, 0, 0,
1675
+ 0, 0, 0, 0, 0, 0, 0, 0,
1676
+ 0, 0, 0, 0, 0, 0, 0, 0,
1677
+ 0, 0, 0, 0, 0, 0, 17, 0,
1678
+ 18, 2, 2, 2, 2, 2, 2, 2,
1679
+ 2, 2, 2, 2, 2, 2, 2, 2,
1680
+ 2, 2, 2, 2, 2, 2, 2, 18,
1681
+ 2, 4, 2, 2, 2, 2, 2, 2,
1682
+ 2, 2, 2, 2, 2, 2, 2, 6,
1683
+ 6, 6, 6, 6, 6, 6, 6, 6,
1684
+ 6, 2, 2, 2, 2, 2, 2, 2,
1685
+ 6, 6, 6, 6, 6, 6, 6, 6,
1686
+ 6, 6, 6, 6, 6, 6, 6, 6,
1687
+ 6, 6, 6, 6, 6, 6, 6, 6,
1688
+ 6, 6, 2, 2, 2, 2, 6, 2,
1689
+ 6, 6, 6, 6, 6, 6, 6, 6,
1690
+ 6, 6, 6, 6, 6, 6, 6, 6,
1691
+ 6, 6, 6, 6, 6, 6, 6, 6,
1692
+ 6, 6, 2, 20, 19, 19, 19, 19,
1693
+ 19, 19, 19, 19, 19, 19, 19, 19,
1694
+ 19, 19, 19, 19, 19, 19, 19, 19,
1695
+ 19, 19, 20, 19, 19, 19, 19, 19,
1696
+ 19, 19, 19, 19, 19, 19, 21, 19,
1697
+ 19, 19, 22, 22, 22, 22, 22, 22,
1698
+ 22, 22, 22, 22, 19, 19, 19, 19,
1699
+ 19, 19, 19, 22, 22, 22, 22, 22,
1700
+ 22, 22, 22, 22, 22, 22, 22, 22,
1701
+ 22, 22, 22, 22, 22, 22, 22, 22,
1702
+ 22, 22, 22, 22, 22, 19, 19, 19,
1703
+ 19, 22, 19, 22, 22, 22, 22, 22,
1704
+ 22, 22, 22, 22, 22, 22, 22, 22,
1705
+ 22, 22, 22, 22, 22, 22, 22, 22,
1706
+ 22, 22, 22, 22, 22, 19, 19, 23,
1707
+ 19, 24, 0, 10, 8, 26, 26, 26,
1708
+ 26, 26, 26, 26, 26, 26, 26, 25,
1709
+ 25, 25, 25, 25, 25, 25, 26, 26,
1710
+ 26, 26, 26, 26, 26, 26, 26, 26,
1711
+ 26, 26, 26, 26, 26, 26, 26, 26,
1712
+ 26, 26, 26, 26, 26, 26, 26, 26,
1713
+ 25, 25, 25, 25, 26, 25, 26, 26,
1714
+ 26, 26, 26, 26, 26, 26, 26, 26,
1715
+ 26, 26, 26, 26, 26, 26, 26, 26,
1716
+ 26, 26, 26, 26, 26, 26, 26, 26,
1717
+ 25, 27, 25, 25, 25, 25, 25, 25,
1718
+ 25, 25, 25, 25, 25, 25, 25, 25,
1719
+ 25, 25, 25, 25, 25, 25, 25, 25,
1720
+ 25, 25, 25, 25, 25, 25, 25, 25,
1721
+ 25, 25, 25, 25, 25, 25, 25, 28,
1722
+ 28, 28, 28, 28, 28, 28, 28, 28,
1723
+ 28, 25, 25, 25, 25, 25, 25, 25,
1724
+ 28, 28, 28, 28, 28, 28, 28, 28,
1725
+ 28, 28, 28, 28, 28, 28, 28, 28,
1726
+ 28, 28, 28, 28, 28, 28, 28, 28,
1727
+ 28, 28, 25, 25, 25, 25, 28, 25,
1728
+ 28, 28, 28, 28, 28, 28, 28, 28,
1729
+ 28, 28, 28, 28, 28, 28, 28, 28,
1730
+ 28, 28, 28, 28, 28, 28, 28, 28,
1731
+ 28, 28, 25, 30, 29, 32, 31, 31,
1732
+ 31, 31, 31, 31, 31, 31, 31, 31,
1733
+ 31, 31, 31, 31, 31, 31, 31, 31,
1734
+ 31, 31, 31, 31, 31, 31, 31, 31,
1735
+ 31, 31, 31, 31, 31, 31, 31, 31,
1736
+ 31, 31, 31, 31, 31, 31, 31, 31,
1737
+ 31, 31, 31, 31, 31, 31, 31, 31,
1738
+ 31, 31, 31, 31, 31, 31, 31, 33,
1739
+ 31, 34, 29, 33, 31, 35, 35, 35,
1740
+ 0
1741
+ ]
1742
+
1743
+ class << self
1744
+ attr_accessor :_bel_trans_targs
1745
+ private :_bel_trans_targs, :_bel_trans_targs=
1746
+ end
1747
+ self._bel_trans_targs = [
1748
+ 0, 2, 0, 2, 3, 6, 7, 8,
1749
+ 3, 4, 9, 0, 5, 6, 8, 5,
1750
+ 6, 8, 6, 0, 5, 6, 7, 8,
1751
+ 16, 0, 11, 17, 11, 0, 13, 13,
1752
+ 14, 15, 18, 0
1753
+ ]
1754
+
1755
+ class << self
1756
+ attr_accessor :_bel_trans_actions
1757
+ private :_bel_trans_actions, :_bel_trans_actions=
1758
+ end
1759
+ self._bel_trans_actions = [
1760
+ 1, 2, 3, 4, 5, 6, 7, 8,
1761
+ 10, 10, 10, 9, 11, 12, 13, 0,
1762
+ 14, 15, 0, 16, 17, 18, 19, 20,
1763
+ 21, 22, 7, 23, 19, 24, 5, 10,
1764
+ 10, 10, 25, 0
1765
+ ]
1766
+
1767
+ class << self
1768
+ attr_accessor :_bel_eof_actions
1769
+ private :_bel_eof_actions, :_bel_eof_actions=
1770
+ end
1771
+ self._bel_eof_actions = [
1772
+ 0, 1, 3, 9, 9, 1, 3, 16,
1773
+ 1, 9, 22, 22, 24, 24, 24, 24,
1774
+ 0, 0, 0
1775
+ ]
1776
+
1777
+ class << self
1778
+ attr_accessor :bel_start
1779
+ end
1780
+ self.bel_start = 1;
1781
+ class << self
1782
+ attr_accessor :bel_first_final
1783
+ end
1784
+ self.bel_first_final = 16;
1785
+ class << self
1786
+ attr_accessor :bel_error
1787
+ end
1788
+ self.bel_error = 0;
1789
+
1790
+ class << self
1791
+ attr_accessor :bel_en_ident
1792
+ end
1793
+ self.bel_en_ident = 10;
1794
+ class << self
1795
+ attr_accessor :bel_en_string
1796
+ end
1797
+ self.bel_en_string = 12;
1798
+ class << self
1799
+ attr_accessor :bel_en_list
1800
+ end
1801
+ self.bel_en_list = 1;
1802
+
1803
+
1804
+ # end: ragel
1805
+ end
1806
+
1807
+ def each
1808
+ @buffers = {}
1809
+ data = @content.unpack('C*')
1810
+ p = 0
1811
+ pe = data.length
1812
+ eof = data.length
1813
+
1814
+ # begin: ragel
1815
+
1816
+ begin
1817
+ p ||= 0
1818
+ pe ||= data.length
1819
+ cs = bel_start
1820
+ end
1821
+
1822
+
1823
+ begin
1824
+ testEof = false
1825
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
1826
+ _goto_level = 0
1827
+ _resume = 10
1828
+ _eof_trans = 15
1829
+ _again = 20
1830
+ _test_eof = 30
1831
+ _out = 40
1832
+ while true
1833
+ if _goto_level <= 0
1834
+ if p == pe
1835
+ _goto_level = _test_eof
1836
+ next
1837
+ end
1838
+ if cs == 0
1839
+ _goto_level = _out
1840
+ next
1841
+ end
1842
+ end
1843
+ if _goto_level <= _resume
1844
+ _keys = cs << 1
1845
+ _inds = _bel_index_offsets[cs]
1846
+ _slen = _bel_key_spans[cs]
1847
+ _wide = data[p].ord
1848
+ _trans = if ( _slen > 0 &&
1849
+ _bel_trans_keys[_keys] <= _wide &&
1850
+ _wide <= _bel_trans_keys[_keys + 1]
1851
+ ) then
1852
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
1853
+ else
1854
+ _bel_indicies[ _inds + _slen ]
1855
+ end
1856
+ cs = _bel_trans_targs[_trans]
1857
+ if _bel_trans_actions[_trans] != 0
1858
+ case _bel_trans_actions[_trans]
1859
+ when 19 then
1860
+ begin
1861
+
1862
+ (@buffers[:ident] ||= []) << data[p].ord
1863
+ end
1864
+ when 10 then
1865
+ begin
1866
+
1867
+ (@buffers[:string] ||= []) << data[p].ord
1868
+ end
1869
+ when 14 then
1870
+ begin
1871
+
1872
+ @buffers.delete(:string)
1873
+ @buffers.delete(:ident)
1874
+ end
1875
+ when 2 then
1876
+ begin
1877
+
1878
+ @buffers[:list] = list()
1879
+ end
1880
+ when 4 then
1881
+ begin
1882
+
1883
+ # Append list argument if its value is not empty.
1884
+ if @buffers[:list_arg]
1885
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1886
+ if list_arg_value != ''
1887
+ @buffers[:list] <<= @buffers[:list_arg]
1888
+ end
1889
+ end
1890
+ end
1891
+ when 15 then
1892
+ begin
1893
+
1894
+ #TODO: Mark @buffers[:list] as complete.
1895
+ end
1896
+ when 21 then
1897
+ begin
1898
+
1899
+ yield @buffers[:list]
1900
+ end
1901
+ when 1 then
1902
+ begin
1903
+
1904
+ @buffers[:list] ||= list()
1905
+ yield @buffers[:list]
1906
+ end
1907
+ when 7 then
1908
+ begin
1909
+
1910
+ @buffers[:ident] = []
1911
+ end
1912
+ begin
1913
+
1914
+ (@buffers[:ident] ||= []) << data[p].ord
1915
+ end
1916
+ when 23 then
1917
+ begin
1918
+
1919
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1920
+ end
1921
+ begin
1922
+
1923
+ yield @buffers[:ident]
1924
+ end
1925
+ when 22 then
1926
+ begin
1927
+
1928
+ unless @buffers[:ident].is_a?(::AST::Node)
1929
+ @buffers[:ident] ||= []
1930
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1931
+ end
1932
+ end
1933
+ begin
1934
+
1935
+ @buffers[:ident] ||= []
1936
+ yield @buffers[:ident]
1937
+ end
1938
+ when 5 then
1939
+ begin
1940
+
1941
+ @buffers[:string] = []
1942
+ end
1943
+ begin
1944
+
1945
+ (@buffers[:string] ||= []) << data[p].ord
1946
+ end
1947
+ when 25 then
1948
+ begin
1949
+
1950
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1951
+ end
1952
+ begin
1953
+
1954
+ yield @buffers[:string]
1955
+ end
1956
+ when 24 then
1957
+ begin
1958
+
1959
+ @buffers[:string] ||= []
1960
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1961
+ end
1962
+ begin
1963
+
1964
+ @buffers[:string] ||= []
1965
+ yield @buffers[:string]
1966
+ end
1967
+ when 6 then
1968
+ begin
1969
+
1970
+ # Append list argument if its value is not empty.
1971
+ if @buffers[:list_arg]
1972
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1973
+ if list_arg_value != ''
1974
+ @buffers[:list] <<= @buffers[:list_arg]
1975
+ end
1976
+ end
1977
+ end
1978
+ begin
1979
+
1980
+ @buffers.delete(:string)
1981
+ @buffers.delete(:ident)
1982
+ end
1983
+ when 8 then
1984
+ begin
1985
+
1986
+ # Append list argument if its value is not empty.
1987
+ if @buffers[:list_arg]
1988
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
1989
+ if list_arg_value != ''
1990
+ @buffers[:list] <<= @buffers[:list_arg]
1991
+ end
1992
+ end
1993
+ end
1994
+ begin
1995
+
1996
+ #TODO: Mark @buffers[:list] as complete.
1997
+ end
1998
+ when 17 then
1999
+ begin
2000
+
2001
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2002
+ end
2003
+ begin
2004
+
2005
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2006
+ end
2007
+ begin
2008
+
2009
+ # Append list argument if its value is not empty.
2010
+ if @buffers[:list_arg]
2011
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2012
+ if list_arg_value != ''
2013
+ @buffers[:list] <<= @buffers[:list_arg]
2014
+ end
2015
+ end
2016
+ end
2017
+ when 11 then
2018
+ begin
2019
+
2020
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
2021
+ end
2022
+ begin
2023
+
2024
+ @buffers[:list_arg] = list_item(@buffers[:string])
2025
+ end
2026
+ begin
2027
+
2028
+ # Append list argument if its value is not empty.
2029
+ if @buffers[:list_arg]
2030
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2031
+ if list_arg_value != ''
2032
+ @buffers[:list] <<= @buffers[:list_arg]
2033
+ end
2034
+ end
2035
+ end
2036
+ when 18 then
2037
+ begin
2038
+
2039
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2040
+ end
2041
+ begin
2042
+
2043
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2044
+ end
2045
+ begin
2046
+
2047
+ # Append list argument if its value is not empty.
2048
+ if @buffers[:list_arg]
2049
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2050
+ if list_arg_value != ''
2051
+ @buffers[:list] <<= @buffers[:list_arg]
2052
+ end
2053
+ end
2054
+ end
2055
+ begin
2056
+
2057
+ @buffers.delete(:string)
2058
+ @buffers.delete(:ident)
2059
+ end
2060
+ when 20 then
2061
+ begin
2062
+
2063
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2064
+ end
2065
+ begin
2066
+
2067
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2068
+ end
2069
+ begin
2070
+
2071
+ # Append list argument if its value is not empty.
2072
+ if @buffers[:list_arg]
2073
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2074
+ if list_arg_value != ''
2075
+ @buffers[:list] <<= @buffers[:list_arg]
2076
+ end
2077
+ end
2078
+ end
2079
+ begin
2080
+
2081
+ #TODO: Mark @buffers[:list] as complete.
2082
+ end
2083
+ when 16 then
2084
+ begin
2085
+
2086
+ unless @buffers[:ident].is_a?(::AST::Node)
2087
+ @buffers[:ident] ||= []
2088
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2089
+ end
2090
+ end
2091
+ begin
2092
+
2093
+ #TODO: Mark @buffers[:list_arg] identifier as error.
2094
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2095
+ end
2096
+ begin
2097
+
2098
+ # Append list argument if its value is not empty.
2099
+ if @buffers[:list_arg]
2100
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2101
+ if list_arg_value != ''
2102
+ @buffers[:list] <<= @buffers[:list_arg]
2103
+ end
2104
+ end
2105
+ end
2106
+ begin
2107
+
2108
+ @buffers[:list] ||= list()
2109
+ yield @buffers[:list]
2110
+ end
2111
+ when 12 then
2112
+ begin
2113
+
2114
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
2115
+ end
2116
+ begin
2117
+
2118
+ @buffers[:list_arg] = list_item(@buffers[:string])
2119
+ end
2120
+ begin
2121
+
2122
+ # Append list argument if its value is not empty.
2123
+ if @buffers[:list_arg]
2124
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2125
+ if list_arg_value != ''
2126
+ @buffers[:list] <<= @buffers[:list_arg]
2127
+ end
2128
+ end
2129
+ end
2130
+ begin
2131
+
2132
+ @buffers.delete(:string)
2133
+ @buffers.delete(:ident)
2134
+ end
2135
+ when 13 then
2136
+ begin
2137
+
2138
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
2139
+ end
2140
+ begin
2141
+
2142
+ @buffers[:list_arg] = list_item(@buffers[:string])
2143
+ end
2144
+ begin
2145
+
2146
+ # Append list argument if its value is not empty.
2147
+ if @buffers[:list_arg]
2148
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2149
+ if list_arg_value != ''
2150
+ @buffers[:list] <<= @buffers[:list_arg]
2151
+ end
2152
+ end
2153
+ end
2154
+ begin
2155
+
2156
+ #TODO: Mark @buffers[:list] as complete.
2157
+ end
2158
+ when 9 then
2159
+ begin
2160
+
2161
+ @buffers[:string] ||= []
2162
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2163
+ end
2164
+ begin
2165
+
2166
+ #TODO: Mark @buffers[:list_arg] string as error.
2167
+ @buffers[:list_arg] = list_item(@buffers[:string])
2168
+ end
2169
+ begin
2170
+
2171
+ # Append list argument if its value is not empty.
2172
+ if @buffers[:list_arg]
2173
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2174
+ if list_arg_value != ''
2175
+ @buffers[:list] <<= @buffers[:list_arg]
2176
+ end
2177
+ end
2178
+ end
2179
+ begin
2180
+
2181
+ @buffers[:list] ||= list()
2182
+ yield @buffers[:list]
2183
+ end
2184
+ when 3 then
2185
+ begin
2186
+
2187
+ @buffers[:string] ||= []
2188
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2189
+ end
2190
+ begin
2191
+
2192
+ #TODO: Mark @buffers[:list_arg] string as error.
2193
+ @buffers[:list_arg] = list_item(@buffers[:string])
2194
+ end
2195
+ begin
2196
+
2197
+ unless @buffers[:ident].is_a?(::AST::Node)
2198
+ @buffers[:ident] ||= []
2199
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2200
+ end
2201
+ end
2202
+ begin
2203
+
2204
+ #TODO: Mark @buffers[:list_arg] identifier as error.
2205
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2206
+ end
2207
+ begin
2208
+
2209
+ # Append list argument if its value is not empty.
2210
+ if @buffers[:list_arg]
2211
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2212
+ if list_arg_value != ''
2213
+ @buffers[:list] <<= @buffers[:list_arg]
2214
+ end
2215
+ end
2216
+ end
2217
+ begin
2218
+
2219
+ @buffers[:list] ||= list()
2220
+ yield @buffers[:list]
2221
+ end
2222
+ end
2223
+ end
2224
+ end
2225
+ if _goto_level <= _again
2226
+ if cs == 0
2227
+ _goto_level = _out
2228
+ next
2229
+ end
2230
+ p += 1
2231
+ if p != pe
2232
+ _goto_level = _resume
2233
+ next
2234
+ end
2235
+ end
2236
+ if _goto_level <= _test_eof
2237
+ if p == eof
2238
+ case _bel_eof_actions[cs]
2239
+ when 1 then
2240
+ begin
2241
+
2242
+ @buffers[:list] ||= list()
2243
+ yield @buffers[:list]
2244
+ end
2245
+ when 22 then
2246
+ begin
2247
+
2248
+ unless @buffers[:ident].is_a?(::AST::Node)
2249
+ @buffers[:ident] ||= []
2250
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2251
+ end
2252
+ end
2253
+ begin
2254
+
2255
+ @buffers[:ident] ||= []
2256
+ yield @buffers[:ident]
2257
+ end
2258
+ when 24 then
2259
+ begin
2260
+
2261
+ @buffers[:string] ||= []
2262
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2263
+ end
2264
+ begin
2265
+
2266
+ @buffers[:string] ||= []
2267
+ yield @buffers[:string]
2268
+ end
2269
+ when 16 then
2270
+ begin
2271
+
2272
+ unless @buffers[:ident].is_a?(::AST::Node)
2273
+ @buffers[:ident] ||= []
2274
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2275
+ end
2276
+ end
2277
+ begin
2278
+
2279
+ #TODO: Mark @buffers[:list_arg] identifier as error.
2280
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2281
+ end
2282
+ begin
2283
+
2284
+ # Append list argument if its value is not empty.
2285
+ if @buffers[:list_arg]
2286
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2287
+ if list_arg_value != ''
2288
+ @buffers[:list] <<= @buffers[:list_arg]
2289
+ end
2290
+ end
2291
+ end
2292
+ begin
2293
+
2294
+ @buffers[:list] ||= list()
2295
+ yield @buffers[:list]
2296
+ end
2297
+ when 9 then
2298
+ begin
2299
+
2300
+ @buffers[:string] ||= []
2301
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2302
+ end
2303
+ begin
2304
+
2305
+ #TODO: Mark @buffers[:list_arg] string as error.
2306
+ @buffers[:list_arg] = list_item(@buffers[:string])
2307
+ end
2308
+ begin
2309
+
2310
+ # Append list argument if its value is not empty.
2311
+ if @buffers[:list_arg]
2312
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2313
+ if list_arg_value != ''
2314
+ @buffers[:list] <<= @buffers[:list_arg]
2315
+ end
2316
+ end
2317
+ end
2318
+ begin
2319
+
2320
+ @buffers[:list] ||= list()
2321
+ yield @buffers[:list]
2322
+ end
2323
+ when 3 then
2324
+ begin
2325
+
2326
+ @buffers[:string] ||= []
2327
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2328
+ end
2329
+ begin
2330
+
2331
+ #TODO: Mark @buffers[:list_arg] string as error.
2332
+ @buffers[:list_arg] = list_item(@buffers[:string])
2333
+ end
2334
+ begin
2335
+
2336
+ unless @buffers[:ident].is_a?(::AST::Node)
2337
+ @buffers[:ident] ||= []
2338
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2339
+ end
2340
+ end
2341
+ begin
2342
+
2343
+ #TODO: Mark @buffers[:list_arg] identifier as error.
2344
+ @buffers[:list_arg] = list_item(@buffers[:ident])
2345
+ end
2346
+ begin
2347
+
2348
+ # Append list argument if its value is not empty.
2349
+ if @buffers[:list_arg]
2350
+ list_arg_value = @buffers[:list_arg].children[0].children[0]
2351
+ if list_arg_value != ''
2352
+ @buffers[:list] <<= @buffers[:list_arg]
2353
+ end
2354
+ end
2355
+ end
2356
+ begin
2357
+
2358
+ @buffers[:list] ||= list()
2359
+ yield @buffers[:list]
2360
+ end
2361
+ end
2362
+ end
2363
+
2364
+ end
2365
+ if _goto_level <= _out
2366
+ break
2367
+ end
2368
+ end
2369
+ end
2370
+
2371
+ # end: ragel
2372
+ end
2373
+ end
2374
+ end
2375
+ end
2376
+ end
2377
+ end
2378
+
2379
+ if __FILE__ == $0
2380
+ $stdin.each_line do |line|
2381
+ BELParser::Parsers::Common::List.parse(line) { |obj|
2382
+ puts obj.inspect
2383
+ }
2384
+ end
2385
+ end
2386
+
2387
+ # vim: ft=ruby ts=2 sw=2:
2388
+ # encoding: utf-8