writeexcel 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -1,139 +1,139 @@
1
- #
2
- # copyright (c) 2009, 2010 Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
3
-
4
-
5
- class ExcelFormulaParser
6
-
7
- prechigh
8
- nonassoc UMINUS
9
- right '^'
10
- left '&'
11
- left '*' '/'
12
- left '+' '-'
13
- left '<' '>' '<=' '>=' '<>'
14
- left '='
15
- preclow
16
-
17
- rule
18
-
19
- formula : expr_list
20
-
21
- expr_list : { result = [] }
22
- | expr_list expr EOL { result.push val[1], '_arg', '1' }
23
- | expr_list EOL
24
-
25
- expr : expr '+' expr { result = [ val[0], val[2], 'ptgAdd' ] }
26
- | expr '-' expr { result = [ val[0], val[2], 'ptgSub' ] }
27
- | expr '*' expr { result = [ val[0], val[2], 'ptgMul' ] }
28
- | expr '/' expr { result = [ val[0], val[2], 'ptgDiv' ] }
29
- | expr '^' expr { result = [ val[0], val[2], 'ptgPower' ] }
30
- | expr '&' expr { result = [ val[0], val[2], 'ptgConcat' ] }
31
- | expr LT expr { result = [ val[0], val[2], 'ptgLT' ] }
32
- | expr GT expr { result = [ val[0], val[2], 'ptgGT' ] }
33
- | expr LE expr { result = [ val[0], val[2], 'ptgLE' ] }
34
- | expr GE expr { result = [ val[0], val[2], 'ptgGE' ] }
35
- | expr NE expr { result = [ val[0], val[2], 'ptgNE' ] }
36
- | expr '=' expr { result = [ val[0], val[2], 'ptgEQ' ] }
37
- | primary
38
-
39
- primary : '(' expr ')' { result = [ val[1], '_arg', '1', 'ptgParen'] }
40
- | '-' expr = UMINUS { result = [ '_num', '-1', val[1], 'ptgMul' ] }
41
- | FUNC
42
- | NUMBER { result = [ '_num', val[0] ] }
43
- | STRING { result = [ '_str', val[0] ] }
44
- | REF2D { result = [ '_ref2d', val[0] ] }
45
- | REF3D { result = [ '_ref3d', val[0] ] }
46
- | RANGE2D { result = [ '_range2d', val[0] ] }
47
- | RANGE3D { result = [ '_range3d', val[0] ] }
48
- | NAME { result = [ '_name', val[0] ] }
49
- | TRUE { result = [ 'ptgBool', '1' ] }
50
- | FALSE { result = [ 'ptgBool', '0' ] }
51
- | funcall
52
-
53
- funcall : FUNC '(' args ')' { result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ] }
54
- | FUNC '(' ')' { result = [ '_func', val[0] ] }
55
-
56
- args : expr { result = val }
57
- | args ',' expr { result.push val[2] }
58
-
59
- end
60
-
61
-
62
- ---- footer
63
-
64
- class ExcelFormulaParserError < StandardError; end
65
-
66
- class Node
67
-
68
- def exec_list(nodes)
69
- v = nil
70
- nodes.each { |i| v = i.evaluate }
71
- v
72
- end
73
-
74
- def excelformulaparser_error(msg)
75
- raise ExcelFormulaParserError,
76
- "in #{fname}:#{lineno}: #{msg}"
77
- end
78
-
79
- end
80
-
81
- class RootNode < Node
82
-
83
- def initialize(tree)
84
- @tree = tree
85
- end
86
-
87
- def evaluate
88
- exec_list @tree
89
- end
90
-
91
- end
92
-
93
-
94
- class FuncallNode < Node
95
-
96
- def initialize(func, args)
97
- @func = func
98
- @args = args
99
- end
100
-
101
- def evaluate
102
- arg = @args.collect {|i| i.evaluate }
103
- out = []
104
- arg.each { |i| o.push i }
105
- o.push @func
106
- p o
107
- end
108
-
109
- end
110
-
111
- class NumberNode < Node
112
-
113
- def initialize(val)
114
- @val = val
115
- end
116
-
117
- def evaluate
118
- p @val
119
- end
120
-
121
- end
122
-
123
- class OperateNode < Node
124
-
125
- def initialize(op, left, right)
126
- @op = op
127
- @left = left
128
- @right = right
129
- end
130
-
131
- def evaluate
132
- o = []
133
- o.push @left
134
- o.push @right
135
- o.push @op
136
- p o
137
- end
138
- end
139
-
1
+ #
2
+ # copyright (c) 2009, 2010 Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
3
+
4
+
5
+ class ExcelFormulaParser
6
+
7
+ prechigh
8
+ nonassoc UMINUS
9
+ right '^'
10
+ left '&'
11
+ left '*' '/'
12
+ left '+' '-'
13
+ left '<' '>' '<=' '>=' '<>'
14
+ left '='
15
+ preclow
16
+
17
+ rule
18
+
19
+ formula : expr_list
20
+
21
+ expr_list : { result = [] }
22
+ | expr_list expr EOL { result.push val[1], '_arg', '1' }
23
+ | expr_list EOL
24
+
25
+ expr : expr '+' expr { result = [ val[0], val[2], 'ptgAdd' ] }
26
+ | expr '-' expr { result = [ val[0], val[2], 'ptgSub' ] }
27
+ | expr '*' expr { result = [ val[0], val[2], 'ptgMul' ] }
28
+ | expr '/' expr { result = [ val[0], val[2], 'ptgDiv' ] }
29
+ | expr '^' expr { result = [ val[0], val[2], 'ptgPower' ] }
30
+ | expr '&' expr { result = [ val[0], val[2], 'ptgConcat' ] }
31
+ | expr LT expr { result = [ val[0], val[2], 'ptgLT' ] }
32
+ | expr GT expr { result = [ val[0], val[2], 'ptgGT' ] }
33
+ | expr LE expr { result = [ val[0], val[2], 'ptgLE' ] }
34
+ | expr GE expr { result = [ val[0], val[2], 'ptgGE' ] }
35
+ | expr NE expr { result = [ val[0], val[2], 'ptgNE' ] }
36
+ | expr '=' expr { result = [ val[0], val[2], 'ptgEQ' ] }
37
+ | primary
38
+
39
+ primary : '(' expr ')' { result = [ val[1], '_arg', '1', 'ptgParen'] }
40
+ | '-' expr = UMINUS { result = [ '_num', '-1', val[1], 'ptgMul' ] }
41
+ | FUNC
42
+ | NUMBER { result = [ '_num', val[0] ] }
43
+ | STRING { result = [ '_str', val[0] ] }
44
+ | REF2D { result = [ '_ref2d', val[0] ] }
45
+ | REF3D { result = [ '_ref3d', val[0] ] }
46
+ | RANGE2D { result = [ '_range2d', val[0] ] }
47
+ | RANGE3D { result = [ '_range3d', val[0] ] }
48
+ | NAME { result = [ '_name', val[0] ] }
49
+ | TRUE { result = [ 'ptgBool', '1' ] }
50
+ | FALSE { result = [ 'ptgBool', '0' ] }
51
+ | funcall
52
+
53
+ funcall : FUNC '(' args ')' { result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ] }
54
+ | FUNC '(' ')' { result = [ '_func', val[0] ] }
55
+
56
+ args : expr { result = val }
57
+ | args ',' expr { result.push val[2] }
58
+
59
+ end
60
+
61
+
62
+ ---- footer
63
+
64
+ class ExcelFormulaParserError < StandardError; end
65
+
66
+ class Node
67
+
68
+ def exec_list(nodes)
69
+ v = nil
70
+ nodes.each { |i| v = i.evaluate }
71
+ v
72
+ end
73
+
74
+ def excelformulaparser_error(msg)
75
+ raise ExcelFormulaParserError,
76
+ "in #{fname}:#{lineno}: #{msg}"
77
+ end
78
+
79
+ end
80
+
81
+ class RootNode < Node
82
+
83
+ def initialize(tree)
84
+ @tree = tree
85
+ end
86
+
87
+ def evaluate
88
+ exec_list @tree
89
+ end
90
+
91
+ end
92
+
93
+
94
+ class FuncallNode < Node
95
+
96
+ def initialize(func, args)
97
+ @func = func
98
+ @args = args
99
+ end
100
+
101
+ def evaluate
102
+ arg = @args.collect {|i| i.evaluate }
103
+ out = []
104
+ arg.each { |i| o.push i }
105
+ o.push @func
106
+ p o
107
+ end
108
+
109
+ end
110
+
111
+ class NumberNode < Node
112
+
113
+ def initialize(val)
114
+ @val = val
115
+ end
116
+
117
+ def evaluate
118
+ p @val
119
+ end
120
+
121
+ end
122
+
123
+ class OperateNode < Node
124
+
125
+ def initialize(op, left, right)
126
+ @op = op
127
+ @left = left
128
+ @right = right
129
+ end
130
+
131
+ def evaluate
132
+ o = []
133
+ o.push @left
134
+ o.push @right
135
+ o.push @op
136
+ p o
137
+ end
138
+ end
139
+
@@ -2972,8 +2972,8 @@ def add_mso_drawing_group_continue(data) #:nodoc:
2972
2972
  end
2973
2973
 
2974
2974
  # Change length field of the first MSODRAWINGGROUP block. Case 2 and 3.
2975
- tmp = data.dup
2976
- tmp[0, limit + 4] = ""
2975
+ tmp = data[0, limit + 4]
2976
+ data[0, limit + 4] = ""
2977
2977
  tmp[2, 2] = [limit].pack('v')
2978
2978
  append(tmp)
2979
2979
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{writeexcel}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hideo NAKAMURA"]
12
- s.date = %q{2010-11-10}
12
+ s.date = %q{2011-04-15}
13
13
  s.description = %q{Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells.}
14
14
  s.email = %q{cxn03651@msj.biglobe.ne.jp}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: writeexcel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hideo NAKAMURA
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-10 00:00:00 +09:00
18
+ date: 2011-04-15 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21