ramaze.ch.oddb.org 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. data/History.txt +6 -0
  2. data/LICENSE +339 -0
  3. data/Manifest.txt +285 -0
  4. data/README.txt +45 -0
  5. data/Rakefile +28 -0
  6. data/bin/admin +69 -0
  7. data/bin/exportd +63 -0
  8. data/bin/migrate +461 -0
  9. data/bin/oddbd +62 -0
  10. data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
  11. data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
  12. data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
  13. data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
  14. data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
  15. data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
  16. data/data/fulltext/data/german_compound/README +15 -0
  17. data/data/fulltext/data/german_compound/compound.pl +63 -0
  18. data/data/fulltext/data/german_compound/german.stop +20 -0
  19. data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
  20. data/data/fulltext/redist/dict_french/Makefile +12 -0
  21. data/data/fulltext/redist/dict_french/README.french +1 -0
  22. data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
  23. data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
  24. data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
  25. data/data/fulltext/redist/dict_french/french_stem.h +16 -0
  26. data/data/fulltext/redist/dict_french/subinclude.h +2 -0
  27. data/data/fulltext/redist/dict_german/Makefile +12 -0
  28. data/data/fulltext/redist/dict_german/README.german +1 -0
  29. data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
  30. data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
  31. data/data/fulltext/redist/dict_german/german_stem.c +527 -0
  32. data/data/fulltext/redist/dict_german/german_stem.h +16 -0
  33. data/data/fulltext/redist/dict_german/subinclude.h +1 -0
  34. data/data/fulltext/redist/french_stem.c +1222 -0
  35. data/data/fulltext/redist/french_stem.h +16 -0
  36. data/data/fulltext/redist/german_stem.c +527 -0
  37. data/data/fulltext/redist/german_stem.h +16 -0
  38. data/lib/fixes/ruby19.rb +21 -0
  39. data/lib/fixes/selenium.rb +20 -0
  40. data/lib/fixes/singular.rb +8 -0
  41. data/lib/fixes/yaml.rb +13 -0
  42. data/lib/oddb.rb +11 -0
  43. data/lib/oddb/business/company.rb +18 -0
  44. data/lib/oddb/business/invoice.rb +75 -0
  45. data/lib/oddb/business/price.rb +60 -0
  46. data/lib/oddb/config.rb +73 -0
  47. data/lib/oddb/drugs.rb +16 -0
  48. data/lib/oddb/drugs/active_agent.rb +37 -0
  49. data/lib/oddb/drugs/atc.rb +53 -0
  50. data/lib/oddb/drugs/composition.rb +41 -0
  51. data/lib/oddb/drugs/ddd.rb +24 -0
  52. data/lib/oddb/drugs/dose.rb +107 -0
  53. data/lib/oddb/drugs/galenic_form.rb +21 -0
  54. data/lib/oddb/drugs/galenic_group.rb +17 -0
  55. data/lib/oddb/drugs/package.rb +87 -0
  56. data/lib/oddb/drugs/part.rb +56 -0
  57. data/lib/oddb/drugs/product.rb +25 -0
  58. data/lib/oddb/drugs/sequence.rb +61 -0
  59. data/lib/oddb/drugs/substance.rb +31 -0
  60. data/lib/oddb/drugs/substance_group.rb +13 -0
  61. data/lib/oddb/drugs/unit.rb +12 -0
  62. data/lib/oddb/export.rb +4 -0
  63. data/lib/oddb/export/csv.rb +89 -0
  64. data/lib/oddb/export/l10n_sessions.rb +30 -0
  65. data/lib/oddb/export/rss.rb +44 -0
  66. data/lib/oddb/export/server.rb +58 -0
  67. data/lib/oddb/export/xls.rb +119 -0
  68. data/lib/oddb/export/yaml.rb +123 -0
  69. data/lib/oddb/html/state/drugs/admin/package.rb +189 -0
  70. data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
  71. data/lib/oddb/html/state/drugs/admin/sequence.rb +259 -0
  72. data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
  73. data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
  74. data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
  75. data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
  76. data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
  77. data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
  78. data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
  79. data/lib/oddb/html/state/drugs/compare.rb +52 -0
  80. data/lib/oddb/html/state/drugs/download_export.rb +18 -0
  81. data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
  82. data/lib/oddb/html/state/drugs/feedback.rb +94 -0
  83. data/lib/oddb/html/state/drugs/global.rb +266 -0
  84. data/lib/oddb/html/state/drugs/init.rb +18 -0
  85. data/lib/oddb/html/state/drugs/login.rb +17 -0
  86. data/lib/oddb/html/state/drugs/package.rb +32 -0
  87. data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
  88. data/lib/oddb/html/state/drugs/products.rb +51 -0
  89. data/lib/oddb/html/state/drugs/result.rb +125 -0
  90. data/lib/oddb/html/state/global.rb +165 -0
  91. data/lib/oddb/html/state/global_predefine.rb +17 -0
  92. data/lib/oddb/html/state/limit.rb +17 -0
  93. data/lib/oddb/html/state/login.rb +56 -0
  94. data/lib/oddb/html/state/paypal/checkout.rb +130 -0
  95. data/lib/oddb/html/state/paypal/collect.rb +46 -0
  96. data/lib/oddb/html/state/paypal/redirect.rb +18 -0
  97. data/lib/oddb/html/state/register_export.rb +38 -0
  98. data/lib/oddb/html/state/register_poweruser.rb +17 -0
  99. data/lib/oddb/html/state/viral/admin.rb +76 -0
  100. data/lib/oddb/html/state/viral/poweruser.rb +16 -0
  101. data/lib/oddb/html/util/annotated_list.rb +39 -0
  102. data/lib/oddb/html/util/know_it_all.rb +28 -0
  103. data/lib/oddb/html/util/known_user.rb +55 -0
  104. data/lib/oddb/html/util/lookandfeel.rb +554 -0
  105. data/lib/oddb/html/util/need_all_input.rb +29 -0
  106. data/lib/oddb/html/util/session.rb +88 -0
  107. data/lib/oddb/html/util/sort.rb +72 -0
  108. data/lib/oddb/html/util/unsaved_helper.rb +20 -0
  109. data/lib/oddb/html/util/validator.rb +54 -0
  110. data/lib/oddb/html/view/ajax/json.rb +22 -0
  111. data/lib/oddb/html/view/alpha_header.rb +28 -0
  112. data/lib/oddb/html/view/document.rb +126 -0
  113. data/lib/oddb/html/view/drugs/admin/package.rb +237 -0
  114. data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
  115. data/lib/oddb/html/view/drugs/admin/sequence.rb +312 -0
  116. data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
  117. data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
  118. data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
  119. data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
  120. data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
  121. data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
  122. data/lib/oddb/html/view/drugs/compare.rb +95 -0
  123. data/lib/oddb/html/view/drugs/download_export.rb +28 -0
  124. data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
  125. data/lib/oddb/html/view/drugs/feedback.rb +231 -0
  126. data/lib/oddb/html/view/drugs/init.rb +51 -0
  127. data/lib/oddb/html/view/drugs/legend.rb +24 -0
  128. data/lib/oddb/html/view/drugs/package.rb +398 -0
  129. data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
  130. data/lib/oddb/html/view/drugs/products.rb +97 -0
  131. data/lib/oddb/html/view/drugs/result.rb +296 -0
  132. data/lib/oddb/html/view/drugs/search.rb +33 -0
  133. data/lib/oddb/html/view/drugs/template.rb +15 -0
  134. data/lib/oddb/html/view/foot.rb +52 -0
  135. data/lib/oddb/html/view/google.rb +23 -0
  136. data/lib/oddb/html/view/google_ads.rb +40 -0
  137. data/lib/oddb/html/view/head.rb +78 -0
  138. data/lib/oddb/html/view/limit.rb +109 -0
  139. data/lib/oddb/html/view/list.rb +59 -0
  140. data/lib/oddb/html/view/login.rb +38 -0
  141. data/lib/oddb/html/view/navigation.rb +67 -0
  142. data/lib/oddb/html/view/offset_header.rb +35 -0
  143. data/lib/oddb/html/view/paypal/collect.rb +84 -0
  144. data/lib/oddb/html/view/paypal/redirect.rb +51 -0
  145. data/lib/oddb/html/view/paypal/register_form.rb +106 -0
  146. data/lib/oddb/html/view/register_export.rb +29 -0
  147. data/lib/oddb/html/view/register_poweruser.rb +29 -0
  148. data/lib/oddb/html/view/rss/feedback.rb +64 -0
  149. data/lib/oddb/html/view/rss_preview.rb +54 -0
  150. data/lib/oddb/html/view/search.rb +104 -0
  151. data/lib/oddb/html/view/snapback.rb +24 -0
  152. data/lib/oddb/html/view/template.rb +56 -0
  153. data/lib/oddb/import/excel.rb +45 -0
  154. data/lib/oddb/import/import.rb +39 -0
  155. data/lib/oddb/import/rtf.rb +410 -0
  156. data/lib/oddb/import/whocc.rb +173 -0
  157. data/lib/oddb/import/xml.rb +15 -0
  158. data/lib/oddb/model.rb +179 -0
  159. data/lib/oddb/persistence/odba.rb +33 -0
  160. data/lib/oddb/persistence/odba/business/company.rb +13 -0
  161. data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
  162. data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
  163. data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
  164. data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
  165. data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
  166. data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
  167. data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
  168. data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
  169. data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
  170. data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
  171. data/lib/oddb/persistence/odba/export.rb +26 -0
  172. data/lib/oddb/persistence/odba/model.rb +68 -0
  173. data/lib/oddb/persistence/odba/regulatory/authority.rb +13 -0
  174. data/lib/oddb/persistence/odba/regulatory/registration.rb +13 -0
  175. data/lib/oddb/persistence/odba/text/document.rb +11 -0
  176. data/lib/oddb/persistence/odba/util/code.rb +11 -0
  177. data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
  178. data/lib/oddb/persistence/og.rb +16 -0
  179. data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
  180. data/lib/oddb/persistence/og/drugs/product.rb +14 -0
  181. data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
  182. data/lib/oddb/persistence/og/model.rb +25 -0
  183. data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
  184. data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
  185. data/lib/oddb/regulatory/authority.rb +14 -0
  186. data/lib/oddb/regulatory/registration.rb +15 -0
  187. data/lib/oddb/remote/business/company.rb +23 -0
  188. data/lib/oddb/remote/drugs/active_agent.rb +27 -0
  189. data/lib/oddb/remote/drugs/atc.rb +32 -0
  190. data/lib/oddb/remote/drugs/dose.rb +8 -0
  191. data/lib/oddb/remote/drugs/galenic_form.rb +25 -0
  192. data/lib/oddb/remote/drugs/package.rb +126 -0
  193. data/lib/oddb/remote/drugs/part.rb +30 -0
  194. data/lib/oddb/remote/drugs/product.rb +19 -0
  195. data/lib/oddb/remote/drugs/sequence.rb +46 -0
  196. data/lib/oddb/remote/drugs/substance.rb +20 -0
  197. data/lib/oddb/remote/drugs/unit.rb +19 -0
  198. data/lib/oddb/remote/object.rb +36 -0
  199. data/lib/oddb/remote/text/document.rb +20 -0
  200. data/lib/oddb/remote/util/m10l_document.rb +22 -0
  201. data/lib/oddb/text/chapter.rb +27 -0
  202. data/lib/oddb/text/document.rb +43 -0
  203. data/lib/oddb/text/format.rb +37 -0
  204. data/lib/oddb/text/paragraph.rb +58 -0
  205. data/lib/oddb/text/picture.rb +93 -0
  206. data/lib/oddb/text/table.rb +68 -0
  207. data/lib/oddb/util.rb +8 -0
  208. data/lib/oddb/util/annotated_list.rb +37 -0
  209. data/lib/oddb/util/code.rb +69 -0
  210. data/lib/oddb/util/comparison.rb +36 -0
  211. data/lib/oddb/util/exporter.rb +8 -0
  212. data/lib/oddb/util/feedback.rb +23 -0
  213. data/lib/oddb/util/ipn.rb +48 -0
  214. data/lib/oddb/util/m10l_document.rb +38 -0
  215. data/lib/oddb/util/mail.rb +73 -0
  216. data/lib/oddb/util/money.rb +60 -0
  217. data/lib/oddb/util/multilingual.rb +70 -0
  218. data/lib/oddb/util/quanty.rb +4 -0
  219. data/lib/oddb/util/quanty/fact.rb +229 -0
  220. data/lib/oddb/util/quanty/main.rb +160 -0
  221. data/lib/oddb/util/quanty/parse.rb +853 -0
  222. data/lib/oddb/util/quanty/units.dump +0 -0
  223. data/lib/oddb/util/server.rb +117 -0
  224. data/lib/oddb/util/updater.rb +41 -0
  225. data/lib/oddb/util/ydim.rb +110 -0
  226. data/lib/oddb/util/yus.rb +46 -0
  227. data/test/business/test_company.rb +29 -0
  228. data/test/business/test_price.rb +46 -0
  229. data/test/drugs/test_active_agent.rb +53 -0
  230. data/test/drugs/test_atc.rb +54 -0
  231. data/test/drugs/test_composition.rb +88 -0
  232. data/test/drugs/test_ddd.rb +22 -0
  233. data/test/drugs/test_dose.rb +190 -0
  234. data/test/drugs/test_galenic_form.rb +41 -0
  235. data/test/drugs/test_package.rb +173 -0
  236. data/test/drugs/test_part.rb +32 -0
  237. data/test/drugs/test_product.rb +31 -0
  238. data/test/drugs/test_sequence.rb +140 -0
  239. data/test/drugs/test_substance.rb +51 -0
  240. data/test/drugs/test_substance_group.rb +27 -0
  241. data/test/export/test_rss.rb +94 -0
  242. data/test/export/test_server.rb +117 -0
  243. data/test/export/test_xls.rb +152 -0
  244. data/test/export/test_yaml.rb +120 -0
  245. data/test/import/data/html/whocc/A.html +56 -0
  246. data/test/import/data/html/whocc/A03.html +48 -0
  247. data/test/import/data/html/whocc/A03AB.html +48 -0
  248. data/test/import/data/html/whocc/A06AA.html +47 -0
  249. data/test/import/data/html/whocc/C03.html +47 -0
  250. data/test/import/data/html/whocc/login.html +77 -0
  251. data/test/import/data/xml/ATC_2006.xml +47 -0
  252. data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
  253. data/test/import/test_excel.rb +34 -0
  254. data/test/import/test_rtf.rb +40 -0
  255. data/test/import/test_whocc.rb +315 -0
  256. data/test/remote/drugs/test_active_agent.rb +36 -0
  257. data/test/selenium/selenium-server.jar +0 -0
  258. data/test/selenium/test_atc_browser.rb +122 -0
  259. data/test/selenium/test_atc_guidelines.rb +96 -0
  260. data/test/selenium/test_collect.rb +138 -0
  261. data/test/selenium/test_compare.rb +206 -0
  262. data/test/selenium/test_fachinfo.rb +130 -0
  263. data/test/selenium/test_feedback.rb +196 -0
  264. data/test/selenium/test_init.rb +52 -0
  265. data/test/selenium/test_limit.rb +305 -0
  266. data/test/selenium/test_login.rb +67 -0
  267. data/test/selenium/test_package.rb +512 -0
  268. data/test/selenium/test_patinfo.rb +131 -0
  269. data/test/selenium/test_product.rb +80 -0
  270. data/test/selenium/test_products.rb +142 -0
  271. data/test/selenium/test_search.rb +715 -0
  272. data/test/selenium/test_sequence.rb +543 -0
  273. data/test/selenium/unit.rb +185 -0
  274. data/test/stub/http_server.rb +169 -0
  275. data/test/stub/model.rb +173 -0
  276. data/test/suite.rb +15 -0
  277. data/test/test_model.rb +83 -0
  278. data/test/util/test_code.rb +74 -0
  279. data/test/util/test_ipn.rb +117 -0
  280. data/test/util/test_mail.rb +86 -0
  281. data/test/util/test_multilingual.rb +97 -0
  282. data/test/util/test_server.rb +48 -0
  283. data/test/util/test_updater.rb +353 -0
  284. data/test/util/test_ydim.rb +115 -0
  285. data/test/util/test_yus.rb +79 -0
  286. metadata +418 -0
@@ -0,0 +1,160 @@
1
+ # encoding: utf-8
2
+ #
3
+ # quanty/main.rb
4
+ #
5
+ # Copyright (c) 2001 Masahiro Tanaka <masa@ir.isas.ac.jp>
6
+ #
7
+ # This program is free software.
8
+ # You can distribute/modify this program under the terms of
9
+ # the GNU General Public License version 2 or later.
10
+
11
+ # require 'fact.rb'
12
+
13
+ def Quanty(*a)
14
+ Quanty.new(*a)
15
+ end
16
+
17
+ class Quanty #< Numeric
18
+ Self = self
19
+ RadianUnit = Quanty::Fact.new('radian')
20
+
21
+ def initialize(*a)
22
+ case a.size
23
+ when 1
24
+ if String === a[0]
25
+ @val,@unit,@fact = 1.0, a[0], nil
26
+ else
27
+ @val,@unit,@fact = a[0], '', nil
28
+ end
29
+ when 2..3
30
+ @val,@unit,@fact = a
31
+ else
32
+ raise ArgumentError, 'wrong # of arguments'
33
+ end
34
+ unless Fact === @fact
35
+ @fact = Fact.new(@unit)
36
+ end
37
+ end
38
+
39
+ attr_reader :val
40
+ attr_reader :unit
41
+ attr_reader :fact
42
+ alias value val
43
+
44
+ def adjust(other)
45
+ if other.kind_of?(Self)
46
+ unless @fact === other.fact
47
+ raise "not same unit: %s != %s" % [@unit,other.unit]
48
+ end
49
+ other.val * ( other.fact.factor / @fact.factor )
50
+ else
51
+ raise @unit + ": not null unit" unless @fact.null?
52
+ other / @fact.factor
53
+ end
54
+ end
55
+
56
+ def want(unit)
57
+ obj = Self.new(unit)
58
+ val = obj.adjust(self)
59
+ Self.new( val, unit, obj.fact )
60
+ end
61
+
62
+ def + (other)
63
+ val = @val + adjust(other)
64
+ if @unit==''
65
+ val
66
+ else
67
+ Self.new( val, @unit, @fact )
68
+ end
69
+ end
70
+
71
+ def - (other)
72
+ val = @val - adjust(other)
73
+ if @unit==''
74
+ val
75
+ else
76
+ Self.new( val, @unit, @fact )
77
+ end
78
+ end
79
+
80
+ def +@ ; Self.new( @val, @unit, @fact ) end
81
+ def -@ ; Self.new( -@val, @unit, @fact ) end
82
+
83
+ def <=> (other); @val <=> adjust(other) end
84
+ def == (other); @val == adjust(other) end
85
+ def >= (other); @val >= adjust(other) end
86
+ def <= (other); @val <= adjust(other) end
87
+ def < (other); @val < adjust(other) end
88
+ def > (other); @val > adjust(other) end
89
+
90
+ def **(n)
91
+ if /^[A-Za-z_]+&/ou =~ @unit
92
+ unit = @unit+'^'+n.to_s
93
+ else
94
+ unit = '('+@unit+')^'+n.to_s+''
95
+ end
96
+ Self.new( @val**n, unit, @fact**n )
97
+ end
98
+
99
+ def * (other)
100
+ if other.kind_of?(Self)
101
+ unit = other.unit
102
+ unless @unit.empty?
103
+ if unit.empty?
104
+ unit = @unit
105
+ else
106
+ if /\A[A-Za-z_]/ou =~ unit
107
+ unit = @unit+' '+unit
108
+ else
109
+ unit = @unit+' ('+unit+')'
110
+ end
111
+ end
112
+ end
113
+ Self.new( @val*other.val, unit, @fact*other.fact )
114
+ else
115
+ Self.new( @val*other, @unit, @fact )
116
+ end
117
+ end
118
+
119
+ def / (other)
120
+ if other.kind_of?(Self)
121
+ unit = other.unit
122
+ if unit.empty?
123
+ unit = @unit
124
+ else
125
+ if /\A[A-Za-z_-]+((\^|\*\*)?[0-9.]+)?$/ou =~ unit
126
+ unit = '/ '+unit
127
+ else
128
+ unit = '/ ('+unit+')'
129
+ end
130
+ unit = @unit+' '+unit unless @unit.empty?
131
+ end
132
+ Self.new( @val/other.val, unit, @fact/other.fact )
133
+ else
134
+ Self.new( @val/other, @unit, @fact )
135
+ end
136
+ end
137
+
138
+ def coerce(other)
139
+ [ Self.new(other), self ]
140
+ end
141
+
142
+ def to_f
143
+ if @fact.null?
144
+ @val * @fact.factor
145
+ elsif @fact === RadianUnit
146
+ want('radian').value
147
+ else
148
+ raise 'cannot convert into non-dimensional Float'
149
+ end
150
+ end
151
+
152
+ def to_s
153
+ @val.to_s + "[" + @unit + "]"
154
+ end
155
+
156
+ def inspect
157
+ "Quanty(" + @val.to_s + ",'" + @unit + "')"
158
+ end
159
+
160
+ end
@@ -0,0 +1,853 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.4.6
4
+ # from Racc grammer file "".
5
+ #
6
+
7
+ ###### racc/parser.rb begin
8
+ unless $".index 'racc/parser.rb'
9
+ $".push 'racc/parser.rb'
10
+ self.class.module_eval(<<'...end racc/parser.rb/module_eval...', 'racc/parser.rb', 1)
11
+ #
12
+ # $Id$
13
+ #
14
+ # Copyright (c) 1999-2006 Minero Aoki
15
+ #
16
+ # This program is free software.
17
+ # You can distribute/modify this program under the same terms of ruby.
18
+ #
19
+ # As a special exception, when this code is copied by Racc
20
+ # into a Racc output file, you may use that output file
21
+ # without restriction.
22
+ #
23
+
24
+ unless defined?(NotImplementedError)
25
+ NotImplementedError = NotImplementError
26
+ end
27
+
28
+ module Racc
29
+ class ParseError < StandardError; end
30
+ end
31
+ unless defined?(::ParseError)
32
+ ParseError = Racc::ParseError
33
+ end
34
+
35
+ module Racc
36
+
37
+ unless defined?(Racc_No_Extentions)
38
+ Racc_No_Extentions = false
39
+ end
40
+
41
+ class Parser
42
+
43
+ Racc_Runtime_Version = '1.4.6'
44
+ Racc_Runtime_Revision = '$Id$'
45
+
46
+ Racc_Runtime_Core_Version_R = '1.4.6'
47
+ Racc_Runtime_Core_Revision_R = '$Id$'.split[1]
48
+ begin
49
+ require 'racc/cparse'
50
+ # Racc_Runtime_Core_Version_C = (defined in extention)
51
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
52
+ unless new.respond_to?(:_racc_do_parse_c, true)
53
+ raise LoadError, 'old cparse.so'
54
+ end
55
+ if Racc_No_Extentions
56
+ raise LoadError, 'selecting ruby version of racc runtime core'
57
+ end
58
+
59
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c
60
+ Racc_YY_Parse_Method = :_racc_yyparse_c
61
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
62
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
63
+ Racc_Runtime_Type = 'c'
64
+ rescue LoadError
65
+ Racc_Main_Parsing_Routine = :_racc_do_parse_rb
66
+ Racc_YY_Parse_Method = :_racc_yyparse_rb
67
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
68
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
69
+ Racc_Runtime_Type = 'ruby'
70
+ end
71
+
72
+ def Parser.racc_runtime_type
73
+ Racc_Runtime_Type
74
+ end
75
+
76
+ private
77
+
78
+ def _racc_setup
79
+ @yydebug = false unless self.class::Racc_debug_parser
80
+ @yydebug = false unless defined?(@yydebug)
81
+ if @yydebug
82
+ @racc_debug_out = $stderr unless defined?(@racc_debug_out)
83
+ @racc_debug_out ||= $stderr
84
+ end
85
+ arg = self.class::Racc_arg
86
+ arg[13] = true if arg.size < 14
87
+ arg
88
+ end
89
+
90
+ def _racc_init_sysvars
91
+ @racc_state = [0]
92
+ @racc_tstack = []
93
+ @racc_vstack = []
94
+
95
+ @racc_t = nil
96
+ @racc_val = nil
97
+
98
+ @racc_read_next = true
99
+
100
+ @racc_user_yyerror = false
101
+ @racc_error_status = 0
102
+ end
103
+
104
+ ###
105
+ ### do_parse
106
+ ###
107
+
108
+ def do_parse
109
+ __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
110
+ end
111
+
112
+ def next_token
113
+ raise NotImplementedError, "#{self.class}\#next_token is not defined"
114
+ end
115
+
116
+ def _racc_do_parse_rb(arg, in_debug)
117
+ action_table, action_check, action_default, action_pointer,
118
+ goto_table, goto_check, goto_default, goto_pointer,
119
+ nt_base, reduce_table, token_table, shift_n,
120
+ reduce_n, use_result, * = arg
121
+
122
+ _racc_init_sysvars
123
+ tok = act = i = nil
124
+ nerr = 0
125
+
126
+ catch(:racc_end_parse) {
127
+ while true
128
+ if i = action_pointer[@racc_state[-1]]
129
+ if @racc_read_next
130
+ if @racc_t != 0 # not EOF
131
+ tok, @racc_val = next_token()
132
+ unless tok # EOF
133
+ @racc_t = 0
134
+ else
135
+ @racc_t = (token_table[tok] or 1) # error token
136
+ end
137
+ racc_read_token(@racc_t, tok, @racc_val) if @yydebug
138
+ @racc_read_next = false
139
+ end
140
+ end
141
+ i += @racc_t
142
+ unless i >= 0 and
143
+ act = action_table[i] and
144
+ action_check[i] == @racc_state[-1]
145
+ act = action_default[@racc_state[-1]]
146
+ end
147
+ else
148
+ act = action_default[@racc_state[-1]]
149
+ end
150
+ while act = _racc_evalact(act, arg)
151
+ ;
152
+ end
153
+ end
154
+ }
155
+ end
156
+
157
+ ###
158
+ ### yyparse
159
+ ###
160
+
161
+ def yyparse(recv, mid)
162
+ __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
163
+ end
164
+
165
+ def _racc_yyparse_rb(recv, mid, arg, c_debug)
166
+ action_table, action_check, action_default, action_pointer,
167
+ goto_table, goto_check, goto_default, goto_pointer,
168
+ nt_base, reduce_table, token_table, shift_n,
169
+ reduce_n, use_result, * = arg
170
+
171
+ _racc_init_sysvars
172
+ nerr = 0
173
+
174
+ catch(:racc_end_parse) {
175
+ until i = action_pointer[@racc_state[-1]]
176
+ while act = _racc_evalact(action_default[@racc_state[-1]], arg)
177
+ ;
178
+ end
179
+ end
180
+ recv.__send__(mid) do |tok, val|
181
+ unless tok
182
+ @racc_t = 0
183
+ else
184
+ @racc_t = (token_table[tok] or 1) # error token
185
+ end
186
+ @racc_val = val
187
+ @racc_read_next = false
188
+
189
+ i += @racc_t
190
+ unless i >= 0 and
191
+ act = action_table[i] and
192
+ action_check[i] == @racc_state[-1]
193
+ act = action_default[@racc_state[-1]]
194
+ end
195
+ while act = _racc_evalact(act, arg)
196
+ ;
197
+ end
198
+
199
+ while !(i = action_pointer[@racc_state[-1]]) ||
200
+ ! @racc_read_next ||
201
+ @racc_t == 0 # $
202
+ unless i and i += @racc_t and
203
+ i >= 0 and
204
+ act = action_table[i] and
205
+ action_check[i] == @racc_state[-1]
206
+ act = action_default[@racc_state[-1]]
207
+ end
208
+ while act = _racc_evalact(act, arg)
209
+ ;
210
+ end
211
+ end
212
+ end
213
+ }
214
+ end
215
+
216
+ ###
217
+ ### common
218
+ ###
219
+
220
+ def _racc_evalact(act, arg)
221
+ action_table, action_check, action_default, action_pointer,
222
+ goto_table, goto_check, goto_default, goto_pointer,
223
+ nt_base, reduce_table, token_table, shift_n,
224
+ reduce_n, use_result, * = arg
225
+ nerr = 0 # tmp
226
+
227
+ if act > 0 and act < shift_n
228
+ #
229
+ # shift
230
+ #
231
+ if @racc_error_status > 0
232
+ @racc_error_status -= 1 unless @racc_t == 1 # error token
233
+ end
234
+ @racc_vstack.push @racc_val
235
+ @racc_state.push act
236
+ @racc_read_next = true
237
+ if @yydebug
238
+ @racc_tstack.push @racc_t
239
+ racc_shift @racc_t, @racc_tstack, @racc_vstack
240
+ end
241
+
242
+ elsif act < 0 and act > -reduce_n
243
+ #
244
+ # reduce
245
+ #
246
+ code = catch(:racc_jump) {
247
+ @racc_state.push _racc_do_reduce(arg, act)
248
+ false
249
+ }
250
+ if code
251
+ case code
252
+ when 1 # yyerror
253
+ @racc_user_yyerror = true # user_yyerror
254
+ return -reduce_n
255
+ when 2 # yyaccept
256
+ return shift_n
257
+ else
258
+ raise '[Racc Bug] unknown jump code'
259
+ end
260
+ end
261
+
262
+ elsif act == shift_n
263
+ #
264
+ # accept
265
+ #
266
+ racc_accept if @yydebug
267
+ throw :racc_end_parse, @racc_vstack[0]
268
+
269
+ elsif act == -reduce_n
270
+ #
271
+ # error
272
+ #
273
+ case @racc_error_status
274
+ when 0
275
+ unless arg[21] # user_yyerror
276
+ nerr += 1
277
+ on_error @racc_t, @racc_val, @racc_vstack
278
+ end
279
+ when 3
280
+ if @racc_t == 0 # is $
281
+ throw :racc_end_parse, nil
282
+ end
283
+ @racc_read_next = true
284
+ end
285
+ @racc_user_yyerror = false
286
+ @racc_error_status = 3
287
+ while true
288
+ if i = action_pointer[@racc_state[-1]]
289
+ i += 1 # error token
290
+ if i >= 0 and
291
+ (act = action_table[i]) and
292
+ action_check[i] == @racc_state[-1]
293
+ break
294
+ end
295
+ end
296
+ throw :racc_end_parse, nil if @racc_state.size <= 1
297
+ @racc_state.pop
298
+ @racc_vstack.pop
299
+ if @yydebug
300
+ @racc_tstack.pop
301
+ racc_e_pop @racc_state, @racc_tstack, @racc_vstack
302
+ end
303
+ end
304
+ return act
305
+
306
+ else
307
+ raise "[Racc Bug] unknown action #{act.inspect}"
308
+ end
309
+
310
+ racc_next_state(@racc_state[-1], @racc_state) if @yydebug
311
+
312
+ nil
313
+ end
314
+
315
+ def _racc_do_reduce(arg, act)
316
+ action_table, action_check, action_default, action_pointer,
317
+ goto_table, goto_check, goto_default, goto_pointer,
318
+ nt_base, reduce_table, token_table, shift_n,
319
+ reduce_n, use_result, * = arg
320
+ state = @racc_state
321
+ vstack = @racc_vstack
322
+ tstack = @racc_tstack
323
+
324
+ i = act * -3
325
+ len = reduce_table[i]
326
+ reduce_to = reduce_table[i+1]
327
+ method_id = reduce_table[i+2]
328
+ void_array = []
329
+
330
+ tmp_t = tstack[-len, len] if @yydebug
331
+ tmp_v = vstack[-len, len]
332
+ tstack[-len, len] = void_array if @yydebug
333
+ vstack[-len, len] = void_array
334
+ state[-len, len] = void_array
335
+
336
+ # tstack must be updated AFTER method call
337
+ if use_result
338
+ vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
339
+ else
340
+ vstack.push __send__(method_id, tmp_v, vstack)
341
+ end
342
+ tstack.push reduce_to
343
+
344
+ racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
345
+
346
+ k1 = reduce_to - nt_base
347
+ if i = goto_pointer[k1]
348
+ i += state[-1]
349
+ if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
350
+ return curstate
351
+ end
352
+ end
353
+ goto_default[k1]
354
+ end
355
+
356
+ def on_error(t, val, vstack)
357
+ raise ParseError, sprintf("\nparse error on value %s (%s)",
358
+ val.inspect, token_to_str(t) || '?')
359
+ end
360
+
361
+ def yyerror
362
+ throw :racc_jump, 1
363
+ end
364
+
365
+ def yyaccept
366
+ throw :racc_jump, 2
367
+ end
368
+
369
+ def yyerrok
370
+ @racc_error_status = 0
371
+ end
372
+
373
+ #
374
+ # for debugging output
375
+ #
376
+
377
+ def racc_read_token(t, tok, val)
378
+ @racc_debug_out.print 'read '
379
+ @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
380
+ @racc_debug_out.puts val.inspect
381
+ @racc_debug_out.puts
382
+ end
383
+
384
+ def racc_shift(tok, tstack, vstack)
385
+ @racc_debug_out.puts "shift #{racc_token2str tok}"
386
+ racc_print_stacks tstack, vstack
387
+ @racc_debug_out.puts
388
+ end
389
+
390
+ def racc_reduce(toks, sim, tstack, vstack)
391
+ out = @racc_debug_out
392
+ out.print 'reduce '
393
+ if toks.empty?
394
+ out.print ' <none>'
395
+ else
396
+ toks.each {|t| out.print ' ', racc_token2str(t) }
397
+ end
398
+ out.puts " --> #{racc_token2str(sim)}"
399
+
400
+ racc_print_stacks tstack, vstack
401
+ @racc_debug_out.puts
402
+ end
403
+
404
+ def racc_accept
405
+ @racc_debug_out.puts 'accept'
406
+ @racc_debug_out.puts
407
+ end
408
+
409
+ def racc_e_pop(state, tstack, vstack)
410
+ @racc_debug_out.puts 'error recovering mode: pop token'
411
+ racc_print_states state
412
+ racc_print_stacks tstack, vstack
413
+ @racc_debug_out.puts
414
+ end
415
+
416
+ def racc_next_state(curstate, state)
417
+ @racc_debug_out.puts "goto #{curstate}"
418
+ racc_print_states state
419
+ @racc_debug_out.puts
420
+ end
421
+
422
+ def racc_print_stacks(t, v)
423
+ out = @racc_debug_out
424
+ out.print ' ['
425
+ t.each_index do |i|
426
+ out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
427
+ end
428
+ out.puts ' ]'
429
+ end
430
+
431
+ def racc_print_states(s)
432
+ out = @racc_debug_out
433
+ out.print ' ['
434
+ s.each {|st| out.print ' ', st }
435
+ out.puts ' ]'
436
+ end
437
+
438
+ def racc_token2str(tok)
439
+ self.class::Racc_token_to_s_table[tok] or
440
+ raise "[Racc Bug] can't convert token #{tok} to string"
441
+ end
442
+
443
+ def token_to_str(t)
444
+ self.class::Racc_token_to_s_table[t]
445
+ end
446
+
447
+ end
448
+
449
+ end
450
+
451
+ ...end racc/parser.rb/module_eval...
452
+ end
453
+ ###### racc/parser.rb end
454
+
455
+ # encoding: utf-8
456
+ # parse.y, quanty/parse.rb
457
+ #
458
+ # by Masahiro Tanaka <masa@ir.isas.ac.jp>
459
+ #
460
+ class Quanty
461
+
462
+ class Parse < Racc::Parser
463
+
464
+ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 73)
465
+ # encoding: utf-8
466
+
467
+ def parse( str )
468
+ @q = []
469
+
470
+ while str.size > 0 do
471
+ #p str
472
+ case str
473
+ when /\A[\s\n]+/ou
474
+ when /\A\d+\.?\d*([eE][+-]?\d+)?/ou
475
+ @q.push [:NUMBER, $&.to_f]
476
+ when /\A([A-Z]\.){2}/u
477
+ when /\A[A-Za-z_]+ -/u
478
+ when /\A[A-Za-z_µ]+([A-Za-z_µ0-9-]+[A-Za-z_µ])?/ou
479
+ @q.push [:WORD, $&]
480
+ when /\A[$%'"]'?/ou
481
+ @q.push [:WORD, $&]
482
+ when /\A\^|\A\*\*/ou
483
+ @q.push [:POW, $&]
484
+ when /\A./ou
485
+ @q.push [$&,$&]
486
+ end
487
+ str = $'
488
+ end
489
+ @q.push [false, '$end']
490
+
491
+ do_parse
492
+ end
493
+
494
+ def next_token
495
+ @q.shift
496
+ end
497
+
498
+ ...end parse.y/module_eval...
499
+ ##### State transition tables begin ###
500
+
501
+ racc_action_table = [
502
+ 23, 22, 24, 25, 26, 27, 29, 23, 20, 38,
503
+ 3, 4, 23, 23, 24, 25, 26, 27, 29, 23,
504
+ 20, 23, 3, 4, 23, 33, 24, 25, 26, 27,
505
+ 29, 40, 20, 37, 3, 4, 23, 39, 24, 36,
506
+ 26, 27, 29, 30, 31, 38, nil, 30, 31, 20,
507
+ nil, 3, 4, 20, 5, 3, 4, 10, 12, 2,
508
+ 5, 3, 4, 10, 12, 2, 5, 3, 4, 10,
509
+ 12, 2, 5, 3, 4, 10, 12, 2, 14, 3,
510
+ 4, nil, nil, 23, 10, 12, 13, 26, 27, 29,
511
+ 23, nil, nil, 23, 26, 27, 29, 26, 27, 29,
512
+ 23, 10, 12, 13, 26, 27, 29, 10, 12, 2,
513
+ nil, 3, 4, 10, 12, 2, nil, 3, 4, 10,
514
+ 12, 2, nil, 3, 4, 23, nil, 24, 36, 26,
515
+ 23, nil, 24, 36, 26, 20, nil, 3, 4, 10,
516
+ 12, 13, 10, 12, 13, 10, 12, 13, 10, 12,
517
+ 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
518
+
519
+ racc_action_check = [
520
+ 17, 6, 17, 17, 17, 17, 17, 41, 17, 17,
521
+ 17, 17, 19, 42, 19, 19, 19, 19, 19, 43,
522
+ 19, 45, 19, 19, 8, 10, 8, 8, 8, 8,
523
+ 8, 22, 8, 16, 8, 8, 34, 18, 34, 34,
524
+ 34, 34, 34, 28, 28, 34, nil, 9, 9, 28,
525
+ nil, 28, 28, 9, 0, 9, 9, 0, 0, 0,
526
+ 20, 0, 0, 20, 20, 20, 4, 20, 20, 4,
527
+ 4, 4, 2, 4, 4, 2, 2, 2, 1, 2,
528
+ 2, nil, nil, 15, 1, 1, 1, 15, 15, 15,
529
+ 48, nil, nil, 35, 48, 48, 48, 35, 35, 35,
530
+ 50, 29, 29, 29, 50, 50, 50, 31, 31, 31,
531
+ nil, 31, 31, 30, 30, 30, nil, 30, 30, 25,
532
+ 25, 25, nil, 25, 25, 47, nil, 47, 47, 47,
533
+ 46, nil, 46, 46, 46, 5, nil, 5, 5, 27,
534
+ 27, 27, 13, 13, 13, 23, 23, 23, 14, 14,
535
+ 14, 36, 36, 36, 26, 26, 26, 24, 24, 24 ]
536
+
537
+ racc_action_pointer = [
538
+ 48, 75, 66, nil, 60, 124, 1, nil, 21, 42,
539
+ 15, nil, nil, 133, 139, 80, 21, -3, 22, 9,
540
+ 54, nil, 31, 136, 148, 110, 145, 130, 38, 92,
541
+ 104, 98, nil, nil, 33, 90, 142, nil, nil, nil,
542
+ nil, 4, 10, 16, nil, 18, 127, 122, 87, nil,
543
+ 97, nil ]
544
+
545
+ racc_action_default = [
546
+ -2, -23, -29, -26, -29, -29, -29, -1, -3, -13,
547
+ -29, -17, -4, -29, -29, -24, -29, -29, -29, -29,
548
+ -29, -15, -29, -29, -29, -29, -29, -29, -14, -29,
549
+ -29, -29, -18, -5, -29, -25, -29, -27, -12, -28,
550
+ 52, -11, -10, -9, -16, -8, -6, -7, -21, -19,
551
+ -22, -20 ]
552
+
553
+ racc_goto_table = [
554
+ 8, 15, 17, 7, 6, nil, 28, 18, nil, nil,
555
+ nil, nil, 21, 34, 35, 28, 32, 28, nil, nil,
556
+ nil, nil, nil, 41, 42, 43, 45, 46, nil, 47,
557
+ 48, 50, 44, nil, nil, 32, 43, 49, 51 ]
558
+
559
+ racc_goto_check = [
560
+ 3, 3, 3, 2, 1, nil, 4, 2, nil, nil,
561
+ nil, nil, 5, 3, 3, 4, 5, 4, nil, nil,
562
+ nil, nil, nil, 3, 3, 3, 3, 3, nil, 3,
563
+ 3, 3, 5, nil, nil, 5, 3, 5, 5 ]
564
+
565
+ racc_goto_pointer = [
566
+ nil, 4, 3, 0, -2, 7, nil ]
567
+
568
+ racc_goto_default = [
569
+ nil, nil, 16, 19, 9, 11, 1 ]
570
+
571
+ racc_reduce_table = [
572
+ 0, 0, :racc_error,
573
+ 1, 17, :_reduce_none,
574
+ 0, 17, :_reduce_2,
575
+ 1, 17, :_reduce_3,
576
+ 1, 19, :_reduce_none,
577
+ 2, 19, :_reduce_5,
578
+ 3, 19, :_reduce_6,
579
+ 3, 19, :_reduce_7,
580
+ 3, 19, :_reduce_8,
581
+ 3, 19, :_reduce_9,
582
+ 3, 19, :_reduce_10,
583
+ 3, 19, :_reduce_11,
584
+ 3, 19, :_reduce_12,
585
+ 1, 18, :_reduce_none,
586
+ 2, 18, :_reduce_14,
587
+ 2, 18, :_reduce_15,
588
+ 3, 18, :_reduce_16,
589
+ 1, 20, :_reduce_none,
590
+ 2, 20, :_reduce_18,
591
+ 3, 20, :_reduce_19,
592
+ 3, 20, :_reduce_20,
593
+ 3, 20, :_reduce_21,
594
+ 3, 20, :_reduce_22,
595
+ 1, 21, :_reduce_none,
596
+ 2, 21, :_reduce_24,
597
+ 3, 21, :_reduce_25,
598
+ 1, 22, :_reduce_26,
599
+ 3, 22, :_reduce_27,
600
+ 3, 22, :_reduce_28 ]
601
+
602
+ racc_reduce_n = 29
603
+
604
+ racc_shift_n = 52
605
+
606
+ racc_token_table = {
607
+ false => 0,
608
+ :error => 1,
609
+ :UMINUS => 2,
610
+ :POW => 3,
611
+ :UPOW => 4,
612
+ "*" => 5,
613
+ "/" => 6,
614
+ "|" => 7,
615
+ "+" => 8,
616
+ "-" => 9,
617
+ :NUMBER => 10,
618
+ "(" => 11,
619
+ ")" => 12,
620
+ :WORD => 13,
621
+ "[" => 14,
622
+ "]" => 15 }
623
+
624
+ racc_nt_base = 16
625
+
626
+ racc_use_result_var = true
627
+
628
+ Racc_arg = [
629
+ racc_action_table,
630
+ racc_action_check,
631
+ racc_action_default,
632
+ racc_action_pointer,
633
+ racc_goto_table,
634
+ racc_goto_check,
635
+ racc_goto_default,
636
+ racc_goto_pointer,
637
+ racc_nt_base,
638
+ racc_reduce_table,
639
+ racc_token_table,
640
+ racc_shift_n,
641
+ racc_reduce_n,
642
+ racc_use_result_var ]
643
+
644
+ Racc_token_to_s_table = [
645
+ "$end",
646
+ "error",
647
+ "UMINUS",
648
+ "POW",
649
+ "UPOW",
650
+ "\"*\"",
651
+ "\"/\"",
652
+ "\"|\"",
653
+ "\"+\"",
654
+ "\"-\"",
655
+ "NUMBER",
656
+ "\"(\"",
657
+ "\")\"",
658
+ "WORD",
659
+ "\"[\"",
660
+ "\"]\"",
661
+ "$start",
662
+ "target",
663
+ "val",
664
+ "num",
665
+ "seq",
666
+ "exp",
667
+ "unit" ]
668
+
669
+ Racc_debug_parser = false
670
+
671
+ ##### State transition tables end #####
672
+
673
+ # reduce 0 omitted
674
+
675
+ # reduce 1 omitted
676
+
677
+ module_eval(<<'.,.,', 'parse.y', 22)
678
+ def _reduce_2(val, _values, result)
679
+ result = Quanty::Fact.new
680
+ result
681
+ end
682
+ .,.,
683
+
684
+ module_eval(<<'.,.,', 'parse.y', 23)
685
+ def _reduce_3(val, _values, result)
686
+ result = Quanty::Fact.new(val[0])
687
+ result
688
+ end
689
+ .,.,
690
+
691
+ # reduce 4 omitted
692
+
693
+ module_eval(<<'.,.,', 'parse.y', 27)
694
+ def _reduce_5(val, _values, result)
695
+ result = -val[1]
696
+ result
697
+ end
698
+ .,.,
699
+
700
+ module_eval(<<'.,.,', 'parse.y', 28)
701
+ def _reduce_6(val, _values, result)
702
+ result += val[2]
703
+ result
704
+ end
705
+ .,.,
706
+
707
+ module_eval(<<'.,.,', 'parse.y', 29)
708
+ def _reduce_7(val, _values, result)
709
+ result -= val[2]
710
+ result
711
+ end
712
+ .,.,
713
+
714
+ module_eval(<<'.,.,', 'parse.y', 30)
715
+ def _reduce_8(val, _values, result)
716
+ result /= val[2]
717
+ result
718
+ end
719
+ .,.,
720
+
721
+ module_eval(<<'.,.,', 'parse.y', 31)
722
+ def _reduce_9(val, _values, result)
723
+ result /= val[2]
724
+ result
725
+ end
726
+ .,.,
727
+
728
+ module_eval(<<'.,.,', 'parse.y', 32)
729
+ def _reduce_10(val, _values, result)
730
+ result *= val[2]
731
+ result
732
+ end
733
+ .,.,
734
+
735
+ module_eval(<<'.,.,', 'parse.y', 33)
736
+ def _reduce_11(val, _values, result)
737
+ result **= val[2]
738
+ result
739
+ end
740
+ .,.,
741
+
742
+ module_eval(<<'.,.,', 'parse.y', 34)
743
+ def _reduce_12(val, _values, result)
744
+ result = val[1]
745
+ result
746
+ end
747
+ .,.,
748
+
749
+ # reduce 13 omitted
750
+
751
+ module_eval(<<'.,.,', 'parse.y', 38)
752
+ def _reduce_14(val, _values, result)
753
+ result = val[1].fac!(val[0])
754
+ result
755
+ end
756
+ .,.,
757
+
758
+ module_eval(<<'.,.,', 'parse.y', 39)
759
+ def _reduce_15(val, _values, result)
760
+ result = val[1].pow!(-1)
761
+ result
762
+ end
763
+ .,.,
764
+
765
+ module_eval(<<'.,.,', 'parse.y', 40)
766
+ def _reduce_16(val, _values, result)
767
+ result = val[2].pow!(-1).fac!(val[0])
768
+ result
769
+ end
770
+ .,.,
771
+
772
+ # reduce 17 omitted
773
+
774
+ module_eval(<<'.,.,', 'parse.y', 44)
775
+ def _reduce_18(val, _values, result)
776
+ result.mul!(val[1])
777
+ result
778
+ end
779
+ .,.,
780
+
781
+ module_eval(<<'.,.,', 'parse.y', 45)
782
+ def _reduce_19(val, _values, result)
783
+ result.mul!(val[2])
784
+ result
785
+ end
786
+ .,.,
787
+
788
+ module_eval(<<'.,.,', 'parse.y', 46)
789
+ def _reduce_20(val, _values, result)
790
+ result.div!(val[2])
791
+ result
792
+ end
793
+ .,.,
794
+
795
+ module_eval(<<'.,.,', 'parse.y', 47)
796
+ def _reduce_21(val, _values, result)
797
+ result.fac!(val[2])
798
+ result
799
+ end
800
+ .,.,
801
+
802
+ module_eval(<<'.,.,', 'parse.y', 48)
803
+ def _reduce_22(val, _values, result)
804
+ result.fac!(val[2]**-1)
805
+ result
806
+ end
807
+ .,.,
808
+
809
+ # reduce 23 omitted
810
+
811
+ module_eval(<<'.,.,', 'parse.y', 52)
812
+ def _reduce_24(val, _values, result)
813
+ result.pow!(val[1])
814
+ result
815
+ end
816
+ .,.,
817
+
818
+ module_eval(<<'.,.,', 'parse.y', 53)
819
+ def _reduce_25(val, _values, result)
820
+ result.pow!(val[2])
821
+ result
822
+ end
823
+ .,.,
824
+
825
+ module_eval(<<'.,.,', 'parse.y', 56)
826
+ def _reduce_26(val, _values, result)
827
+ result = Quanty::Fact.new(val[0])
828
+ result
829
+ end
830
+ .,.,
831
+
832
+ module_eval(<<'.,.,', 'parse.y', 57)
833
+ def _reduce_27(val, _values, result)
834
+ result = val[1]
835
+ result
836
+ end
837
+ .,.,
838
+
839
+ module_eval(<<'.,.,', 'parse.y', 58)
840
+ def _reduce_28(val, _values, result)
841
+ result = val[1]
842
+ result
843
+ end
844
+ .,.,
845
+
846
+ def _reduce_none(val, _values, result)
847
+ val[0]
848
+ end
849
+
850
+ end # class Parse
851
+
852
+
853
+ end # class Quanty