excel_to_code 0.2.15 → 0.2.16

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.
@@ -53,8 +53,8 @@ class ReplaceRangesWithArrayLiteralsAst
53
53
  check_range, criteria, sum_range = ast[2], ast[3], ast[4]
54
54
  return map_args(ast) unless [:area, :sheet_reference, :cell].include?(check_range.first)
55
55
  return map_args(ast) unless [:area, :sheet_reference, :cell].include?(sum_range.first)
56
- check_area = area_for(check_range)
57
- sum_area = area_for(sum_range)
56
+ check_area = area_for(check_range).unfix
57
+ sum_area = area_for(sum_range).unfix
58
58
 
59
59
  check_area.calculate_excel_variables
60
60
  sum_area.calculate_excel_variables
@@ -1,11 +1,10 @@
1
1
  class SimplifyArithmeticAst
2
2
 
3
- attr_accessor :map_count
4
-
5
3
  def map(ast)
6
4
  @brackets_to_remove = []
7
5
  simplify_arithmetic(ast)
8
- remove_brackets(ast)
6
+ remove_brackets
7
+ ast
9
8
  end
10
9
 
11
10
  def simplify_arithmetic(ast)
@@ -15,15 +14,13 @@ class SimplifyArithmeticAst
15
14
  when :arithmetic; arithmetic(ast)
16
15
  when :brackets; @brackets_to_remove << ast
17
16
  end
18
- ast
19
17
  end
20
18
 
21
- def remove_brackets(ast)
19
+ def remove_brackets
22
20
  @brackets_to_remove.uniq.each do |ast|
23
21
  raise NotSupportedException.new("Multiple arguments not supported in brackets #{ast.inspect}") if ast.size > 2
24
22
  ast.replace(ast[1])
25
23
  end
26
- ast
27
24
  end
28
25
 
29
26
  # This sets the operator precedence
@@ -42,8 +39,6 @@ class SimplifyArithmeticAst
42
39
  while i = ast.find_index { |a| a[0] == :operator && op.has_key?(a[1])}
43
40
  # Now we need to wrap that operation in its own arithmetic clause
44
41
  old_clause = ast[(i-1)..(i+1)]
45
- # Make sure we do any mapping
46
- #old_clause.each { |a| map(a) }
47
42
  # Now create a new clause
48
43
  new_clause = [:arithmetic, *old_clause]
49
44
  # And insert it back into the ast
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel_to_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Counsell, Green on Black Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-06 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubypeg
@@ -149,6 +149,7 @@ files:
149
149
  - src/excel/excel_functions/count.rb
150
150
  - src/excel/excel_functions/counta.rb
151
151
  - src/excel/excel_functions/divide.rb
152
+ - src/excel/excel_functions/ensure_is_number.rb
152
153
  - src/excel/excel_functions/excel_equal.rb
153
154
  - src/excel/excel_functions/excel_if.rb
154
155
  - src/excel/excel_functions/excel_match.rb