writeexcel 0.5.0 → 0.6.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 (130) hide show
  1. data/.gitattributes +1 -1
  2. data/.gitignore +24 -24
  3. data/README.rdoc +34 -55
  4. data/VERSION +1 -1
  5. data/charts/chartex.rb +316 -316
  6. data/charts/demo1.rb +46 -46
  7. data/charts/demo2.rb +65 -65
  8. data/charts/demo3.rb +117 -117
  9. data/charts/demo4.rb +119 -119
  10. data/charts/demo5.rb +48 -48
  11. data/examples/a_simple.rb +43 -43
  12. data/examples/autofilter.rb +265 -265
  13. data/examples/bigfile.rb +30 -30
  14. data/examples/chart_area.rb +121 -121
  15. data/examples/chart_bar.rb +120 -120
  16. data/examples/chart_column.rb +120 -120
  17. data/examples/chart_line.rb +120 -120
  18. data/examples/chart_pie.rb +108 -108
  19. data/examples/chart_scatter.rb +121 -121
  20. data/examples/chart_stock.rb +148 -148
  21. data/examples/chess.rb +142 -142
  22. data/examples/colors.rb +129 -129
  23. data/examples/comments1.rb +27 -27
  24. data/examples/comments2.rb +352 -352
  25. data/examples/copyformat.rb +52 -52
  26. data/examples/data_validate.rb +279 -279
  27. data/examples/date_time.rb +87 -87
  28. data/examples/defined_name.rb +32 -32
  29. data/examples/demo.rb +124 -124
  30. data/examples/diag_border.rb +36 -36
  31. data/examples/formats.rb +490 -490
  32. data/examples/formula_result.rb +30 -30
  33. data/examples/header.rb +137 -137
  34. data/examples/hide_sheet.rb +29 -29
  35. data/examples/hyperlink.rb +43 -43
  36. data/examples/images.rb +63 -63
  37. data/examples/indent.rb +31 -31
  38. data/examples/merge1.rb +40 -40
  39. data/examples/merge2.rb +45 -45
  40. data/examples/merge3.rb +66 -66
  41. data/examples/merge4.rb +83 -83
  42. data/examples/merge5.rb +80 -80
  43. data/examples/merge6.rb +67 -67
  44. data/examples/outline.rb +255 -255
  45. data/examples/outline_collapsed.rb +209 -209
  46. data/examples/panes.rb +113 -113
  47. data/examples/properties.rb +34 -34
  48. data/examples/properties_jp.rb +33 -33
  49. data/examples/protection.rb +47 -47
  50. data/examples/regions.rb +53 -53
  51. data/examples/repeat.rb +43 -43
  52. data/examples/right_to_left.rb +27 -27
  53. data/examples/row_wrap.rb +53 -53
  54. data/examples/stats.rb +74 -74
  55. data/examples/stocks.rb +81 -81
  56. data/examples/tab_colors.rb +31 -31
  57. data/examples/utf8.rb +15 -15
  58. data/examples/write_arrays.rb +83 -83
  59. data/lib/writeexcel/biffwriter.rb +232 -232
  60. data/lib/writeexcel/caller_info.rb +12 -12
  61. data/lib/writeexcel/chart.rb +2190 -2177
  62. data/lib/writeexcel/charts/area.rb +154 -154
  63. data/lib/writeexcel/charts/bar.rb +177 -177
  64. data/lib/writeexcel/charts/column.rb +156 -156
  65. data/lib/writeexcel/charts/external.rb +66 -66
  66. data/lib/writeexcel/charts/line.rb +154 -154
  67. data/lib/writeexcel/charts/pie.rb +169 -169
  68. data/lib/writeexcel/charts/scatter.rb +192 -192
  69. data/lib/writeexcel/charts/stock.rb +213 -213
  70. data/lib/writeexcel/colors.rb +64 -64
  71. data/lib/writeexcel/compatibility.rb +0 -255
  72. data/lib/writeexcel/debug_info.rb +37 -33
  73. data/lib/writeexcel/excelformulaparser.rb +587 -587
  74. data/lib/writeexcel/format.rb +13 -4
  75. data/lib/writeexcel/formula.rb +26 -9
  76. data/lib/writeexcel/helper.rb +68 -64
  77. data/lib/writeexcel/olewriter.rb +311 -311
  78. data/lib/writeexcel/properties.rb +242 -240
  79. data/lib/writeexcel/storage_lite.rb +984 -978
  80. data/lib/writeexcel/workbook.rb +3210 -3192
  81. data/lib/writeexcel/worksheet.rb +143 -51
  82. data/lib/writeexcel/write_file.rb +44 -40
  83. data/lib/writeexcel.rb +1159 -1159
  84. data/test/helper.rb +31 -28
  85. data/test/perl_output/README +31 -31
  86. data/test/test_00_IEEE_double.rb +13 -13
  87. data/test/test_01_add_worksheet.rb +10 -10
  88. data/test/test_02_merge_formats.rb +53 -53
  89. data/test/test_04_dimensions.rb +392 -392
  90. data/test/test_05_rows.rb +179 -179
  91. data/test/test_06_extsst.rb +77 -77
  92. data/test/test_11_date_time.rb +479 -479
  93. data/test/test_12_date_only.rb +501 -501
  94. data/test/test_13_date_seconds.rb +481 -481
  95. data/test/test_21_escher.rb +637 -637
  96. data/test/test_22_mso_drawing_group.rb +745 -745
  97. data/test/test_23_note.rb +73 -73
  98. data/test/test_24_txo.rb +75 -75
  99. data/test/test_25_position_object.rb +84 -84
  100. data/test/test_26_autofilter.rb +314 -314
  101. data/test/test_27_autofilter.rb +131 -131
  102. data/test/test_28_autofilter.rb +161 -161
  103. data/test/test_29_process_jpg.rb +683 -683
  104. data/test/test_30_validation_dval.rb +77 -77
  105. data/test/test_31_validation_dv_strings.rb +126 -126
  106. data/test/test_32_validation_dv_formula.rb +206 -206
  107. data/test/test_40_property_types.rb +188 -188
  108. data/test/test_41_properties.rb +235 -235
  109. data/test/test_42_set_properties.rb +437 -437
  110. data/test/test_50_name_stored.rb +299 -299
  111. data/test/test_51_name_print_area.rb +357 -357
  112. data/test/test_52_name_print_titles.rb +454 -454
  113. data/test/test_53_autofilter.rb +203 -203
  114. data/test/test_60_chart_generic.rb +578 -578
  115. data/test/test_61_chart_subclasses.rb +95 -95
  116. data/test/test_62_chart_formats.rb +272 -272
  117. data/test/test_63_chart_area_formats.rb +649 -649
  118. data/test/test_biff.rb +75 -75
  119. data/test/test_compatibility.rb +12 -627
  120. data/test/test_example_match.rb +3144 -3144
  121. data/test/test_formula.rb +61 -61
  122. data/test/test_ole.rb +106 -106
  123. data/test/test_storage_lite.rb +125 -125
  124. data/test/test_workbook.rb +139 -139
  125. data/test/test_worksheet.rb +110 -110
  126. data/utils/add_magic_comment.rb +80 -80
  127. data/writeexcel.gemspec +4 -6
  128. data/writeexcel.rdoc +58 -15
  129. metadata +9 -6
  130. data/test/test_new_encoding.rb +0 -205
@@ -1,587 +1,587 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.4.6
5
- # from Racc grammer file "".
6
- #
7
-
8
- require 'racc/parser.rb'
9
- class ExcelFormulaParser < Racc::Parser # :nodoc:
10
- ##### State transition tables begin ###
11
-
12
- racc_action_table = [
13
- 16, 54, 26, 28, 30, 32, 34, 21, 20, 3,
14
- nil, nil, 53, 19, 23, 4, 5, 6, 7, 10,
15
- 13, 14, 15, 17, 18, 16, nil, 26, 28, 30,
16
- 32, 34, 8, nil, nil, nil, nil, 16, 19, nil,
17
- 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
18
- 19, 16, 4, 5, 6, 7, 10, 13, 14, 15,
19
- 17, 18, nil, 16, 19, nil, 4, 5, 6, 7,
20
- 10, 13, 14, 15, 17, 18, 19, 16, 4, 5,
21
- 6, 7, 10, 13, 14, 15, 17, 18, nil, 16,
22
- 19, nil, 4, 5, 6, 7, 10, 13, 14, 15,
23
- 17, 18, 19, 16, 4, 5, 6, 7, 10, 13,
24
- 14, 15, 17, 18, nil, 16, 19, 37, 4, 5,
25
- 6, 7, 10, 13, 14, 15, 17, 18, 19, 16,
26
- 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
27
- nil, 16, 19, nil, 4, 5, 6, 7, 10, 13,
28
- 14, 15, 17, 18, 19, 16, 4, 5, 6, 7,
29
- 10, 13, 14, 15, 17, 18, nil, 16, 19, nil,
30
- 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
31
- 19, 16, 4, 5, 6, 7, 10, 13, 14, 15,
32
- 17, 18, nil, 16, 19, nil, 4, 5, 6, 7,
33
- 10, 13, 14, 15, 17, 18, 19, 16, 4, 5,
34
- 6, 7, 10, 13, 14, 15, 17, 18, nil, 16,
35
- 19, nil, 4, 5, 6, 7, 10, 13, 14, 15,
36
- 17, 18, 19, nil, 4, 5, 6, 7, 10, 13,
37
- 14, 15, 17, 18, 23, 24, 27, 29, 31, 33,
38
- nil, nil, nil, nil, nil, 22, nil, 26, 28, 30,
39
- 32, 34, nil, 52, 23, 24, 27, 29, 31, 33,
40
- 23, 24, 27, 29, nil, nil, nil, 26, 28, 30,
41
- 32, 34, nil, 26, 28, 30, 32, 34, 23, 24,
42
- 27, 29, nil, nil, nil, 23, 24, 27, 29, 31,
43
- 33, 26, 28, 30, 32, 34, 22, 25, 26, 28,
44
- 30, 32, 34, 23, 24, 27, 29, 31, 33, nil,
45
- nil, nil, nil, nil, 22, nil, 26, 28, 30, 32,
46
- 34, 23, 24, 27, 29, 31, 33, nil, nil, nil,
47
- nil, nil, 22, nil, 26, 28, 30, 32, 34, 23,
48
- 24, 27, 29, 31, 33, 23, nil, nil, nil, nil,
49
- 22, nil, 26, 28, 30, 32, 34, nil, 26, 28,
50
- 30, 32, 34, 23, 24, 27, 29, 31, 33, 23,
51
- 24, nil, nil, nil, 22, nil, 26, 28, 30, 32,
52
- 34, nil, 26, 28, 30, 32, 34, 23, 24, 27,
53
- 29, 31, 33, 23, 24, nil, nil, nil, 22, nil,
54
- 26, 28, 30, 32, 34, nil, 26, 28, 30, 32,
55
- 34, 23, 24, 27, 29, 31, 33, nil, nil, nil,
56
- nil, nil, 22, nil, 26, 28, 30, 32, 34, 23,
57
- 24, 27, 29, 31, 33, nil, nil, nil, nil, nil,
58
- 22, nil, 26, 28, 30, 32, 34 ]
59
-
60
- racc_action_check = [
61
- 34, 39, 35, 35, 35, 35, 35, 4, 3, 1,
62
- nil, nil, 39, 34, 41, 34, 34, 34, 34, 34,
63
- 34, 34, 34, 34, 34, 2, nil, 41, 41, 41,
64
- 41, 41, 2, nil, nil, nil, nil, 53, 2, nil,
65
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
66
- 53, 33, 53, 53, 53, 53, 53, 53, 53, 53,
67
- 53, 53, nil, 32, 33, nil, 33, 33, 33, 33,
68
- 33, 33, 33, 33, 33, 33, 32, 16, 32, 32,
69
- 32, 32, 32, 32, 32, 32, 32, 32, nil, 19,
70
- 16, nil, 16, 16, 16, 16, 16, 16, 16, 16,
71
- 16, 16, 19, 21, 19, 19, 19, 19, 19, 19,
72
- 19, 19, 19, 19, nil, 22, 21, 21, 21, 21,
73
- 21, 21, 21, 21, 21, 21, 21, 21, 22, 23,
74
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
75
- nil, 24, 23, nil, 23, 23, 23, 23, 23, 23,
76
- 23, 23, 23, 23, 24, 26, 24, 24, 24, 24,
77
- 24, 24, 24, 24, 24, 24, nil, 27, 26, nil,
78
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
79
- 27, 28, 27, 27, 27, 27, 27, 27, 27, 27,
80
- 27, 27, nil, 29, 28, nil, 28, 28, 28, 28,
81
- 28, 28, 28, 28, 28, 28, 29, 30, 29, 29,
82
- 29, 29, 29, 29, 29, 29, 29, 29, nil, 31,
83
- 30, nil, 30, 30, 30, 30, 30, 30, 30, 30,
84
- 30, 30, 31, nil, 31, 31, 31, 31, 31, 31,
85
- 31, 31, 31, 31, 36, 36, 36, 36, 36, 36,
86
- nil, nil, nil, nil, nil, 36, nil, 36, 36, 36,
87
- 36, 36, nil, 36, 40, 40, 40, 40, 40, 40,
88
- 48, 48, 48, 48, nil, nil, nil, 40, 40, 40,
89
- 40, 40, nil, 48, 48, 48, 48, 48, 50, 50,
90
- 50, 50, nil, nil, nil, 9, 9, 9, 9, 9,
91
- 9, 50, 50, 50, 50, 50, 9, 9, 9, 9,
92
- 9, 9, 9, 38, 38, 38, 38, 38, 38, nil,
93
- nil, nil, nil, nil, 38, nil, 38, 38, 38, 38,
94
- 38, 49, 49, 49, 49, 49, 49, nil, nil, nil,
95
- nil, nil, 49, nil, 49, 49, 49, 49, 49, 51,
96
- 51, 51, 51, 51, 51, 42, nil, nil, nil, nil,
97
- 51, nil, 51, 51, 51, 51, 51, nil, 42, 42,
98
- 42, 42, 42, 43, 43, 43, 43, 43, 43, 44,
99
- 44, nil, nil, nil, 43, nil, 43, 43, 43, 43,
100
- 43, nil, 44, 44, 44, 44, 44, 45, 45, 45,
101
- 45, 45, 45, 46, 46, nil, nil, nil, 45, nil,
102
- 45, 45, 45, 45, 45, nil, 46, 46, 46, 46,
103
- 46, 47, 47, 47, 47, 47, 47, nil, nil, nil,
104
- nil, nil, 47, nil, 47, 47, 47, 47, 47, 55,
105
- 55, 55, 55, 55, 55, nil, nil, nil, nil, nil,
106
- 55, nil, 55, 55, 55, 55, 55 ]
107
-
108
- racc_action_pointer = [
109
- nil, 9, 17, 8, -14, nil, nil, nil, nil, 292,
110
- nil, nil, nil, nil, nil, nil, 69, nil, nil, 81,
111
- nil, 95, 107, 121, 133, nil, 147, 159, 173, 185,
112
- 199, 211, 55, 43, -8, -14, 241, nil, 310, -21,
113
- 261, 11, 352, 370, 376, 394, 400, 418, 267, 328,
114
- 285, 346, nil, 29, nil, 436 ]
115
-
116
- racc_action_default = [
117
- -2, -35, -1, -35, -20, -21, -22, -23, -4, -35,
118
- -24, -17, -30, -25, -26, -27, -35, -28, -29, -35,
119
- 56, -35, -35, -35, -35, -3, -35, -35, -35, -35,
120
- -35, -35, -35, -35, -35, -19, -35, -32, -33, -35,
121
- -16, -9, -10, -11, -7, -12, -8, -13, -5, -14,
122
- -6, -15, -18, -35, -31, -34 ]
123
-
124
- racc_goto_table = [
125
- 9, 1, 2, 39, nil, nil, nil, nil, nil, nil,
126
- nil, nil, nil, nil, 35, nil, nil, 36, nil, 38,
127
- 40, 41, 42, nil, 43, 44, 45, 46, 47, 48,
128
- 49, 50, 51, nil, nil, nil, nil, nil, nil, nil,
129
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
130
- nil, 55 ]
131
-
132
- racc_goto_check = [
133
- 3, 1, 2, 6, nil, nil, nil, nil, nil, nil,
134
- nil, nil, nil, nil, 3, nil, nil, 3, nil, 3,
135
- 3, 3, 3, nil, 3, 3, 3, 3, 3, 3,
136
- 3, 3, 3, nil, nil, nil, nil, nil, nil, nil,
137
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
138
- nil, 3 ]
139
-
140
- racc_goto_pointer = [
141
- nil, 1, 2, -2, nil, nil, -18 ]
142
-
143
- racc_goto_default = [
144
- nil, nil, nil, nil, 11, 12, nil ]
145
-
146
- racc_reduce_table = [
147
- 0, 0, :racc_error,
148
- 1, 35, :_reduce_none,
149
- 0, 36, :_reduce_2,
150
- 3, 36, :_reduce_3,
151
- 2, 36, :_reduce_none,
152
- 3, 37, :_reduce_5,
153
- 3, 37, :_reduce_6,
154
- 3, 37, :_reduce_7,
155
- 3, 37, :_reduce_8,
156
- 3, 37, :_reduce_9,
157
- 3, 37, :_reduce_10,
158
- 3, 37, :_reduce_11,
159
- 3, 37, :_reduce_12,
160
- 3, 37, :_reduce_13,
161
- 3, 37, :_reduce_14,
162
- 3, 37, :_reduce_15,
163
- 3, 37, :_reduce_16,
164
- 1, 37, :_reduce_none,
165
- 3, 38, :_reduce_18,
166
- 2, 38, :_reduce_19,
167
- 1, 38, :_reduce_none,
168
- 1, 38, :_reduce_21,
169
- 1, 38, :_reduce_22,
170
- 1, 38, :_reduce_23,
171
- 1, 38, :_reduce_24,
172
- 1, 38, :_reduce_25,
173
- 1, 38, :_reduce_26,
174
- 1, 38, :_reduce_27,
175
- 1, 38, :_reduce_28,
176
- 1, 38, :_reduce_29,
177
- 1, 38, :_reduce_none,
178
- 4, 39, :_reduce_31,
179
- 3, 39, :_reduce_32,
180
- 1, 40, :_reduce_33,
181
- 3, 40, :_reduce_34 ]
182
-
183
- racc_reduce_n = 35
184
-
185
- racc_shift_n = 56
186
-
187
- racc_token_table = {
188
- false => 0,
189
- :error => 1,
190
- :UMINUS => 2,
191
- "^" => 3,
192
- "&" => 4,
193
- "*" => 5,
194
- "/" => 6,
195
- "+" => 7,
196
- "-" => 8,
197
- "<" => 9,
198
- ">" => 10,
199
- "<=" => 11,
200
- ">=" => 12,
201
- "<>" => 13,
202
- "=" => 14,
203
- :EOL => 15,
204
- :LT => 16,
205
- :GT => 17,
206
- :LE => 18,
207
- :GE => 19,
208
- :NE => 20,
209
- "(" => 21,
210
- ")" => 22,
211
- :FUNC => 23,
212
- :NUMBER => 24,
213
- :STRING => 25,
214
- :REF2D => 26,
215
- :REF3D => 27,
216
- :RANGE2D => 28,
217
- :RANGE3D => 29,
218
- :NAME => 30,
219
- :TRUE => 31,
220
- :FALSE => 32,
221
- "," => 33 }
222
-
223
- racc_nt_base = 34
224
-
225
- racc_use_result_var = true
226
-
227
- Racc_arg = [
228
- racc_action_table,
229
- racc_action_check,
230
- racc_action_default,
231
- racc_action_pointer,
232
- racc_goto_table,
233
- racc_goto_check,
234
- racc_goto_default,
235
- racc_goto_pointer,
236
- racc_nt_base,
237
- racc_reduce_table,
238
- racc_token_table,
239
- racc_shift_n,
240
- racc_reduce_n,
241
- racc_use_result_var ]
242
-
243
- Racc_token_to_s_table = [
244
- "$end",
245
- "error",
246
- "UMINUS",
247
- "\"^\"",
248
- "\"&\"",
249
- "\"*\"",
250
- "\"/\"",
251
- "\"+\"",
252
- "\"-\"",
253
- "\"<\"",
254
- "\">\"",
255
- "\"<=\"",
256
- "\">=\"",
257
- "\"<>\"",
258
- "\"=\"",
259
- "EOL",
260
- "LT",
261
- "GT",
262
- "LE",
263
- "GE",
264
- "NE",
265
- "\"(\"",
266
- "\")\"",
267
- "FUNC",
268
- "NUMBER",
269
- "STRING",
270
- "REF2D",
271
- "REF3D",
272
- "RANGE2D",
273
- "RANGE3D",
274
- "NAME",
275
- "TRUE",
276
- "FALSE",
277
- "\",\"",
278
- "$start",
279
- "formula",
280
- "expr_list",
281
- "expr",
282
- "primary",
283
- "funcall",
284
- "args" ]
285
-
286
- Racc_debug_parser = false
287
-
288
- ##### State transition tables end #####
289
-
290
- # reduce 0 omitted
291
-
292
- # reduce 1 omitted
293
-
294
- module_eval(<<'.,.,', 'excelformula.y', 20)
295
- def _reduce_2(val, _values, result)
296
- result = []
297
- result
298
- end
299
- .,.,
300
-
301
- module_eval(<<'.,.,', 'excelformula.y', 21)
302
- def _reduce_3(val, _values, result)
303
- result.push val[1], '_arg', '1'
304
- result
305
- end
306
- .,.,
307
-
308
- # reduce 4 omitted
309
-
310
- module_eval(<<'.,.,', 'excelformula.y', 24)
311
- def _reduce_5(val, _values, result)
312
- result = [ val[0], val[2], 'ptgAdd' ]
313
- result
314
- end
315
- .,.,
316
-
317
- module_eval(<<'.,.,', 'excelformula.y', 25)
318
- def _reduce_6(val, _values, result)
319
- result = [ val[0], val[2], 'ptgSub' ]
320
- result
321
- end
322
- .,.,
323
-
324
- module_eval(<<'.,.,', 'excelformula.y', 26)
325
- def _reduce_7(val, _values, result)
326
- result = [ val[0], val[2], 'ptgMul' ]
327
- result
328
- end
329
- .,.,
330
-
331
- module_eval(<<'.,.,', 'excelformula.y', 27)
332
- def _reduce_8(val, _values, result)
333
- result = [ val[0], val[2], 'ptgDiv' ]
334
- result
335
- end
336
- .,.,
337
-
338
- module_eval(<<'.,.,', 'excelformula.y', 28)
339
- def _reduce_9(val, _values, result)
340
- result = [ val[0], val[2], 'ptgPower' ]
341
- result
342
- end
343
- .,.,
344
-
345
- module_eval(<<'.,.,', 'excelformula.y', 29)
346
- def _reduce_10(val, _values, result)
347
- result = [ val[0], val[2], 'ptgConcat' ]
348
- result
349
- end
350
- .,.,
351
-
352
- module_eval(<<'.,.,', 'excelformula.y', 30)
353
- def _reduce_11(val, _values, result)
354
- result = [ val[0], val[2], 'ptgLT' ]
355
- result
356
- end
357
- .,.,
358
-
359
- module_eval(<<'.,.,', 'excelformula.y', 31)
360
- def _reduce_12(val, _values, result)
361
- result = [ val[0], val[2], 'ptgGT' ]
362
- result
363
- end
364
- .,.,
365
-
366
- module_eval(<<'.,.,', 'excelformula.y', 32)
367
- def _reduce_13(val, _values, result)
368
- result = [ val[0], val[2], 'ptgLE' ]
369
- result
370
- end
371
- .,.,
372
-
373
- module_eval(<<'.,.,', 'excelformula.y', 33)
374
- def _reduce_14(val, _values, result)
375
- result = [ val[0], val[2], 'ptgGE' ]
376
- result
377
- end
378
- .,.,
379
-
380
- module_eval(<<'.,.,', 'excelformula.y', 34)
381
- def _reduce_15(val, _values, result)
382
- result = [ val[0], val[2], 'ptgNE' ]
383
- result
384
- end
385
- .,.,
386
-
387
- module_eval(<<'.,.,', 'excelformula.y', 35)
388
- def _reduce_16(val, _values, result)
389
- result = [ val[0], val[2], 'ptgEQ' ]
390
- result
391
- end
392
- .,.,
393
-
394
- # reduce 17 omitted
395
-
396
- module_eval(<<'.,.,', 'excelformula.y', 38)
397
- def _reduce_18(val, _values, result)
398
- result = [ val[1], '_arg', '1', 'ptgParen']
399
- result
400
- end
401
- .,.,
402
-
403
- module_eval(<<'.,.,', 'excelformula.y', 39)
404
- def _reduce_19(val, _values, result)
405
- result = [ '_num', '-1', val[1], 'ptgMul' ]
406
- result
407
- end
408
- .,.,
409
-
410
- # reduce 20 omitted
411
-
412
- module_eval(<<'.,.,', 'excelformula.y', 41)
413
- def _reduce_21(val, _values, result)
414
- result = [ '_num', val[0] ]
415
- result
416
- end
417
- .,.,
418
-
419
- module_eval(<<'.,.,', 'excelformula.y', 42)
420
- def _reduce_22(val, _values, result)
421
- result = [ '_str', val[0] ]
422
- result
423
- end
424
- .,.,
425
-
426
- module_eval(<<'.,.,', 'excelformula.y', 43)
427
- def _reduce_23(val, _values, result)
428
- result = [ '_ref2d', val[0] ]
429
- result
430
- end
431
- .,.,
432
-
433
- module_eval(<<'.,.,', 'excelformula.y', 44)
434
- def _reduce_24(val, _values, result)
435
- result = [ '_ref3d', val[0] ]
436
- result
437
- end
438
- .,.,
439
-
440
- module_eval(<<'.,.,', 'excelformula.y', 45)
441
- def _reduce_25(val, _values, result)
442
- result = [ '_range2d', val[0] ]
443
- result
444
- end
445
- .,.,
446
-
447
- module_eval(<<'.,.,', 'excelformula.y', 46)
448
- def _reduce_26(val, _values, result)
449
- result = [ '_range3d', val[0] ]
450
- result
451
- end
452
- .,.,
453
-
454
- module_eval(<<'.,.,', 'excelformula.y', 47)
455
- def _reduce_27(val, _values, result)
456
- result = [ '_name', val[0] ]
457
- result
458
- end
459
- .,.,
460
-
461
- module_eval(<<'.,.,', 'excelformula.y', 48)
462
- def _reduce_28(val, _values, result)
463
- result = [ 'ptgBool', '1' ]
464
- result
465
- end
466
- .,.,
467
-
468
- module_eval(<<'.,.,', 'excelformula.y', 49)
469
- def _reduce_29(val, _values, result)
470
- result = [ 'ptgBool', '0' ]
471
- result
472
- end
473
- .,.,
474
-
475
- # reduce 30 omitted
476
-
477
- module_eval(<<'.,.,', 'excelformula.y', 52)
478
- def _reduce_31(val, _values, result)
479
- result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
480
- result
481
- end
482
- .,.,
483
-
484
- module_eval(<<'.,.,', 'excelformula.y', 53)
485
- def _reduce_32(val, _values, result)
486
- result = [ '_func', val[0] ]
487
- result
488
- end
489
- .,.,
490
-
491
- module_eval(<<'.,.,', 'excelformula.y', 55)
492
- def _reduce_33(val, _values, result)
493
- result = val
494
- result
495
- end
496
- .,.,
497
-
498
- module_eval(<<'.,.,', 'excelformula.y', 56)
499
- def _reduce_34(val, _values, result)
500
- result.push val[2]
501
- result
502
- end
503
- .,.,
504
-
505
- def _reduce_none(val, _values, result)
506
- val[0]
507
- end
508
-
509
- end # class ExcelFormulaParser
510
-
511
-
512
- class ExcelFormulaParserError < StandardError #:nodoc:
513
- end
514
-
515
- class Node # :nodoc:
516
-
517
- def exec_list(nodes)
518
- v = nil
519
- nodes.each { |i| v = i.evaluate }
520
- v
521
- end
522
-
523
- def excelformulaparser_error(msg)
524
- raise ExcelFormulaParserError,
525
- "in #{fname}:#{lineno}: #{msg}"
526
- end
527
-
528
- end
529
-
530
- class RootNode < Node # :nodoc:
531
-
532
- def initialize(tree)
533
- @tree = tree
534
- end
535
-
536
- def evaluate
537
- exec_list @tree
538
- end
539
-
540
- end
541
-
542
-
543
- class FuncallNode < Node # :nodoc:
544
-
545
- def initialize(func, args)
546
- @func = func
547
- @args = args
548
- end
549
-
550
- def evaluate
551
- arg = @args.collect {|i| i.evaluate }
552
- out = []
553
- arg.each { |i| o.push i }
554
- o.push @func
555
- p o
556
- end
557
-
558
- end
559
-
560
- class NumberNode < Node # :nodoc:
561
-
562
- def initialize(val)
563
- @val = val
564
- end
565
-
566
- def evaluate
567
- p @val
568
- end
569
-
570
- end
571
-
572
- class OperateNode < Node # :nodoc:
573
-
574
- def initialize(op, left, right)
575
- @op = op
576
- @left = left
577
- @right = right
578
- end
579
-
580
- def evaluate
581
- o = []
582
- o.push @left
583
- o.push @right
584
- o.push @op
585
- p o
586
- end
587
- end
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # DO NOT MODIFY!!!!
4
+ # This file is automatically generated by Racc 1.4.6
5
+ # from Racc grammer file "".
6
+ #
7
+
8
+ require 'racc/parser.rb'
9
+ class ExcelFormulaParser < Racc::Parser # :nodoc:
10
+ ##### State transition tables begin ###
11
+
12
+ racc_action_table = [
13
+ 16, 54, 26, 28, 30, 32, 34, 21, 20, 3,
14
+ nil, nil, 53, 19, 23, 4, 5, 6, 7, 10,
15
+ 13, 14, 15, 17, 18, 16, nil, 26, 28, 30,
16
+ 32, 34, 8, nil, nil, nil, nil, 16, 19, nil,
17
+ 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
18
+ 19, 16, 4, 5, 6, 7, 10, 13, 14, 15,
19
+ 17, 18, nil, 16, 19, nil, 4, 5, 6, 7,
20
+ 10, 13, 14, 15, 17, 18, 19, 16, 4, 5,
21
+ 6, 7, 10, 13, 14, 15, 17, 18, nil, 16,
22
+ 19, nil, 4, 5, 6, 7, 10, 13, 14, 15,
23
+ 17, 18, 19, 16, 4, 5, 6, 7, 10, 13,
24
+ 14, 15, 17, 18, nil, 16, 19, 37, 4, 5,
25
+ 6, 7, 10, 13, 14, 15, 17, 18, 19, 16,
26
+ 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
27
+ nil, 16, 19, nil, 4, 5, 6, 7, 10, 13,
28
+ 14, 15, 17, 18, 19, 16, 4, 5, 6, 7,
29
+ 10, 13, 14, 15, 17, 18, nil, 16, 19, nil,
30
+ 4, 5, 6, 7, 10, 13, 14, 15, 17, 18,
31
+ 19, 16, 4, 5, 6, 7, 10, 13, 14, 15,
32
+ 17, 18, nil, 16, 19, nil, 4, 5, 6, 7,
33
+ 10, 13, 14, 15, 17, 18, 19, 16, 4, 5,
34
+ 6, 7, 10, 13, 14, 15, 17, 18, nil, 16,
35
+ 19, nil, 4, 5, 6, 7, 10, 13, 14, 15,
36
+ 17, 18, 19, nil, 4, 5, 6, 7, 10, 13,
37
+ 14, 15, 17, 18, 23, 24, 27, 29, 31, 33,
38
+ nil, nil, nil, nil, nil, 22, nil, 26, 28, 30,
39
+ 32, 34, nil, 52, 23, 24, 27, 29, 31, 33,
40
+ 23, 24, 27, 29, nil, nil, nil, 26, 28, 30,
41
+ 32, 34, nil, 26, 28, 30, 32, 34, 23, 24,
42
+ 27, 29, nil, nil, nil, 23, 24, 27, 29, 31,
43
+ 33, 26, 28, 30, 32, 34, 22, 25, 26, 28,
44
+ 30, 32, 34, 23, 24, 27, 29, 31, 33, nil,
45
+ nil, nil, nil, nil, 22, nil, 26, 28, 30, 32,
46
+ 34, 23, 24, 27, 29, 31, 33, nil, nil, nil,
47
+ nil, nil, 22, nil, 26, 28, 30, 32, 34, 23,
48
+ 24, 27, 29, 31, 33, 23, nil, nil, nil, nil,
49
+ 22, nil, 26, 28, 30, 32, 34, nil, 26, 28,
50
+ 30, 32, 34, 23, 24, 27, 29, 31, 33, 23,
51
+ 24, nil, nil, nil, 22, nil, 26, 28, 30, 32,
52
+ 34, nil, 26, 28, 30, 32, 34, 23, 24, 27,
53
+ 29, 31, 33, 23, 24, nil, nil, nil, 22, nil,
54
+ 26, 28, 30, 32, 34, nil, 26, 28, 30, 32,
55
+ 34, 23, 24, 27, 29, 31, 33, nil, nil, nil,
56
+ nil, nil, 22, nil, 26, 28, 30, 32, 34, 23,
57
+ 24, 27, 29, 31, 33, nil, nil, nil, nil, nil,
58
+ 22, nil, 26, 28, 30, 32, 34 ]
59
+
60
+ racc_action_check = [
61
+ 34, 39, 35, 35, 35, 35, 35, 4, 3, 1,
62
+ nil, nil, 39, 34, 41, 34, 34, 34, 34, 34,
63
+ 34, 34, 34, 34, 34, 2, nil, 41, 41, 41,
64
+ 41, 41, 2, nil, nil, nil, nil, 53, 2, nil,
65
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
66
+ 53, 33, 53, 53, 53, 53, 53, 53, 53, 53,
67
+ 53, 53, nil, 32, 33, nil, 33, 33, 33, 33,
68
+ 33, 33, 33, 33, 33, 33, 32, 16, 32, 32,
69
+ 32, 32, 32, 32, 32, 32, 32, 32, nil, 19,
70
+ 16, nil, 16, 16, 16, 16, 16, 16, 16, 16,
71
+ 16, 16, 19, 21, 19, 19, 19, 19, 19, 19,
72
+ 19, 19, 19, 19, nil, 22, 21, 21, 21, 21,
73
+ 21, 21, 21, 21, 21, 21, 21, 21, 22, 23,
74
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
75
+ nil, 24, 23, nil, 23, 23, 23, 23, 23, 23,
76
+ 23, 23, 23, 23, 24, 26, 24, 24, 24, 24,
77
+ 24, 24, 24, 24, 24, 24, nil, 27, 26, nil,
78
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
79
+ 27, 28, 27, 27, 27, 27, 27, 27, 27, 27,
80
+ 27, 27, nil, 29, 28, nil, 28, 28, 28, 28,
81
+ 28, 28, 28, 28, 28, 28, 29, 30, 29, 29,
82
+ 29, 29, 29, 29, 29, 29, 29, 29, nil, 31,
83
+ 30, nil, 30, 30, 30, 30, 30, 30, 30, 30,
84
+ 30, 30, 31, nil, 31, 31, 31, 31, 31, 31,
85
+ 31, 31, 31, 31, 36, 36, 36, 36, 36, 36,
86
+ nil, nil, nil, nil, nil, 36, nil, 36, 36, 36,
87
+ 36, 36, nil, 36, 40, 40, 40, 40, 40, 40,
88
+ 48, 48, 48, 48, nil, nil, nil, 40, 40, 40,
89
+ 40, 40, nil, 48, 48, 48, 48, 48, 50, 50,
90
+ 50, 50, nil, nil, nil, 9, 9, 9, 9, 9,
91
+ 9, 50, 50, 50, 50, 50, 9, 9, 9, 9,
92
+ 9, 9, 9, 38, 38, 38, 38, 38, 38, nil,
93
+ nil, nil, nil, nil, 38, nil, 38, 38, 38, 38,
94
+ 38, 49, 49, 49, 49, 49, 49, nil, nil, nil,
95
+ nil, nil, 49, nil, 49, 49, 49, 49, 49, 51,
96
+ 51, 51, 51, 51, 51, 42, nil, nil, nil, nil,
97
+ 51, nil, 51, 51, 51, 51, 51, nil, 42, 42,
98
+ 42, 42, 42, 43, 43, 43, 43, 43, 43, 44,
99
+ 44, nil, nil, nil, 43, nil, 43, 43, 43, 43,
100
+ 43, nil, 44, 44, 44, 44, 44, 45, 45, 45,
101
+ 45, 45, 45, 46, 46, nil, nil, nil, 45, nil,
102
+ 45, 45, 45, 45, 45, nil, 46, 46, 46, 46,
103
+ 46, 47, 47, 47, 47, 47, 47, nil, nil, nil,
104
+ nil, nil, 47, nil, 47, 47, 47, 47, 47, 55,
105
+ 55, 55, 55, 55, 55, nil, nil, nil, nil, nil,
106
+ 55, nil, 55, 55, 55, 55, 55 ]
107
+
108
+ racc_action_pointer = [
109
+ nil, 9, 17, 8, -14, nil, nil, nil, nil, 292,
110
+ nil, nil, nil, nil, nil, nil, 69, nil, nil, 81,
111
+ nil, 95, 107, 121, 133, nil, 147, 159, 173, 185,
112
+ 199, 211, 55, 43, -8, -14, 241, nil, 310, -21,
113
+ 261, 11, 352, 370, 376, 394, 400, 418, 267, 328,
114
+ 285, 346, nil, 29, nil, 436 ]
115
+
116
+ racc_action_default = [
117
+ -2, -35, -1, -35, -20, -21, -22, -23, -4, -35,
118
+ -24, -17, -30, -25, -26, -27, -35, -28, -29, -35,
119
+ 56, -35, -35, -35, -35, -3, -35, -35, -35, -35,
120
+ -35, -35, -35, -35, -35, -19, -35, -32, -33, -35,
121
+ -16, -9, -10, -11, -7, -12, -8, -13, -5, -14,
122
+ -6, -15, -18, -35, -31, -34 ]
123
+
124
+ racc_goto_table = [
125
+ 9, 1, 2, 39, nil, nil, nil, nil, nil, nil,
126
+ nil, nil, nil, nil, 35, nil, nil, 36, nil, 38,
127
+ 40, 41, 42, nil, 43, 44, 45, 46, 47, 48,
128
+ 49, 50, 51, nil, nil, nil, nil, nil, nil, nil,
129
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
130
+ nil, 55 ]
131
+
132
+ racc_goto_check = [
133
+ 3, 1, 2, 6, nil, nil, nil, nil, nil, nil,
134
+ nil, nil, nil, nil, 3, nil, nil, 3, nil, 3,
135
+ 3, 3, 3, nil, 3, 3, 3, 3, 3, 3,
136
+ 3, 3, 3, nil, nil, nil, nil, nil, nil, nil,
137
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
138
+ nil, 3 ]
139
+
140
+ racc_goto_pointer = [
141
+ nil, 1, 2, -2, nil, nil, -18 ]
142
+
143
+ racc_goto_default = [
144
+ nil, nil, nil, nil, 11, 12, nil ]
145
+
146
+ racc_reduce_table = [
147
+ 0, 0, :racc_error,
148
+ 1, 35, :_reduce_none,
149
+ 0, 36, :_reduce_2,
150
+ 3, 36, :_reduce_3,
151
+ 2, 36, :_reduce_none,
152
+ 3, 37, :_reduce_5,
153
+ 3, 37, :_reduce_6,
154
+ 3, 37, :_reduce_7,
155
+ 3, 37, :_reduce_8,
156
+ 3, 37, :_reduce_9,
157
+ 3, 37, :_reduce_10,
158
+ 3, 37, :_reduce_11,
159
+ 3, 37, :_reduce_12,
160
+ 3, 37, :_reduce_13,
161
+ 3, 37, :_reduce_14,
162
+ 3, 37, :_reduce_15,
163
+ 3, 37, :_reduce_16,
164
+ 1, 37, :_reduce_none,
165
+ 3, 38, :_reduce_18,
166
+ 2, 38, :_reduce_19,
167
+ 1, 38, :_reduce_none,
168
+ 1, 38, :_reduce_21,
169
+ 1, 38, :_reduce_22,
170
+ 1, 38, :_reduce_23,
171
+ 1, 38, :_reduce_24,
172
+ 1, 38, :_reduce_25,
173
+ 1, 38, :_reduce_26,
174
+ 1, 38, :_reduce_27,
175
+ 1, 38, :_reduce_28,
176
+ 1, 38, :_reduce_29,
177
+ 1, 38, :_reduce_none,
178
+ 4, 39, :_reduce_31,
179
+ 3, 39, :_reduce_32,
180
+ 1, 40, :_reduce_33,
181
+ 3, 40, :_reduce_34 ]
182
+
183
+ racc_reduce_n = 35
184
+
185
+ racc_shift_n = 56
186
+
187
+ racc_token_table = {
188
+ false => 0,
189
+ :error => 1,
190
+ :UMINUS => 2,
191
+ "^" => 3,
192
+ "&" => 4,
193
+ "*" => 5,
194
+ "/" => 6,
195
+ "+" => 7,
196
+ "-" => 8,
197
+ "<" => 9,
198
+ ">" => 10,
199
+ "<=" => 11,
200
+ ">=" => 12,
201
+ "<>" => 13,
202
+ "=" => 14,
203
+ :EOL => 15,
204
+ :LT => 16,
205
+ :GT => 17,
206
+ :LE => 18,
207
+ :GE => 19,
208
+ :NE => 20,
209
+ "(" => 21,
210
+ ")" => 22,
211
+ :FUNC => 23,
212
+ :NUMBER => 24,
213
+ :STRING => 25,
214
+ :REF2D => 26,
215
+ :REF3D => 27,
216
+ :RANGE2D => 28,
217
+ :RANGE3D => 29,
218
+ :NAME => 30,
219
+ :TRUE => 31,
220
+ :FALSE => 32,
221
+ "," => 33 }
222
+
223
+ racc_nt_base = 34
224
+
225
+ racc_use_result_var = true
226
+
227
+ Racc_arg = [
228
+ racc_action_table,
229
+ racc_action_check,
230
+ racc_action_default,
231
+ racc_action_pointer,
232
+ racc_goto_table,
233
+ racc_goto_check,
234
+ racc_goto_default,
235
+ racc_goto_pointer,
236
+ racc_nt_base,
237
+ racc_reduce_table,
238
+ racc_token_table,
239
+ racc_shift_n,
240
+ racc_reduce_n,
241
+ racc_use_result_var ]
242
+
243
+ Racc_token_to_s_table = [
244
+ "$end",
245
+ "error",
246
+ "UMINUS",
247
+ "\"^\"",
248
+ "\"&\"",
249
+ "\"*\"",
250
+ "\"/\"",
251
+ "\"+\"",
252
+ "\"-\"",
253
+ "\"<\"",
254
+ "\">\"",
255
+ "\"<=\"",
256
+ "\">=\"",
257
+ "\"<>\"",
258
+ "\"=\"",
259
+ "EOL",
260
+ "LT",
261
+ "GT",
262
+ "LE",
263
+ "GE",
264
+ "NE",
265
+ "\"(\"",
266
+ "\")\"",
267
+ "FUNC",
268
+ "NUMBER",
269
+ "STRING",
270
+ "REF2D",
271
+ "REF3D",
272
+ "RANGE2D",
273
+ "RANGE3D",
274
+ "NAME",
275
+ "TRUE",
276
+ "FALSE",
277
+ "\",\"",
278
+ "$start",
279
+ "formula",
280
+ "expr_list",
281
+ "expr",
282
+ "primary",
283
+ "funcall",
284
+ "args" ]
285
+
286
+ Racc_debug_parser = false
287
+
288
+ ##### State transition tables end #####
289
+
290
+ # reduce 0 omitted
291
+
292
+ # reduce 1 omitted
293
+
294
+ module_eval(<<'.,.,', 'excelformula.y', 20)
295
+ def _reduce_2(val, _values, result)
296
+ result = []
297
+ result
298
+ end
299
+ .,.,
300
+
301
+ module_eval(<<'.,.,', 'excelformula.y', 21)
302
+ def _reduce_3(val, _values, result)
303
+ result.push val[1], '_arg', '1'
304
+ result
305
+ end
306
+ .,.,
307
+
308
+ # reduce 4 omitted
309
+
310
+ module_eval(<<'.,.,', 'excelformula.y', 24)
311
+ def _reduce_5(val, _values, result)
312
+ result = [ val[0], val[2], 'ptgAdd' ]
313
+ result
314
+ end
315
+ .,.,
316
+
317
+ module_eval(<<'.,.,', 'excelformula.y', 25)
318
+ def _reduce_6(val, _values, result)
319
+ result = [ val[0], val[2], 'ptgSub' ]
320
+ result
321
+ end
322
+ .,.,
323
+
324
+ module_eval(<<'.,.,', 'excelformula.y', 26)
325
+ def _reduce_7(val, _values, result)
326
+ result = [ val[0], val[2], 'ptgMul' ]
327
+ result
328
+ end
329
+ .,.,
330
+
331
+ module_eval(<<'.,.,', 'excelformula.y', 27)
332
+ def _reduce_8(val, _values, result)
333
+ result = [ val[0], val[2], 'ptgDiv' ]
334
+ result
335
+ end
336
+ .,.,
337
+
338
+ module_eval(<<'.,.,', 'excelformula.y', 28)
339
+ def _reduce_9(val, _values, result)
340
+ result = [ val[0], val[2], 'ptgPower' ]
341
+ result
342
+ end
343
+ .,.,
344
+
345
+ module_eval(<<'.,.,', 'excelformula.y', 29)
346
+ def _reduce_10(val, _values, result)
347
+ result = [ val[0], val[2], 'ptgConcat' ]
348
+ result
349
+ end
350
+ .,.,
351
+
352
+ module_eval(<<'.,.,', 'excelformula.y', 30)
353
+ def _reduce_11(val, _values, result)
354
+ result = [ val[0], val[2], 'ptgLT' ]
355
+ result
356
+ end
357
+ .,.,
358
+
359
+ module_eval(<<'.,.,', 'excelformula.y', 31)
360
+ def _reduce_12(val, _values, result)
361
+ result = [ val[0], val[2], 'ptgGT' ]
362
+ result
363
+ end
364
+ .,.,
365
+
366
+ module_eval(<<'.,.,', 'excelformula.y', 32)
367
+ def _reduce_13(val, _values, result)
368
+ result = [ val[0], val[2], 'ptgLE' ]
369
+ result
370
+ end
371
+ .,.,
372
+
373
+ module_eval(<<'.,.,', 'excelformula.y', 33)
374
+ def _reduce_14(val, _values, result)
375
+ result = [ val[0], val[2], 'ptgGE' ]
376
+ result
377
+ end
378
+ .,.,
379
+
380
+ module_eval(<<'.,.,', 'excelformula.y', 34)
381
+ def _reduce_15(val, _values, result)
382
+ result = [ val[0], val[2], 'ptgNE' ]
383
+ result
384
+ end
385
+ .,.,
386
+
387
+ module_eval(<<'.,.,', 'excelformula.y', 35)
388
+ def _reduce_16(val, _values, result)
389
+ result = [ val[0], val[2], 'ptgEQ' ]
390
+ result
391
+ end
392
+ .,.,
393
+
394
+ # reduce 17 omitted
395
+
396
+ module_eval(<<'.,.,', 'excelformula.y', 38)
397
+ def _reduce_18(val, _values, result)
398
+ result = [ val[1], '_arg', '1', 'ptgParen']
399
+ result
400
+ end
401
+ .,.,
402
+
403
+ module_eval(<<'.,.,', 'excelformula.y', 39)
404
+ def _reduce_19(val, _values, result)
405
+ result = [ '_num', '-1', val[1], 'ptgMul' ]
406
+ result
407
+ end
408
+ .,.,
409
+
410
+ # reduce 20 omitted
411
+
412
+ module_eval(<<'.,.,', 'excelformula.y', 41)
413
+ def _reduce_21(val, _values, result)
414
+ result = [ '_num', val[0] ]
415
+ result
416
+ end
417
+ .,.,
418
+
419
+ module_eval(<<'.,.,', 'excelformula.y', 42)
420
+ def _reduce_22(val, _values, result)
421
+ result = [ '_str', val[0] ]
422
+ result
423
+ end
424
+ .,.,
425
+
426
+ module_eval(<<'.,.,', 'excelformula.y', 43)
427
+ def _reduce_23(val, _values, result)
428
+ result = [ '_ref2d', val[0] ]
429
+ result
430
+ end
431
+ .,.,
432
+
433
+ module_eval(<<'.,.,', 'excelformula.y', 44)
434
+ def _reduce_24(val, _values, result)
435
+ result = [ '_ref3d', val[0] ]
436
+ result
437
+ end
438
+ .,.,
439
+
440
+ module_eval(<<'.,.,', 'excelformula.y', 45)
441
+ def _reduce_25(val, _values, result)
442
+ result = [ '_range2d', val[0] ]
443
+ result
444
+ end
445
+ .,.,
446
+
447
+ module_eval(<<'.,.,', 'excelformula.y', 46)
448
+ def _reduce_26(val, _values, result)
449
+ result = [ '_range3d', val[0] ]
450
+ result
451
+ end
452
+ .,.,
453
+
454
+ module_eval(<<'.,.,', 'excelformula.y', 47)
455
+ def _reduce_27(val, _values, result)
456
+ result = [ '_name', val[0] ]
457
+ result
458
+ end
459
+ .,.,
460
+
461
+ module_eval(<<'.,.,', 'excelformula.y', 48)
462
+ def _reduce_28(val, _values, result)
463
+ result = [ 'ptgBool', '1' ]
464
+ result
465
+ end
466
+ .,.,
467
+
468
+ module_eval(<<'.,.,', 'excelformula.y', 49)
469
+ def _reduce_29(val, _values, result)
470
+ result = [ 'ptgBool', '0' ]
471
+ result
472
+ end
473
+ .,.,
474
+
475
+ # reduce 30 omitted
476
+
477
+ module_eval(<<'.,.,', 'excelformula.y', 52)
478
+ def _reduce_31(val, _values, result)
479
+ result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
480
+ result
481
+ end
482
+ .,.,
483
+
484
+ module_eval(<<'.,.,', 'excelformula.y', 53)
485
+ def _reduce_32(val, _values, result)
486
+ result = [ '_func', val[0] ]
487
+ result
488
+ end
489
+ .,.,
490
+
491
+ module_eval(<<'.,.,', 'excelformula.y', 55)
492
+ def _reduce_33(val, _values, result)
493
+ result = val
494
+ result
495
+ end
496
+ .,.,
497
+
498
+ module_eval(<<'.,.,', 'excelformula.y', 56)
499
+ def _reduce_34(val, _values, result)
500
+ result.push val[2]
501
+ result
502
+ end
503
+ .,.,
504
+
505
+ def _reduce_none(val, _values, result)
506
+ val[0]
507
+ end
508
+
509
+ end # class ExcelFormulaParser
510
+
511
+
512
+ class ExcelFormulaParserError < StandardError #:nodoc:
513
+ end
514
+
515
+ class Node # :nodoc:
516
+
517
+ def exec_list(nodes)
518
+ v = nil
519
+ nodes.each { |i| v = i.evaluate }
520
+ v
521
+ end
522
+
523
+ def excelformulaparser_error(msg)
524
+ raise ExcelFormulaParserError,
525
+ "in #{fname}:#{lineno}: #{msg}"
526
+ end
527
+
528
+ end
529
+
530
+ class RootNode < Node # :nodoc:
531
+
532
+ def initialize(tree)
533
+ @tree = tree
534
+ end
535
+
536
+ def evaluate
537
+ exec_list @tree
538
+ end
539
+
540
+ end
541
+
542
+
543
+ class FuncallNode < Node # :nodoc:
544
+
545
+ def initialize(func, args)
546
+ @func = func
547
+ @args = args
548
+ end
549
+
550
+ def evaluate
551
+ arg = @args.collect {|i| i.evaluate }
552
+ out = []
553
+ arg.each { |i| o.push i }
554
+ o.push @func
555
+ p o
556
+ end
557
+
558
+ end
559
+
560
+ class NumberNode < Node # :nodoc:
561
+
562
+ def initialize(val)
563
+ @val = val
564
+ end
565
+
566
+ def evaluate
567
+ p @val
568
+ end
569
+
570
+ end
571
+
572
+ class OperateNode < Node # :nodoc:
573
+
574
+ def initialize(op, left, right)
575
+ @op = op
576
+ @left = left
577
+ @right = right
578
+ end
579
+
580
+ def evaluate
581
+ o = []
582
+ o.push @left
583
+ o.push @right
584
+ o.push @op
585
+ p o
586
+ end
587
+ end