bel_parser 1.0.0.alpha.1

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