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,141 @@
1
+ # begin: ragel
2
+ =begin
3
+ %%{
4
+ machine bel;
5
+
6
+ include 'common.rl';
7
+ include 'identifier.rl';
8
+ include 'string.rl';
9
+ include 'list.rl';
10
+
11
+ DEFINE_KW = [dD][eE][fF][iI][nN][eE];
12
+ ANNOTATION_KW = [aA][nN][nN][oO][tT][aA][tT][iI][oO][nN];
13
+ AS_KW = [aA][sS];
14
+ LIST_KW = [lL][iI][sS][tT];
15
+ PATTERN_KW = [pP][aA][tT][tT][eE][rR][nN];
16
+ URL_KW = [uU][rR][lL];
17
+
18
+ action annotation_keyword {
19
+ @buffers[:annotation_definition] = annotation_definition()
20
+ }
21
+
22
+ action keyword {
23
+ @buffers[:annotation_definition] = annotation_definition(
24
+ keyword(@buffers[:ident]))
25
+ }
26
+
27
+ action list_keyword {
28
+ @buffers[:annotation_definition] = @buffers[:annotation_definition] << domain()
29
+ }
30
+
31
+ action pattern_keyword {
32
+ @buffers[:annotation_definition] = @buffers[:annotation_definition] << domain(pattern())
33
+ }
34
+
35
+ action url_keyword {
36
+ @buffers[:annotation_definition] = @buffers[:annotation_definition] << domain(url())
37
+ }
38
+
39
+ action pattern {
40
+ keyword, domain = @buffers[:annotation_definition].children
41
+ domain = domain(
42
+ domain.children[0] << @buffers[:string])
43
+ @buffers[:annotation_definition] = annotation_definition(keyword, domain)
44
+ }
45
+
46
+ action url {
47
+ keyword, domain = @buffers[:annotation_definition].children
48
+ domain = domain(
49
+ domain.children[0] << @buffers[:string])
50
+ @buffers[:annotation_definition] = annotation_definition(keyword, domain)
51
+ }
52
+
53
+ action list {
54
+ keyword, domain = @buffers[:annotation_definition].children
55
+ domain = domain(
56
+ @buffers[:list])
57
+ @buffers[:annotation_definition] = annotation_definition(keyword, domain)
58
+ }
59
+
60
+ action yield_annotation_definition {
61
+ yield @buffers[:annotation_definition]
62
+ }
63
+
64
+ # Define FSM
65
+ annotation_definition :=
66
+ DEFINE_KW SP+ ANNOTATION_KW @annotation_keyword SP+
67
+ IDENT %keyword SP+
68
+ AS_KW SP+
69
+ (
70
+ (LIST_KW %list_keyword SP+ LIST %list SP* NL @yield_annotation_definition) |
71
+ (PATTERN_KW %pattern_keyword SP+ STRING %pattern SP* NL @yield_annotation_definition) |
72
+ (URL_KW %url_keyword SP+ STRING %url SP* NL @yield_annotation_definition)
73
+ );
74
+ }%%
75
+ =end
76
+ # end: ragel
77
+
78
+ require_relative '../ast/node'
79
+ require_relative '../mixin/buffer'
80
+ require_relative '../nonblocking_io_wrapper'
81
+
82
+ module BELParser
83
+ module Parsers
84
+ module BELScript
85
+ module DefineAnnotation
86
+
87
+ class << self
88
+
89
+ MAX_LENGTH = 1024 * 128 # 128K
90
+
91
+ def parse(content)
92
+ return nil unless content
93
+
94
+ Parser.new(content).each do |obj|
95
+ yield obj
96
+ end
97
+ end
98
+ end
99
+
100
+ private
101
+
102
+ class Parser
103
+ include Enumerable
104
+ include BELParser::Parsers::Buffer
105
+ include BELParser::Parsers::AST::Sexp
106
+
107
+ def initialize(content)
108
+ @content = content
109
+ # begin: ragel
110
+ %% write data;
111
+ # end: ragel
112
+ end
113
+
114
+ def each
115
+ @buffers = {}
116
+ data = @content.unpack('C*')
117
+ p = 0
118
+ pe = data.length
119
+ eof = data.length
120
+
121
+ # begin: ragel
122
+ %% write init;
123
+ %% write exec;
124
+ # end: ragel
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ if __FILE__ == $0
133
+ $stdin.each_line do |line|
134
+ BELParser::Parsers::BELScript::DefineAnnotation.parse(line) { |obj|
135
+ puts obj.inspect
136
+ }
137
+ end
138
+ end
139
+
140
+ # vim: ft=ruby ts=2 sw=2:
141
+ # encoding: utf-8
@@ -0,0 +1,1780 @@
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, 68, 100, 69, 101,
11
+ 70, 102, 73, 105, 78,
12
+ 110, 69, 101, 9, 32,
13
+ 9, 110, 65, 97, 77, 109,
14
+ 69, 101, 83, 115, 80,
15
+ 112, 65, 97, 67, 99,
16
+ 69, 101, 9, 32, 9, 122,
17
+ 9, 122, 9, 97, 83,
18
+ 115, 9, 32, 9, 117,
19
+ 82, 114, 76, 108, 9, 32,
20
+ 9, 34, 34, 92, 9,
21
+ 32, 9, 32, 92, 92,
22
+ 48, 122, 10, 122, 34, 34,
23
+ 34, 92, 10, 10, 92,
24
+ 92, 0, 0, 0, 0,
25
+ 0, 0, 0
26
+ ]
27
+
28
+ class << self
29
+ attr_accessor :_bel_key_spans
30
+ private :_bel_key_spans, :_bel_key_spans=
31
+ end
32
+ self._bel_key_spans = [
33
+ 0, 33, 33, 33, 33, 33, 33, 24,
34
+ 102, 33, 33, 33, 33, 33, 33, 33,
35
+ 33, 24, 114, 114, 89, 33, 24, 109,
36
+ 33, 33, 24, 26, 59, 24, 24, 1,
37
+ 75, 113, 1, 59, 1, 1, 0, 0,
38
+ 0
39
+ ]
40
+
41
+ class << self
42
+ attr_accessor :_bel_index_offsets
43
+ private :_bel_index_offsets, :_bel_index_offsets=
44
+ end
45
+ self._bel_index_offsets = [
46
+ 0, 0, 34, 68, 102, 136, 170, 204,
47
+ 229, 332, 366, 400, 434, 468, 502, 536,
48
+ 570, 604, 629, 744, 859, 949, 983, 1008,
49
+ 1118, 1152, 1186, 1211, 1238, 1298, 1323, 1348,
50
+ 1350, 1426, 1540, 1542, 1602, 1604, 1606, 1607,
51
+ 1608
52
+ ]
53
+
54
+ class << self
55
+ attr_accessor :_bel_indicies
56
+ private :_bel_indicies, :_bel_indicies=
57
+ end
58
+ self._bel_indicies = [
59
+ 0, 1, 1, 1, 1, 1, 1, 1,
60
+ 1, 1, 1, 1, 1, 1, 1, 1,
61
+ 1, 1, 1, 1, 1, 1, 1, 1,
62
+ 1, 1, 1, 1, 1, 1, 1, 1,
63
+ 0, 1, 2, 1, 1, 1, 1, 1,
64
+ 1, 1, 1, 1, 1, 1, 1, 1,
65
+ 1, 1, 1, 1, 1, 1, 1, 1,
66
+ 1, 1, 1, 1, 1, 1, 1, 1,
67
+ 1, 1, 2, 1, 3, 1, 1, 1,
68
+ 1, 1, 1, 1, 1, 1, 1, 1,
69
+ 1, 1, 1, 1, 1, 1, 1, 1,
70
+ 1, 1, 1, 1, 1, 1, 1, 1,
71
+ 1, 1, 1, 1, 3, 1, 4, 1,
72
+ 1, 1, 1, 1, 1, 1, 1, 1,
73
+ 1, 1, 1, 1, 1, 1, 1, 1,
74
+ 1, 1, 1, 1, 1, 1, 1, 1,
75
+ 1, 1, 1, 1, 1, 1, 4, 1,
76
+ 5, 1, 1, 1, 1, 1, 1, 1,
77
+ 1, 1, 1, 1, 1, 1, 1, 1,
78
+ 1, 1, 1, 1, 1, 1, 1, 1,
79
+ 1, 1, 1, 1, 1, 1, 1, 1,
80
+ 5, 1, 6, 1, 1, 1, 1, 1,
81
+ 1, 1, 1, 1, 1, 1, 1, 1,
82
+ 1, 1, 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1, 1, 1,
118
+ 1, 1, 1, 1, 1, 1, 1, 1,
119
+ 1, 1, 1, 1, 1, 1, 1, 1,
120
+ 1, 1, 1, 1, 1, 1, 1, 1,
121
+ 1, 1, 1, 1, 13, 1, 14, 1,
122
+ 1, 1, 1, 1, 1, 1, 1, 1,
123
+ 1, 1, 1, 1, 1, 1, 1, 1,
124
+ 1, 1, 1, 1, 1, 1, 1, 1,
125
+ 1, 1, 1, 1, 1, 1, 14, 1,
126
+ 15, 1, 1, 1, 1, 1, 1, 1,
127
+ 1, 1, 1, 1, 1, 1, 1, 1,
128
+ 1, 1, 1, 1, 1, 1, 1, 1,
129
+ 1, 1, 1, 1, 1, 1, 1, 1,
130
+ 15, 1, 16, 1, 1, 1, 1, 1,
131
+ 1, 1, 1, 1, 1, 1, 1, 1,
132
+ 1, 1, 1, 1, 1, 1, 1, 1,
133
+ 1, 1, 1, 1, 1, 1, 1, 1,
134
+ 1, 1, 16, 1, 17, 1, 1, 1,
135
+ 1, 1, 1, 1, 1, 1, 1, 1,
136
+ 1, 1, 1, 1, 1, 1, 1, 1,
137
+ 1, 1, 1, 17, 1, 17, 18, 18,
138
+ 18, 18, 18, 18, 18, 18, 18, 18,
139
+ 18, 18, 18, 18, 18, 18, 18, 18,
140
+ 18, 18, 18, 18, 17, 18, 18, 18,
141
+ 18, 18, 18, 18, 18, 18, 18, 18,
142
+ 18, 18, 18, 18, 19, 19, 19, 19,
143
+ 19, 19, 19, 19, 19, 19, 18, 18,
144
+ 18, 18, 18, 18, 18, 19, 19, 19,
145
+ 19, 19, 19, 19, 19, 19, 19, 19,
146
+ 19, 19, 19, 19, 19, 19, 19, 19,
147
+ 19, 19, 19, 19, 19, 19, 19, 18,
148
+ 18, 18, 18, 19, 18, 19, 19, 19,
149
+ 19, 19, 19, 19, 19, 19, 19, 19,
150
+ 19, 19, 19, 19, 19, 19, 19, 19,
151
+ 19, 19, 19, 19, 19, 19, 19, 18,
152
+ 20, 18, 18, 18, 18, 18, 18, 18,
153
+ 18, 18, 18, 18, 18, 18, 18, 18,
154
+ 18, 18, 18, 18, 18, 18, 18, 20,
155
+ 18, 18, 18, 18, 18, 18, 18, 18,
156
+ 18, 18, 18, 18, 18, 18, 18, 21,
157
+ 21, 21, 21, 21, 21, 21, 21, 21,
158
+ 21, 18, 18, 18, 18, 18, 18, 18,
159
+ 21, 21, 21, 21, 21, 21, 21, 21,
160
+ 21, 21, 21, 21, 21, 21, 21, 21,
161
+ 21, 21, 21, 21, 21, 21, 21, 21,
162
+ 21, 21, 18, 18, 18, 18, 21, 18,
163
+ 21, 21, 21, 21, 21, 21, 21, 21,
164
+ 21, 21, 21, 21, 21, 21, 21, 21,
165
+ 21, 21, 21, 21, 21, 21, 21, 21,
166
+ 21, 21, 18, 22, 1, 1, 1, 1,
167
+ 1, 1, 1, 1, 1, 1, 1, 1,
168
+ 1, 1, 1, 1, 1, 1, 1, 1,
169
+ 1, 1, 22, 1, 1, 1, 1, 1,
170
+ 1, 1, 1, 1, 1, 1, 1, 1,
171
+ 1, 1, 1, 1, 1, 1, 1, 1,
172
+ 1, 1, 1, 1, 1, 1, 1, 1,
173
+ 1, 1, 1, 23, 1, 1, 1, 1,
174
+ 1, 1, 1, 1, 1, 1, 1, 1,
175
+ 1, 1, 1, 1, 1, 1, 1, 1,
176
+ 1, 1, 1, 1, 1, 1, 1, 1,
177
+ 1, 1, 1, 23, 1, 24, 1, 1,
178
+ 1, 1, 1, 1, 1, 1, 1, 1,
179
+ 1, 1, 1, 1, 1, 1, 1, 1,
180
+ 1, 1, 1, 1, 1, 1, 1, 1,
181
+ 1, 1, 1, 1, 1, 24, 1, 25,
182
+ 1, 1, 1, 1, 1, 1, 1, 1,
183
+ 1, 1, 1, 1, 1, 1, 1, 1,
184
+ 1, 1, 1, 1, 1, 1, 25, 1,
185
+ 25, 1, 1, 1, 1, 1, 1, 1,
186
+ 1, 1, 1, 1, 1, 1, 1, 1,
187
+ 1, 1, 1, 1, 1, 1, 1, 25,
188
+ 1, 1, 1, 1, 1, 1, 1, 1,
189
+ 1, 1, 1, 1, 1, 1, 1, 1,
190
+ 1, 1, 1, 1, 1, 1, 1, 1,
191
+ 1, 1, 1, 1, 1, 1, 1, 1,
192
+ 1, 1, 1, 1, 1, 1, 1, 1,
193
+ 1, 1, 1, 1, 1, 1, 1, 1,
194
+ 1, 1, 1, 1, 26, 1, 1, 1,
195
+ 1, 1, 1, 1, 1, 1, 1, 1,
196
+ 1, 1, 1, 1, 1, 1, 1, 1,
197
+ 1, 1, 1, 1, 1, 1, 1, 1,
198
+ 1, 1, 1, 1, 26, 1, 27, 1,
199
+ 1, 1, 1, 1, 1, 1, 1, 1,
200
+ 1, 1, 1, 1, 1, 1, 1, 1,
201
+ 1, 1, 1, 1, 1, 1, 1, 1,
202
+ 1, 1, 1, 1, 1, 1, 27, 1,
203
+ 28, 1, 1, 1, 1, 1, 1, 1,
204
+ 1, 1, 1, 1, 1, 1, 1, 1,
205
+ 1, 1, 1, 1, 1, 1, 1, 1,
206
+ 1, 1, 1, 1, 1, 1, 1, 1,
207
+ 28, 1, 29, 1, 1, 1, 1, 1,
208
+ 1, 1, 1, 1, 1, 1, 1, 1,
209
+ 1, 1, 1, 1, 1, 1, 1, 1,
210
+ 1, 29, 1, 29, 30, 30, 30, 30,
211
+ 30, 30, 30, 30, 30, 30, 30, 30,
212
+ 30, 30, 30, 30, 30, 30, 30, 30,
213
+ 30, 30, 29, 30, 31, 30, 33, 32,
214
+ 32, 32, 32, 32, 32, 32, 32, 32,
215
+ 32, 32, 32, 32, 32, 32, 32, 32,
216
+ 32, 32, 32, 32, 32, 32, 32, 32,
217
+ 32, 32, 32, 32, 32, 32, 32, 32,
218
+ 32, 32, 32, 32, 32, 32, 32, 32,
219
+ 32, 32, 32, 32, 32, 32, 32, 32,
220
+ 32, 32, 32, 32, 32, 32, 32, 32,
221
+ 34, 32, 35, 36, 30, 30, 30, 30,
222
+ 30, 30, 30, 30, 30, 30, 30, 30,
223
+ 30, 30, 30, 30, 30, 30, 30, 30,
224
+ 30, 35, 30, 37, 38, 1, 1, 1,
225
+ 1, 1, 1, 1, 1, 1, 1, 1,
226
+ 1, 1, 1, 1, 1, 1, 1, 1,
227
+ 1, 1, 37, 1, 34, 32, 40, 40,
228
+ 40, 40, 40, 40, 40, 40, 40, 40,
229
+ 39, 39, 39, 39, 39, 39, 39, 40,
230
+ 40, 40, 40, 40, 40, 40, 40, 40,
231
+ 40, 40, 40, 40, 40, 40, 40, 40,
232
+ 40, 40, 40, 40, 40, 40, 40, 40,
233
+ 40, 39, 39, 39, 39, 40, 39, 40,
234
+ 40, 40, 40, 40, 40, 40, 40, 40,
235
+ 40, 40, 40, 40, 40, 40, 40, 40,
236
+ 40, 40, 40, 40, 40, 40, 40, 40,
237
+ 40, 39, 41, 39, 39, 39, 39, 39,
238
+ 39, 39, 39, 39, 39, 39, 39, 39,
239
+ 39, 39, 39, 39, 39, 39, 39, 39,
240
+ 39, 39, 39, 39, 39, 39, 39, 39,
241
+ 39, 39, 39, 39, 39, 39, 39, 39,
242
+ 42, 42, 42, 42, 42, 42, 42, 42,
243
+ 42, 42, 39, 39, 39, 39, 39, 39,
244
+ 39, 42, 42, 42, 42, 42, 42, 42,
245
+ 42, 42, 42, 42, 42, 42, 42, 42,
246
+ 42, 42, 42, 42, 42, 42, 42, 42,
247
+ 42, 42, 42, 39, 39, 39, 39, 42,
248
+ 39, 42, 42, 42, 42, 42, 42, 42,
249
+ 42, 42, 42, 42, 42, 42, 42, 42,
250
+ 42, 42, 42, 42, 42, 42, 42, 42,
251
+ 42, 42, 42, 39, 44, 43, 46, 45,
252
+ 45, 45, 45, 45, 45, 45, 45, 45,
253
+ 45, 45, 45, 45, 45, 45, 45, 45,
254
+ 45, 45, 45, 45, 45, 45, 45, 45,
255
+ 45, 45, 45, 45, 45, 45, 45, 45,
256
+ 45, 45, 45, 45, 45, 45, 45, 45,
257
+ 45, 45, 45, 45, 45, 45, 45, 45,
258
+ 45, 45, 45, 45, 45, 45, 45, 45,
259
+ 47, 45, 48, 43, 47, 45, 1, 1,
260
+ 1, 0
261
+ ]
262
+
263
+ class << self
264
+ attr_accessor :_bel_trans_targs
265
+ private :_bel_trans_targs, :_bel_trans_targs=
266
+ end
267
+ self._bel_trans_targs = [
268
+ 2, 0, 3, 4, 5, 6, 7, 8,
269
+ 9, 10, 11, 12, 13, 14, 15, 16,
270
+ 17, 18, 0, 19, 20, 19, 20, 21,
271
+ 22, 23, 24, 25, 26, 27, 0, 28,
272
+ 28, 29, 31, 30, 38, 30, 38, 0,
273
+ 33, 39, 33, 0, 35, 35, 36, 37,
274
+ 40
275
+ ]
276
+
277
+ class << self
278
+ attr_accessor :_bel_trans_actions
279
+ private :_bel_trans_actions, :_bel_trans_actions=
280
+ end
281
+ self._bel_trans_actions = [
282
+ 0, 0, 0, 0, 0, 0, 0, 0,
283
+ 0, 0, 0, 0, 0, 0, 0, 0,
284
+ 1, 0, 2, 3, 4, 5, 0, 0,
285
+ 0, 0, 0, 0, 6, 0, 7, 8,
286
+ 9, 9, 9, 10, 11, 0, 12, 13,
287
+ 3, 14, 5, 15, 8, 9, 9, 9,
288
+ 16
289
+ ]
290
+
291
+ class << self
292
+ attr_accessor :_bel_eof_actions
293
+ private :_bel_eof_actions, :_bel_eof_actions=
294
+ end
295
+ self._bel_eof_actions = [
296
+ 0, 0, 0, 0, 0, 0, 0, 0,
297
+ 0, 0, 0, 0, 0, 0, 0, 0,
298
+ 0, 0, 2, 2, 0, 0, 0, 0,
299
+ 0, 0, 0, 7, 7, 7, 0, 7,
300
+ 13, 13, 15, 15, 15, 15, 0, 0,
301
+ 0
302
+ ]
303
+
304
+ class << self
305
+ attr_accessor :bel_start
306
+ end
307
+ self.bel_start = 1;
308
+ class << self
309
+ attr_accessor :bel_first_final
310
+ end
311
+ self.bel_first_final = 38;
312
+ class << self
313
+ attr_accessor :bel_error
314
+ end
315
+ self.bel_error = 0;
316
+
317
+ class << self
318
+ attr_accessor :bel_en_ident
319
+ end
320
+ self.bel_en_ident = 32;
321
+ class << self
322
+ attr_accessor :bel_en_string
323
+ end
324
+ self.bel_en_string = 34;
325
+ class << self
326
+ attr_accessor :bel_en_define_namespace
327
+ end
328
+ self.bel_en_define_namespace = 1;
329
+
330
+
331
+ begin
332
+ p ||= 0
333
+ pe ||= data.length
334
+ cs = bel_start
335
+ end
336
+
337
+ begin
338
+ testEof = false
339
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
340
+ _goto_level = 0
341
+ _resume = 10
342
+ _eof_trans = 15
343
+ _again = 20
344
+ _test_eof = 30
345
+ _out = 40
346
+ while true
347
+ if _goto_level <= 0
348
+ if p == pe
349
+ _goto_level = _test_eof
350
+ next
351
+ end
352
+ if cs == 0
353
+ _goto_level = _out
354
+ next
355
+ end
356
+ end
357
+ if _goto_level <= _resume
358
+ _keys = cs << 1
359
+ _inds = _bel_index_offsets[cs]
360
+ _slen = _bel_key_spans[cs]
361
+ _wide = data[p].ord
362
+ _trans = if ( _slen > 0 &&
363
+ _bel_trans_keys[_keys] <= _wide &&
364
+ _wide <= _bel_trans_keys[_keys + 1]
365
+ ) then
366
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
367
+ else
368
+ _bel_indicies[ _inds + _slen ]
369
+ end
370
+ cs = _bel_trans_targs[_trans]
371
+ if _bel_trans_actions[_trans] != 0
372
+ case _bel_trans_actions[_trans]
373
+ when 5 then
374
+ begin
375
+
376
+ (@buffers[:ident] ||= []) << data[p].ord
377
+ end
378
+ when 2 then
379
+ begin
380
+
381
+ unless @buffers[:ident].is_a?(::AST::Node)
382
+ @buffers[:ident] ||= []
383
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
384
+ end
385
+ end
386
+ when 9 then
387
+ begin
388
+
389
+ (@buffers[:string] ||= []) << data[p].ord
390
+ end
391
+ when 7 then
392
+ begin
393
+
394
+ @buffers[:string] ||= []
395
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
396
+ end
397
+ when 1 then
398
+ begin
399
+
400
+ @buffers[:namespace_definition] = namespace_definition()
401
+ end
402
+ when 6 then
403
+ begin
404
+
405
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << domain(url())
406
+ end
407
+ when 12 then
408
+ begin
409
+
410
+ yield @buffers[:namespace_definition]
411
+ end
412
+ when 3 then
413
+ begin
414
+
415
+ @buffers[:ident] = []
416
+ end
417
+ begin
418
+
419
+ (@buffers[:ident] ||= []) << data[p].ord
420
+ end
421
+ when 14 then
422
+ begin
423
+
424
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
425
+ end
426
+ begin
427
+
428
+ yield @buffers[:ident]
429
+ end
430
+ when 4 then
431
+ begin
432
+
433
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
434
+ end
435
+ begin
436
+
437
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << keyword(@buffers[:ident])
438
+ end
439
+ when 13 then
440
+ begin
441
+
442
+ unless @buffers[:ident].is_a?(::AST::Node)
443
+ @buffers[:ident] ||= []
444
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
445
+ end
446
+ end
447
+ begin
448
+
449
+ @buffers[:ident] ||= []
450
+ yield @buffers[:ident]
451
+ end
452
+ when 8 then
453
+ begin
454
+
455
+ @buffers[:string] = []
456
+ end
457
+ begin
458
+
459
+ (@buffers[:string] ||= []) << data[p].ord
460
+ end
461
+ when 16 then
462
+ begin
463
+
464
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
465
+ end
466
+ begin
467
+
468
+ yield @buffers[:string]
469
+ end
470
+ when 10 then
471
+ begin
472
+
473
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
474
+ end
475
+ begin
476
+
477
+ keyword, domain = @buffers[:namespace_definition].children
478
+ domain = domain(
479
+ domain.children[0] << @buffers[:string])
480
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
481
+ end
482
+ when 15 then
483
+ begin
484
+
485
+ @buffers[:string] ||= []
486
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
487
+ end
488
+ begin
489
+
490
+ @buffers[:string] ||= []
491
+ yield @buffers[:string]
492
+ end
493
+ when 11 then
494
+ begin
495
+
496
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
497
+ end
498
+ begin
499
+
500
+ keyword, domain = @buffers[:namespace_definition].children
501
+ domain = domain(
502
+ domain.children[0] << @buffers[:string])
503
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
504
+ end
505
+ begin
506
+
507
+ yield @buffers[:namespace_definition]
508
+ end
509
+ end
510
+ end
511
+ end
512
+ if _goto_level <= _again
513
+ if cs == 0
514
+ _goto_level = _out
515
+ next
516
+ end
517
+ p += 1
518
+ if p != pe
519
+ _goto_level = _resume
520
+ next
521
+ end
522
+ end
523
+ if _goto_level <= _test_eof
524
+ if p == eof
525
+ case _bel_eof_actions[cs]
526
+ when 2 then
527
+ begin
528
+
529
+ unless @buffers[:ident].is_a?(::AST::Node)
530
+ @buffers[:ident] ||= []
531
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
532
+ end
533
+ end
534
+ when 7 then
535
+ begin
536
+
537
+ @buffers[:string] ||= []
538
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
539
+ end
540
+ when 13 then
541
+ begin
542
+
543
+ unless @buffers[:ident].is_a?(::AST::Node)
544
+ @buffers[:ident] ||= []
545
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
546
+ end
547
+ end
548
+ begin
549
+
550
+ @buffers[:ident] ||= []
551
+ yield @buffers[:ident]
552
+ end
553
+ when 15 then
554
+ begin
555
+
556
+ @buffers[:string] ||= []
557
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
558
+ end
559
+ begin
560
+
561
+ @buffers[:string] ||= []
562
+ yield @buffers[:string]
563
+ end
564
+ end
565
+ end
566
+
567
+ end
568
+ if _goto_level <= _out
569
+ break
570
+ end
571
+ end
572
+ end
573
+
574
+ class << self
575
+ attr_accessor :_bel_trans_keys
576
+ private :_bel_trans_keys, :_bel_trans_keys=
577
+ end
578
+ self._bel_trans_keys = [
579
+ 0, 0, 68, 100, 69, 101,
580
+ 70, 102, 73, 105, 78,
581
+ 110, 69, 101, 9, 32,
582
+ 9, 110, 65, 97, 77, 109,
583
+ 69, 101, 83, 115, 80,
584
+ 112, 65, 97, 67, 99,
585
+ 69, 101, 9, 32, 9, 122,
586
+ 9, 122, 9, 97, 83,
587
+ 115, 9, 32, 9, 117,
588
+ 82, 114, 76, 108, 9, 32,
589
+ 9, 34, 34, 92, 9,
590
+ 32, 9, 32, 92, 92,
591
+ 48, 122, 10, 122, 34, 34,
592
+ 34, 92, 10, 10, 92,
593
+ 92, 0, 0, 0, 0,
594
+ 0, 0, 0
595
+ ]
596
+
597
+ class << self
598
+ attr_accessor :_bel_key_spans
599
+ private :_bel_key_spans, :_bel_key_spans=
600
+ end
601
+ self._bel_key_spans = [
602
+ 0, 33, 33, 33, 33, 33, 33, 24,
603
+ 102, 33, 33, 33, 33, 33, 33, 33,
604
+ 33, 24, 114, 114, 89, 33, 24, 109,
605
+ 33, 33, 24, 26, 59, 24, 24, 1,
606
+ 75, 113, 1, 59, 1, 1, 0, 0,
607
+ 0
608
+ ]
609
+
610
+ class << self
611
+ attr_accessor :_bel_index_offsets
612
+ private :_bel_index_offsets, :_bel_index_offsets=
613
+ end
614
+ self._bel_index_offsets = [
615
+ 0, 0, 34, 68, 102, 136, 170, 204,
616
+ 229, 332, 366, 400, 434, 468, 502, 536,
617
+ 570, 604, 629, 744, 859, 949, 983, 1008,
618
+ 1118, 1152, 1186, 1211, 1238, 1298, 1323, 1348,
619
+ 1350, 1426, 1540, 1542, 1602, 1604, 1606, 1607,
620
+ 1608
621
+ ]
622
+
623
+ class << self
624
+ attr_accessor :_bel_indicies
625
+ private :_bel_indicies, :_bel_indicies=
626
+ end
627
+ self._b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 1, 1, 1, 1, 1, 1,
699
+ 15, 1, 16, 1, 1, 1, 1, 1,
700
+ 1, 1, 1, 1, 1, 1, 1, 1,
701
+ 1, 1, 1, 1, 1, 1, 1, 1,
702
+ 1, 1, 1, 1, 1, 1, 1, 1,
703
+ 1, 1, 16, 1, 17, 1, 1, 1,
704
+ 1, 1, 1, 1, 1, 1, 1, 1,
705
+ 1, 1, 1, 1, 1, 1, 1, 1,
706
+ 1, 1, 1, 17, 1, 17, 18, 18,
707
+ 18, 18, 18, 18, 18, 18, 18, 18,
708
+ 18, 18, 18, 18, 18, 18, 18, 18,
709
+ 18, 18, 18, 18, 17, 18, 18, 18,
710
+ 18, 18, 18, 18, 18, 18, 18, 18,
711
+ 18, 18, 18, 18, 19, 19, 19, 19,
712
+ 19, 19, 19, 19, 19, 19, 18, 18,
713
+ 18, 18, 18, 18, 18, 19, 19, 19,
714
+ 19, 19, 19, 19, 19, 19, 19, 19,
715
+ 19, 19, 19, 19, 19, 19, 19, 19,
716
+ 19, 19, 19, 19, 19, 19, 19, 18,
717
+ 18, 18, 18, 19, 18, 19, 19, 19,
718
+ 19, 19, 19, 19, 19, 19, 19, 19,
719
+ 19, 19, 19, 19, 19, 19, 19, 19,
720
+ 19, 19, 19, 19, 19, 19, 19, 18,
721
+ 20, 18, 18, 18, 18, 18, 18, 18,
722
+ 18, 18, 18, 18, 18, 18, 18, 18,
723
+ 18, 18, 18, 18, 18, 18, 18, 20,
724
+ 18, 18, 18, 18, 18, 18, 18, 18,
725
+ 18, 18, 18, 18, 18, 18, 18, 21,
726
+ 21, 21, 21, 21, 21, 21, 21, 21,
727
+ 21, 18, 18, 18, 18, 18, 18, 18,
728
+ 21, 21, 21, 21, 21, 21, 21, 21,
729
+ 21, 21, 21, 21, 21, 21, 21, 21,
730
+ 21, 21, 21, 21, 21, 21, 21, 21,
731
+ 21, 21, 18, 18, 18, 18, 21, 18,
732
+ 21, 21, 21, 21, 21, 21, 21, 21,
733
+ 21, 21, 21, 21, 21,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
769
+ 1, 1, 1, 1, 1, 1, 1, 1,
770
+ 1, 1, 1, 1, 1, 1, 1, 1,
771
+ 1, 1, 1, 1, 1, 1, 27, 1,
772
+ 28, 1, 1, 1, 1, 1, 1, 1,
773
+ 1, 1, 1, 1, 1, 1, 1, 1,
774
+ 1, 1, 1, 1, 1, 1, 1, 1,
775
+ 1, 1, 1, 1, 1, 1, 1, 1,
776
+ 28, 1, 29, 1, 1, 1, 1, 1,
777
+ 1, 1, 1, 1, 1, 1, 1, 1,
778
+ 1, 1, 1, 1, 1, 1, 1, 1,
779
+ 1, 29, 1, 29, 30, 30, 30, 30,
780
+ 30, 30, 30, 30, 30, 30, 30, 30,
781
+ 30, 30, 30, 30, 30, 30, 30, 30,
782
+ 30, 30, 29, 30, 31, 30, 33, 32,
783
+ 32, 32, 32, 32, 32, 32, 32, 32,
784
+ 32, 32, 32, 32, 32, 32, 32, 32,
785
+ 32, 32, 32, 32, 32, 32, 32, 32,
786
+ 32, 32, 32, 32, 32, 32, 32, 32,
787
+ 32, 32, 32, 32, 32, 32, 32, 32,
788
+ 32, 32, 32, 32, 32, 32, 32, 32,
789
+ 32, 32, 32, 32, 32, 32, 32, 32,
790
+ 34, 32, 35, 36, 30, 30, 30, 30,
791
+ 30, 30, 30, 30, 30, 30, 30, 30,
792
+ 30, 30, 30, 30, 30, 30, 30, 30,
793
+ 30, 35, 30, 37, 38, 1, 1, 1,
794
+ 1, 1, 1, 1, 1, 1, 1, 1,
795
+ 1, 1, 1, 1, 1, 1, 1, 1,
796
+ 1, 1, 37, 1, 34, 32, 40, 40,
797
+ 40, 40, 40, 40, 40, 40, 40, 40,
798
+ 39, 39, 39, 39, 39, 39, 39, 40,
799
+ 40, 40, 40, 40, 40, 40, 40, 40,
800
+ 40, 40, 40, 40, 40, 40, 40, 40,
801
+ 40, 40, 40, 40, 40, 40, 40, 40,
802
+ 40, 39, 39, 39, 39, 40, 39, 40,
803
+ 40, 40, 40, 40, 40, 40, 40, 40,
804
+ 40, 40, 40, 40, 40, 40, 40, 40,
805
+ 40, 40, 40, 40, 40, 40, 40, 40,
806
+ 40, 39, 41, 39, 39, 39, 39, 39,
807
+ 39, 39, 39, 39, 39, 39, 39, 39,
808
+ 39, 39, 39, 39, 39, 39, 39, 39,
809
+ 39, 39, 39, 39, 39, 39, 39, 39,
810
+ 39, 39, 39, 39, 39, 39, 39, 39,
811
+ 42, 42, 42, 42, 42, 42, 42, 42,
812
+ 42, 42, 39, 39, 39, 39, 39, 39,
813
+ 39, 42, 42, 42, 42, 42, 42, 42,
814
+ 42, 42, 42, 42, 42, 42, 42, 42,
815
+ 42, 42, 42, 42, 42, 42, 42, 42,
816
+ 42, 42, 42, 39, 39, 39, 39, 42,
817
+ 39, 42, 42, 42, 42, 42, 42, 42,
818
+ 42, 42, 42, 42, 42, 42, 42, 42,
819
+ 42, 42, 42, 42, 42, 42, 42, 42,
820
+ 42, 42, 42, 39, 44, 43, 46, 45,
821
+ 45, 45, 45, 45, 45, 45, 45, 45,
822
+ 45, 45, 45, 45, 45, 45, 45, 45,
823
+ 45, 45, 45, 45, 45, 45, 45, 45,
824
+ 45, 45, 45, 45, 45, 45, 45, 45,
825
+ 45, 45, 45, 45, 45, 45, 45, 45,
826
+ 45, 45, 45, 45, 45, 45, 45, 45,
827
+ 45, 45, 45, 45, 45, 45, 45, 45,
828
+ 47, 45, 48, 43, 47, 45, 1, 1,
829
+ 1, 0
830
+ ]
831
+
832
+ class << self
833
+ attr_accessor :_bel_trans_targs
834
+ private :_bel_trans_targs, :_bel_trans_targs=
835
+ end
836
+ self._bel_trans_targs = [
837
+ 2, 0, 3, 4, 5, 6, 7, 8,
838
+ 9, 10, 11, 12, 13, 14, 15, 16,
839
+ 17, 18, 0, 19, 20, 19, 20, 21,
840
+ 22, 23, 24, 25, 26, 27, 0, 28,
841
+ 28, 29, 31, 30, 38, 30, 38, 0,
842
+ 33, 39, 33, 0, 35, 35, 36, 37,
843
+ 40
844
+ ]
845
+
846
+ class << self
847
+ attr_accessor :_bel_trans_actions
848
+ private :_bel_trans_actions, :_bel_trans_actions=
849
+ end
850
+ self._bel_trans_actions = [
851
+ 0, 0, 0, 0, 0, 0, 0, 0,
852
+ 0, 0, 0, 0, 0, 0, 0, 0,
853
+ 1, 0, 2, 3, 4, 5, 0, 0,
854
+ 0, 0, 0, 0, 6, 0, 7, 8,
855
+ 9, 9, 9, 10, 11, 0, 12, 13,
856
+ 3, 14, 5, 15, 8, 9, 9, 9,
857
+ 16
858
+ ]
859
+
860
+ class << self
861
+ attr_accessor :_bel_eof_actions
862
+ private :_bel_eof_actions, :_bel_eof_actions=
863
+ end
864
+ self._bel_eof_actions = [
865
+ 0, 0, 0, 0, 0, 0, 0, 0,
866
+ 0, 0, 0, 0, 0, 0, 0, 0,
867
+ 0, 0, 2, 2, 0, 0, 0, 0,
868
+ 0, 0, 0, 7, 7, 7, 0, 7,
869
+ 13, 13, 15, 15, 15, 15, 0, 0,
870
+ 0
871
+ ]
872
+
873
+ class << self
874
+ attr_accessor :bel_start
875
+ end
876
+ self.bel_start = 1;
877
+ class << self
878
+ attr_accessor :bel_first_final
879
+ end
880
+ self.bel_first_final = 38;
881
+ class << self
882
+ attr_accessor :bel_error
883
+ end
884
+ self.bel_error = 0;
885
+
886
+ class << self
887
+ attr_accessor :bel_en_ident
888
+ end
889
+ self.bel_en_ident = 32;
890
+ class << self
891
+ attr_accessor :bel_en_string
892
+ end
893
+ self.bel_en_string = 34;
894
+ class << self
895
+ attr_accessor :bel_en_define_namespace
896
+ end
897
+ self.bel_en_define_namespace = 1;
898
+
899
+
900
+ begin
901
+ p ||= 0
902
+ pe ||= data.length
903
+ cs = bel_start
904
+ end
905
+
906
+ begin
907
+ testEof = false
908
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
909
+ _goto_level = 0
910
+ _resume = 10
911
+ _eof_trans = 15
912
+ _again = 20
913
+ _test_eof = 30
914
+ _out = 40
915
+ while true
916
+ if _goto_level <= 0
917
+ if p == pe
918
+ _goto_level = _test_eof
919
+ next
920
+ end
921
+ if cs == 0
922
+ _goto_level = _out
923
+ next
924
+ end
925
+ end
926
+ if _goto_level <= _resume
927
+ _keys = cs << 1
928
+ _inds = _bel_index_offsets[cs]
929
+ _slen = _bel_key_spans[cs]
930
+ _wide = data[p].ord
931
+ _trans = if ( _slen > 0 &&
932
+ _bel_trans_keys[_keys] <= _wide &&
933
+ _wide <= _bel_trans_keys[_keys + 1]
934
+ ) then
935
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
936
+ else
937
+ _bel_indicies[ _inds + _slen ]
938
+ end
939
+ cs = _bel_trans_targs[_trans]
940
+ if _bel_trans_actions[_trans] != 0
941
+ case _bel_trans_actions[_trans]
942
+ when 5 then
943
+ begin
944
+
945
+ (@buffers[:ident] ||= []) << data[p].ord
946
+ end
947
+ when 2 then
948
+ begin
949
+
950
+ unless @buffers[:ident].is_a?(::AST::Node)
951
+ @buffers[:ident] ||= []
952
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
953
+ end
954
+ end
955
+ when 9 then
956
+ begin
957
+
958
+ (@buffers[:string] ||= []) << data[p].ord
959
+ end
960
+ when 7 then
961
+ begin
962
+
963
+ @buffers[:string] ||= []
964
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
965
+ end
966
+ when 1 then
967
+ begin
968
+
969
+ @buffers[:namespace_definition] = namespace_definition()
970
+ end
971
+ when 6 then
972
+ begin
973
+
974
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << domain(url())
975
+ end
976
+ when 12 then
977
+ begin
978
+
979
+ yield @buffers[:namespace_definition]
980
+ end
981
+ when 3 then
982
+ begin
983
+
984
+ @buffers[:ident] = []
985
+ end
986
+ begin
987
+
988
+ (@buffers[:ident] ||= []) << data[p].ord
989
+ end
990
+ when 14 then
991
+ begin
992
+
993
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
994
+ end
995
+ begin
996
+
997
+ yield @buffers[:ident]
998
+ end
999
+ when 4 then
1000
+ begin
1001
+
1002
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1003
+ end
1004
+ begin
1005
+
1006
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << keyword(@buffers[:ident])
1007
+ end
1008
+ when 13 then
1009
+ begin
1010
+
1011
+ unless @buffers[:ident].is_a?(::AST::Node)
1012
+ @buffers[:ident] ||= []
1013
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1014
+ end
1015
+ end
1016
+ begin
1017
+
1018
+ @buffers[:ident] ||= []
1019
+ yield @buffers[:ident]
1020
+ end
1021
+ when 8 then
1022
+ begin
1023
+
1024
+ @buffers[:string] = []
1025
+ end
1026
+ begin
1027
+
1028
+ (@buffers[:string] ||= []) << data[p].ord
1029
+ end
1030
+ when 16 then
1031
+ begin
1032
+
1033
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1034
+ end
1035
+ begin
1036
+
1037
+ yield @buffers[:string]
1038
+ end
1039
+ when 10 then
1040
+ begin
1041
+
1042
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1043
+ end
1044
+ begin
1045
+
1046
+ keyword, domain = @buffers[:namespace_definition].children
1047
+ domain = domain(
1048
+ domain.children[0] << @buffers[:string])
1049
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
1050
+ end
1051
+ when 15 then
1052
+ begin
1053
+
1054
+ @buffers[:string] ||= []
1055
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1056
+ end
1057
+ begin
1058
+
1059
+ @buffers[:string] ||= []
1060
+ yield @buffers[:string]
1061
+ end
1062
+ when 11 then
1063
+ begin
1064
+
1065
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1066
+ end
1067
+ begin
1068
+
1069
+ keyword, domain = @buffers[:namespace_definition].children
1070
+ domain = domain(
1071
+ domain.children[0] << @buffers[:string])
1072
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
1073
+ end
1074
+ begin
1075
+
1076
+ yield @buffers[:namespace_definition]
1077
+ end
1078
+ end
1079
+ end
1080
+ end
1081
+ if _goto_level <= _again
1082
+ if cs == 0
1083
+ _goto_level = _out
1084
+ next
1085
+ end
1086
+ p += 1
1087
+ if p != pe
1088
+ _goto_level = _resume
1089
+ next
1090
+ end
1091
+ end
1092
+ if _goto_level <= _test_eof
1093
+ if p == eof
1094
+ case _bel_eof_actions[cs]
1095
+ when 2 then
1096
+ begin
1097
+
1098
+ unless @buffers[:ident].is_a?(::AST::Node)
1099
+ @buffers[:ident] ||= []
1100
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1101
+ end
1102
+ end
1103
+ when 7 then
1104
+ begin
1105
+
1106
+ @buffers[:string] ||= []
1107
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1108
+ end
1109
+ when 13 then
1110
+ begin
1111
+
1112
+ unless @buffers[:ident].is_a?(::AST::Node)
1113
+ @buffers[:ident] ||= []
1114
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1115
+ end
1116
+ end
1117
+ begin
1118
+
1119
+ @buffers[:ident] ||= []
1120
+ yield @buffers[:ident]
1121
+ end
1122
+ when 15 then
1123
+ begin
1124
+
1125
+ @buffers[:string] ||= []
1126
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1127
+ end
1128
+ begin
1129
+
1130
+ @buffers[:string] ||= []
1131
+ yield @buffers[:string]
1132
+ end
1133
+ end
1134
+ end
1135
+
1136
+ end
1137
+ if _goto_level <= _out
1138
+ break
1139
+ end
1140
+ end
1141
+ end
1142
+
1143
+
1144
+ =end
1145
+ # end: ragel
1146
+
1147
+ require_relative '../ast/node'
1148
+ require_relative '../mixin/buffer'
1149
+ require_relative '../nonblocking_io_wrapper'
1150
+
1151
+ module BELParser
1152
+ module Parsers
1153
+ module BELScript
1154
+ module DefineNamespace
1155
+
1156
+ class << self
1157
+
1158
+ MAX_LENGTH = 1024 * 128 # 128K
1159
+
1160
+ def parse(content)
1161
+ return nil unless content
1162
+
1163
+ Parser.new(content).each do |obj|
1164
+ yield obj
1165
+ end
1166
+ end
1167
+ end
1168
+
1169
+ private
1170
+
1171
+ class Parser
1172
+ include Enumerable
1173
+ include BELParser::Parsers::Buffer
1174
+ include BELParser::Parsers::AST::Sexp
1175
+
1176
+ def initialize(content)
1177
+ @content = content
1178
+ # begin: ragel
1179
+
1180
+ class << self
1181
+ attr_accessor :_bel_trans_keys
1182
+ private :_bel_trans_keys, :_bel_trans_keys=
1183
+ end
1184
+ self._bel_trans_keys = [
1185
+ 0, 0, 68, 100, 69, 101,
1186
+ 70, 102, 73, 105, 78,
1187
+ 110, 69, 101, 9, 32,
1188
+ 9, 110, 65, 97, 77, 109,
1189
+ 69, 101, 83, 115, 80,
1190
+ 112, 65, 97, 67, 99,
1191
+ 69, 101, 9, 32, 9, 122,
1192
+ 9, 122, 9, 97, 83,
1193
+ 115, 9, 32, 9, 117,
1194
+ 82, 114, 76, 108, 9, 32,
1195
+ 9, 34, 34, 92, 9,
1196
+ 32, 9, 32, 92, 92,
1197
+ 48, 122, 10, 122, 34, 34,
1198
+ 34, 92, 10, 10, 92,
1199
+ 92, 0, 0, 0, 0,
1200
+ 0, 0, 0
1201
+ ]
1202
+
1203
+ class << self
1204
+ attr_accessor :_bel_key_spans
1205
+ private :_bel_key_spans, :_bel_key_spans=
1206
+ end
1207
+ self._bel_key_spans = [
1208
+ 0, 33, 33, 33, 33, 33, 33, 24,
1209
+ 102, 33, 33, 33, 33, 33, 33, 33,
1210
+ 33, 24, 114, 114, 89, 33, 24, 109,
1211
+ 33, 33, 24, 26, 59, 24, 24, 1,
1212
+ 75, 113, 1, 59, 1, 1, 0, 0,
1213
+ 0
1214
+ ]
1215
+
1216
+ class << self
1217
+ attr_accessor :_bel_index_offsets
1218
+ private :_bel_index_offsets, :_bel_index_offsets=
1219
+ end
1220
+ self._bel_index_offsets = [
1221
+ 0, 0, 34, 68, 102, 136, 170, 204,
1222
+ 229, 332, 366, 400, 434, 468, 502, 536,
1223
+ 570, 604, 629, 744, 859, 949, 983, 1008,
1224
+ 1118, 1152, 1186, 1211, 1238, 1298, 1323, 1348,
1225
+ 1350, 1426, 1540, 1542, 1602, 1604, 1606, 1607,
1226
+ 1608
1227
+ ]
1228
+
1229
+ class << self
1230
+ attr_accessor :_bel_indicies
1231
+ private :_bel_indicies, :_bel_indicies=
1232
+ end
1233
+ self._bel_indicies = [
1234
+ 0, 1, 1, 1, 1, 1, 1, 1,
1235
+ 1, 1, 1, 1, 1, 1, 1, 1,
1236
+ 1, 1, 1, 1, 1, 1, 1, 1,
1237
+ 1, 1, 1, 1, 1, 1, 1, 1,
1238
+ 0, 1, 2, 1, 1, 1, 1, 1,
1239
+ 1, 1, 1, 1, 1, 1, 1, 1,
1240
+ 1, 1, 1, 1, 1, 1, 1, 1,
1241
+ 1, 1, 1, 1, 1, 1, 1, 1,
1242
+ 1, 1, 2, 1, 3, 1, 1, 1,
1243
+ 1, 1, 1, 1, 1, 1, 1, 1,
1244
+ 1, 1, 1, 1, 1, 1, 1, 1,
1245
+ 1, 1, 1, 1, 1, 1, 1, 1,
1246
+ 1, 1, 1, 1, 3, 1, 4, 1,
1247
+ 1, 1, 1, 1, 1, 1, 1, 1,
1248
+ 1, 1, 1, 1, 1, 1, 1, 1,
1249
+ 1, 1, 1, 1, 1, 1, 1, 1,
1250
+ 1, 1, 1, 1, 1, 1, 4, 1,
1251
+ 5, 1, 1, 1, 1, 1, 1, 1,
1252
+ 1, 1, 1, 1, 1, 1, 1, 1,
1253
+ 1, 1, 1, 1, 1, 1, 1, 1,
1254
+ 1, 1, 1, 1, 1, 1, 1, 1,
1255
+ 5, 1, 6, 1, 1, 1, 1, 1,
1256
+ 1, 1, 1, 1, 1, 1, 1, 1,
1257
+ 1, 1, 1, 1, 1, 1, 1, 1,
1258
+ 1, 1, 1, 1, 1, 1, 1, 1,
1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 1, 1, 1, 1, 1, 1, 1, 1,
1294
+ 1, 1, 1, 1, 1, 1, 1, 1,
1295
+ 1, 1, 1, 1, 1, 1, 1, 1,
1296
+ 1, 1, 1, 1, 13, 1, 14, 1,
1297
+ 1, 1, 1, 1, 1, 1, 1, 1,
1298
+ 1, 1, 1, 1, 1, 1, 1, 1,
1299
+ 1, 1, 1, 1, 1, 1, 1, 1,
1300
+ 1, 1, 1, 1, 1, 1, 14, 1,
1301
+ 15, 1, 1, 1, 1, 1, 1, 1,
1302
+ 1, 1, 1, 1, 1, 1, 1, 1,
1303
+ 1, 1, 1, 1, 1, 1, 1, 1,
1304
+ 1, 1, 1, 1, 1, 1, 1, 1,
1305
+ 15, 1, 16, 1, 1, 1, 1, 1,
1306
+ 1, 1, 1, 1, 1, 1, 1, 1,
1307
+ 1, 1, 1, 1, 1, 1, 1, 1,
1308
+ 1, 1, 1, 1, 1, 1, 1, 1,
1309
+ 1, 1, 16, 1, 17, 1, 1, 1,
1310
+ 1, 1, 1, 1, 1, 1, 1, 1,
1311
+ 1, 1, 1, 1, 1, 1, 1, 1,
1312
+ 1, 1, 1, 17, 1, 17, 18, 18,
1313
+ 18, 18, 18, 18, 18, 18, 18, 18,
1314
+ 18, 18, 18, 18, 18, 18, 18, 18,
1315
+ 18, 18, 18, 18, 17, 18, 18, 18,
1316
+ 18, 18, 18, 18, 18, 18, 18, 18,
1317
+ 18, 18, 18, 18, 19, 19, 19, 19,
1318
+ 19, 19, 19, 19, 19, 19, 18, 18,
1319
+ 18, 18, 18, 18, 18, 19, 19, 19,
1320
+ 19, 19, 19, 19, 19, 19, 19, 19,
1321
+ 19, 19, 19, 19, 19, 19, 19, 19,
1322
+ 19, 19, 19, 19, 19, 19, 19, 18,
1323
+ 18, 18, 18, 19, 18, 19, 19, 19,
1324
+ 19, 19, 19, 19, 19, 19, 19, 19,
1325
+ 19, 19, 19, 19, 19, 19, 19, 19,
1326
+ 19, 19, 19, 19, 19, 19, 19, 18,
1327
+ 20, 18, 18, 18, 18, 18, 18, 18,
1328
+ 18, 18, 18, 18, 18, 18, 18, 18,
1329
+ 18, 18, 18, 18, 18, 18, 18, 20,
1330
+ 18, 18, 18, 18, 18, 18, 18, 18,
1331
+ 18, 18, 18, 18, 18, 18, 18, 21,
1332
+ 21, 21, 21, 21, 21, 21, 21, 21,
1333
+ 21, 18, 18, 18, 18, 18, 18, 18,
1334
+ 21, 21, 21, 21, 21, 21, 21, 21,
1335
+ 21, 21, 21, 21, 21, 21, 21, 21,
1336
+ 21, 21, 21, 21, 21, 21, 21, 21,
1337
+ 21, 21, 18, 18, 18, 18, 21, 18,
1338
+ 21, 21, 21, 21, 21, 21, 21, 21,
1339
+ 21, 21, 21, 21, 21, 21, 21, 21,
1340
+ 21, 21, 21, 21, 21, 21, 21, 21,
1341
+ 21, 21, 18, 22, 1, 1, 1, 1,
1342
+ 1, 1, 1, 1, 1, 1, 1, 1,
1343
+ 1, 1, 1, 1, 1, 1, 1, 1,
1344
+ 1, 1, 22, 1, 1, 1, 1, 1,
1345
+ 1, 1, 1, 1, 1, 1, 1, 1,
1346
+ 1, 1, 1, 1, 1, 1, 1, 1,
1347
+ 1, 1, 1, 1, 1, 1, 1, 1,
1348
+ 1, 1, 1, 23, 1, 1, 1, 1,
1349
+ 1, 1, 1, 1, 1, 1, 1, 1,
1350
+ 1, 1, 1, 1, 1, 1, 1, 1,
1351
+ 1, 1, 1, 1, 1, 1, 1, 1,
1352
+ 1, 1, 1, 23, 1, 24, 1, 1,
1353
+ 1, 1, 1, 1, 1, 1, 1, 1,
1354
+ 1, 1, 1, 1, 1, 1, 1, 1,
1355
+ 1, 1, 1, 1, 1, 1, 1, 1,
1356
+ 1, 1, 1, 1, 1, 24, 1, 25,
1357
+ 1, 1, 1, 1, 1, 1, 1, 1,
1358
+ 1, 1, 1, 1, 1, 1, 1, 1,
1359
+ 1, 1, 1, 1, 1, 1, 25, 1,
1360
+ 25, 1, 1, 1, 1, 1, 1, 1,
1361
+ 1, 1, 1, 1, 1, 1, 1, 1,
1362
+ 1, 1, 1, 1, 1, 1, 1, 25,
1363
+ 1, 1, 1, 1, 1, 1, 1, 1,
1364
+ 1, 1, 1, 1, 1, 1, 1, 1,
1365
+ 1, 1, 1, 1, 1, 1, 1, 1,
1366
+ 1, 1, 1, 1, 1, 1, 1, 1,
1367
+ 1, 1, 1, 1, 1, 1, 1, 1,
1368
+ 1, 1, 1, 1, 1, 1, 1, 1,
1369
+ 1, 1, 1, 1, 26, 1, 1, 1,
1370
+ 1, 1, 1, 1, 1, 1, 1, 1,
1371
+ 1, 1, 1, 1, 1, 1, 1, 1,
1372
+ 1, 1, 1, 1, 1, 1, 1, 1,
1373
+ 1, 1, 1, 1, 26, 1, 27, 1,
1374
+ 1, 1, 1, 1, 1, 1, 1, 1,
1375
+ 1, 1, 1, 1, 1, 1, 1, 1,
1376
+ 1, 1, 1, 1, 1, 1, 1, 1,
1377
+ 1, 1, 1, 1, 1, 1, 27, 1,
1378
+ 28, 1, 1, 1, 1, 1, 1, 1,
1379
+ 1, 1, 1, 1, 1, 1, 1, 1,
1380
+ 1, 1, 1, 1, 1, 1, 1, 1,
1381
+ 1, 1, 1, 1, 1, 1, 1, 1,
1382
+ 28, 1, 29, 1, 1, 1, 1, 1,
1383
+ 1, 1, 1, 1, 1, 1, 1, 1,
1384
+ 1, 1, 1, 1, 1, 1, 1, 1,
1385
+ 1, 29, 1, 29, 30, 30, 30, 30,
1386
+ 30, 30, 30, 30, 30, 30, 30, 30,
1387
+ 30, 30, 30, 30, 30, 30, 30, 30,
1388
+ 30, 30, 29, 30, 31, 30, 33, 32,
1389
+ 32, 32, 32, 32, 32, 32, 32, 32,
1390
+ 32, 32, 32, 32, 32, 32, 32, 32,
1391
+ 32, 32, 32, 32, 32, 32, 32, 32,
1392
+ 32, 32, 32, 32, 32, 32, 32, 32,
1393
+ 32, 32, 32, 32, 32, 32, 32, 32,
1394
+ 32, 32, 32, 32, 32, 32, 32, 32,
1395
+ 32, 32, 32, 32, 32, 32, 32, 32,
1396
+ 34, 32, 35, 36, 30, 30, 30, 30,
1397
+ 30, 30, 30, 30, 30, 30, 30, 30,
1398
+ 30, 30, 30, 30, 30, 30, 30, 30,
1399
+ 30, 35, 30, 37, 38, 1, 1, 1,
1400
+ 1, 1, 1, 1, 1, 1, 1, 1,
1401
+ 1, 1, 1, 1, 1, 1, 1, 1,
1402
+ 1, 1, 37, 1, 34, 32, 40, 40,
1403
+ 40, 40, 40, 40, 40, 40, 40, 40,
1404
+ 39, 39, 39, 39, 39, 39, 39, 40,
1405
+ 40, 40, 40, 40, 40, 40, 40, 40,
1406
+ 40, 40, 40, 40, 40, 40, 40, 40,
1407
+ 40, 40, 40, 40, 40, 40, 40, 40,
1408
+ 40, 39, 39, 39, 39, 40, 39, 40,
1409
+ 40, 40, 40, 40, 40, 40, 40, 40,
1410
+ 40, 40, 40, 40, 40, 40, 40, 40,
1411
+ 40, 40, 40, 40, 40, 40, 40, 40,
1412
+ 40, 39, 41, 39, 39, 39, 39, 39,
1413
+ 39, 39, 39, 39, 39, 39, 39, 39,
1414
+ 39, 39, 39, 39, 39, 39, 39, 39,
1415
+ 39, 39, 39, 39, 39, 39, 39, 39,
1416
+ 39, 39, 39, 39, 39, 39, 39, 39,
1417
+ 42, 42, 42, 42, 42, 42, 42, 42,
1418
+ 42, 42, 39, 39, 39, 39, 39, 39,
1419
+ 39, 42, 42, 42, 42, 42, 42, 42,
1420
+ 42, 42, 42, 42, 42, 42, 42, 42,
1421
+ 42, 42, 42, 42, 42, 42, 42, 42,
1422
+ 42, 42, 42, 39, 39, 39, 39, 42,
1423
+ 39, 42, 42, 42, 42, 42, 42, 42,
1424
+ 42, 42, 42, 42, 42, 42, 42, 42,
1425
+ 42, 42, 42, 42, 42, 42, 42, 42,
1426
+ 42, 42, 42, 39, 44, 43, 46, 45,
1427
+ 45, 45, 45, 45, 45, 45, 45, 45,
1428
+ 45, 45, 45, 45, 45, 45, 45, 45,
1429
+ 45, 45, 45, 45, 45, 45, 45, 45,
1430
+ 45, 45, 45, 45, 45, 45, 45, 45,
1431
+ 45, 45, 45, 45, 45, 45, 45, 45,
1432
+ 45, 45, 45, 45, 45, 45, 45, 45,
1433
+ 45, 45, 45, 45, 45, 45, 45, 45,
1434
+ 47, 45, 48, 43, 47, 45, 1, 1,
1435
+ 1, 0
1436
+ ]
1437
+
1438
+ class << self
1439
+ attr_accessor :_bel_trans_targs
1440
+ private :_bel_trans_targs, :_bel_trans_targs=
1441
+ end
1442
+ self._bel_trans_targs = [
1443
+ 2, 0, 3, 4, 5, 6, 7, 8,
1444
+ 9, 10, 11, 12, 13, 14, 15, 16,
1445
+ 17, 18, 0, 19, 20, 19, 20, 21,
1446
+ 22, 23, 24, 25, 26, 27, 0, 28,
1447
+ 28, 29, 31, 30, 38, 30, 38, 0,
1448
+ 33, 39, 33, 0, 35, 35, 36, 37,
1449
+ 40
1450
+ ]
1451
+
1452
+ class << self
1453
+ attr_accessor :_bel_trans_actions
1454
+ private :_bel_trans_actions, :_bel_trans_actions=
1455
+ end
1456
+ self._bel_trans_actions = [
1457
+ 0, 0, 0, 0, 0, 0, 0, 0,
1458
+ 0, 0, 0, 0, 0, 0, 0, 0,
1459
+ 1, 0, 2, 3, 4, 5, 0, 0,
1460
+ 0, 0, 0, 0, 6, 0, 7, 8,
1461
+ 9, 9, 9, 10, 11, 0, 12, 13,
1462
+ 3, 14, 5, 15, 8, 9, 9, 9,
1463
+ 16
1464
+ ]
1465
+
1466
+ class << self
1467
+ attr_accessor :_bel_eof_actions
1468
+ private :_bel_eof_actions, :_bel_eof_actions=
1469
+ end
1470
+ self._bel_eof_actions = [
1471
+ 0, 0, 0, 0, 0, 0, 0, 0,
1472
+ 0, 0, 0, 0, 0, 0, 0, 0,
1473
+ 0, 0, 2, 2, 0, 0, 0, 0,
1474
+ 0, 0, 0, 7, 7, 7, 0, 7,
1475
+ 13, 13, 15, 15, 15, 15, 0, 0,
1476
+ 0
1477
+ ]
1478
+
1479
+ class << self
1480
+ attr_accessor :bel_start
1481
+ end
1482
+ self.bel_start = 1;
1483
+ class << self
1484
+ attr_accessor :bel_first_final
1485
+ end
1486
+ self.bel_first_final = 38;
1487
+ class << self
1488
+ attr_accessor :bel_error
1489
+ end
1490
+ self.bel_error = 0;
1491
+
1492
+ class << self
1493
+ attr_accessor :bel_en_ident
1494
+ end
1495
+ self.bel_en_ident = 32;
1496
+ class << self
1497
+ attr_accessor :bel_en_string
1498
+ end
1499
+ self.bel_en_string = 34;
1500
+ class << self
1501
+ attr_accessor :bel_en_define_namespace
1502
+ end
1503
+ self.bel_en_define_namespace = 1;
1504
+
1505
+
1506
+ # end: ragel
1507
+ end
1508
+
1509
+ def each
1510
+ @buffers = {}
1511
+ stack = []
1512
+ data = @content.unpack('C*')
1513
+ p = 0
1514
+ pe = data.length
1515
+ eof = data.length
1516
+
1517
+ # begin: ragel
1518
+
1519
+ begin
1520
+ p ||= 0
1521
+ pe ||= data.length
1522
+ cs = bel_start
1523
+ end
1524
+
1525
+
1526
+ begin
1527
+ testEof = false
1528
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
1529
+ _goto_level = 0
1530
+ _resume = 10
1531
+ _eof_trans = 15
1532
+ _again = 20
1533
+ _test_eof = 30
1534
+ _out = 40
1535
+ while true
1536
+ if _goto_level <= 0
1537
+ if p == pe
1538
+ _goto_level = _test_eof
1539
+ next
1540
+ end
1541
+ if cs == 0
1542
+ _goto_level = _out
1543
+ next
1544
+ end
1545
+ end
1546
+ if _goto_level <= _resume
1547
+ _keys = cs << 1
1548
+ _inds = _bel_index_offsets[cs]
1549
+ _slen = _bel_key_spans[cs]
1550
+ _wide = data[p].ord
1551
+ _trans = if ( _slen > 0 &&
1552
+ _bel_trans_keys[_keys] <= _wide &&
1553
+ _wide <= _bel_trans_keys[_keys + 1]
1554
+ ) then
1555
+ _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ]
1556
+ else
1557
+ _bel_indicies[ _inds + _slen ]
1558
+ end
1559
+ cs = _bel_trans_targs[_trans]
1560
+ if _bel_trans_actions[_trans] != 0
1561
+ case _bel_trans_actions[_trans]
1562
+ when 5 then
1563
+ begin
1564
+
1565
+ (@buffers[:ident] ||= []) << data[p].ord
1566
+ end
1567
+ when 2 then
1568
+ begin
1569
+
1570
+ unless @buffers[:ident].is_a?(::AST::Node)
1571
+ @buffers[:ident] ||= []
1572
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1573
+ end
1574
+ end
1575
+ when 9 then
1576
+ begin
1577
+
1578
+ (@buffers[:string] ||= []) << data[p].ord
1579
+ end
1580
+ when 7 then
1581
+ begin
1582
+
1583
+ @buffers[:string] ||= []
1584
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1585
+ end
1586
+ when 1 then
1587
+ begin
1588
+
1589
+ @buffers[:namespace_definition] = namespace_definition()
1590
+ end
1591
+ when 6 then
1592
+ begin
1593
+
1594
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << domain(url())
1595
+ end
1596
+ when 12 then
1597
+ begin
1598
+
1599
+ yield @buffers[:namespace_definition]
1600
+ end
1601
+ when 3 then
1602
+ begin
1603
+
1604
+ @buffers[:ident] = []
1605
+ end
1606
+ begin
1607
+
1608
+ (@buffers[:ident] ||= []) << data[p].ord
1609
+ end
1610
+ when 14 then
1611
+ begin
1612
+
1613
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1614
+ end
1615
+ begin
1616
+
1617
+ yield @buffers[:ident]
1618
+ end
1619
+ when 4 then
1620
+ begin
1621
+
1622
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1623
+ end
1624
+ begin
1625
+
1626
+ @buffers[:namespace_definition] = @buffers[:namespace_definition] << keyword(@buffers[:ident])
1627
+ end
1628
+ when 13 then
1629
+ begin
1630
+
1631
+ unless @buffers[:ident].is_a?(::AST::Node)
1632
+ @buffers[:ident] ||= []
1633
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1634
+ end
1635
+ end
1636
+ begin
1637
+
1638
+ @buffers[:ident] ||= []
1639
+ yield @buffers[:ident]
1640
+ end
1641
+ when 8 then
1642
+ begin
1643
+
1644
+ @buffers[:string] = []
1645
+ end
1646
+ begin
1647
+
1648
+ (@buffers[:string] ||= []) << data[p].ord
1649
+ end
1650
+ when 16 then
1651
+ begin
1652
+
1653
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1654
+ end
1655
+ begin
1656
+
1657
+ yield @buffers[:string]
1658
+ end
1659
+ when 10 then
1660
+ begin
1661
+
1662
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1663
+ end
1664
+ begin
1665
+
1666
+ keyword, domain = @buffers[:namespace_definition].children
1667
+ domain = domain(
1668
+ domain.children[0] << @buffers[:string])
1669
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
1670
+ end
1671
+ when 15 then
1672
+ begin
1673
+
1674
+ @buffers[:string] ||= []
1675
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1676
+ end
1677
+ begin
1678
+
1679
+ @buffers[:string] ||= []
1680
+ yield @buffers[:string]
1681
+ end
1682
+ when 11 then
1683
+ begin
1684
+
1685
+ @buffers[:string] = string(utf8_string(@buffers[:string]))
1686
+ end
1687
+ begin
1688
+
1689
+ keyword, domain = @buffers[:namespace_definition].children
1690
+ domain = domain(
1691
+ domain.children[0] << @buffers[:string])
1692
+ @buffers[:namespace_definition] = namespace_definition(keyword, domain)
1693
+ end
1694
+ begin
1695
+
1696
+ yield @buffers[:namespace_definition]
1697
+ end
1698
+ end
1699
+ end
1700
+ end
1701
+ if _goto_level <= _again
1702
+ if cs == 0
1703
+ _goto_level = _out
1704
+ next
1705
+ end
1706
+ p += 1
1707
+ if p != pe
1708
+ _goto_level = _resume
1709
+ next
1710
+ end
1711
+ end
1712
+ if _goto_level <= _test_eof
1713
+ if p == eof
1714
+ case _bel_eof_actions[cs]
1715
+ when 2 then
1716
+ begin
1717
+
1718
+ unless @buffers[:ident].is_a?(::AST::Node)
1719
+ @buffers[:ident] ||= []
1720
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1721
+ end
1722
+ end
1723
+ when 7 then
1724
+ begin
1725
+
1726
+ @buffers[:string] ||= []
1727
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1728
+ end
1729
+ when 13 then
1730
+ begin
1731
+
1732
+ unless @buffers[:ident].is_a?(::AST::Node)
1733
+ @buffers[:ident] ||= []
1734
+ @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1735
+ end
1736
+ end
1737
+ begin
1738
+
1739
+ @buffers[:ident] ||= []
1740
+ yield @buffers[:ident]
1741
+ end
1742
+ when 15 then
1743
+ begin
1744
+
1745
+ @buffers[:string] ||= []
1746
+ @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1747
+ end
1748
+ begin
1749
+
1750
+ @buffers[:string] ||= []
1751
+ yield @buffers[:string]
1752
+ end
1753
+ end
1754
+ end
1755
+
1756
+ end
1757
+ if _goto_level <= _out
1758
+ break
1759
+ end
1760
+ end
1761
+ end
1762
+
1763
+ # end: ragel
1764
+ end
1765
+ end
1766
+ end
1767
+ end
1768
+ end
1769
+ end
1770
+
1771
+ if __FILE__ == $0
1772
+ $stdin.each_line do |line|
1773
+ BELParser::Parsers::BELScript::DefineNamespace.parse(line) { |obj|
1774
+ puts obj.inspect
1775
+ }
1776
+ end
1777
+ end
1778
+
1779
+ # vim: ft=ruby ts=2 sw=2:
1780
+ # encoding: utf-8