excel_to_code 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -250,7 +250,7 @@ class MapFormulaeToC < MapValuesToC
250
250
 
251
251
  # Then we need to assign it to an excel value
252
252
  range_name = array_name+"_ev"
253
- initializers << "ExcelValue #{range_name} = new_excel_range(#{array_name},#{number_of_rows},#{number_of_columns});"
253
+ initializers << "ExcelValue #{range_name} = EXCEL_RANGE(#{array_name},#{number_of_rows},#{number_of_columns});"
254
254
 
255
255
  range_name
256
256
  end
@@ -52,16 +52,16 @@ class MapValuesToC
52
52
  else
53
53
  text.to_i.to_s
54
54
  end
55
- "new_excel_number(#{n})"
55
+ "EXCEL_NUMBER(#{n})"
56
56
  end
57
57
  end
58
58
 
59
59
  def percentage(text)
60
- "new_excel_number(#{(text.to_f / 100.0).to_s})"
60
+ "EXCEL_NUMBER(#{(text.to_f / 100.0).to_s})"
61
61
  end
62
62
 
63
63
  def string(text)
64
- "new_excel_string(#{text.inspect})"
64
+ "EXCEL_STRING(#{text.inspect})"
65
65
  end
66
66
 
67
67
  ERRORS = {
@@ -8,6 +8,7 @@ module ExcelFunctions
8
8
  string = "TRUE" if string == true
9
9
  string = "FALSE" if string == false
10
10
  string = string.to_s
11
+ characters = string.length if characters > string.length
11
12
  string.slice(string.length-characters,characters) || ""
12
13
  end
13
14
 
data/src/excel_to_code.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class ExcelToCode
2
- def self.version() "0.3.4" end
2
+ def self.version() "0.3.5" end
3
3
  end
4
4
 
5
5
  require_relative 'commands'
@@ -12,7 +12,6 @@ class MapValuesToConstants
12
12
 
13
13
  def map(ast)
14
14
  return ast unless ast.is_a?(Array)
15
- operator = ast[0]
16
15
  if replace?(ast)
17
16
  ast.replace([:constant, constants[ast.dup]])
18
17
  else
@@ -38,26 +37,3 @@ class MapValuesToConstants
38
37
 
39
38
  end
40
39
 
41
-
42
- class ReplaceValuesWithConstants
43
-
44
- attr_accessor :rewriter
45
-
46
- def self.replace(*args)
47
- self.new.replace(*args)
48
- end
49
-
50
- def replace(input,output)
51
- @rewriter ||= MapValuesToConstants.new
52
- input.each_line do |line|
53
- begin
54
- ref, ast = line.split("\t")
55
- output.puts "#{ref}\t#{rewriter.map(eval(ast)).inspect}"
56
- rescue Exception => e
57
- puts "Exception at line #{line}"
58
- raise
59
- end
60
- end
61
-
62
- end
63
- end
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.3.4
4
+ version: 0.3.5
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-12-01 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubypeg
@@ -126,6 +126,8 @@ files:
126
126
  - src/compile.rb
127
127
  - src/compile/c.rb
128
128
  - src/compile/c/a.out
129
+ - src/compile/c/a.out.dSYM/Contents/Info.plist
130
+ - src/compile/c/a.out.dSYM/Contents/Resources/DWARF/a.out
129
131
  - src/compile/c/compile_named_reference_setters.rb
130
132
  - src/compile/c/compile_to_c.rb
131
133
  - src/compile/c/compile_to_c_header.rb