kalc 1.1.2 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5e7d0f88467457fa1bb05ba79d7c4e22108b0ed
4
- data.tar.gz: dbc37893dc7b6105c15e39af612e502961445dd4
3
+ metadata.gz: 7dd87399e45a1819f532e20a2e4fed4be6824b6e
4
+ data.tar.gz: 17167d66287fe9869eed4c788eb8942b85551d76
5
5
  SHA512:
6
- metadata.gz: bb90ace532474efe5336145bd3256406140bc97616e90da0f528e7d59c1617f524b1744d8d62353589970e21d07dce243d7b8e45f7963aa9f2cea8fcafb60b14
7
- data.tar.gz: be2d7ae24e1bd786101e07ffd2bd297f586169ad70e36fea36bccb695e978bf70b2c539f63d020352bf9f3ff78ea0600aebdc7dc84cbb2b4cab32526a37ee2c7
6
+ metadata.gz: 9019d6437db9acf668148ababebfa77e8120d44f916d84d082011d58836f7c2e09bda5b1bf55f50d82dc96df98525f105db3d82709f0c64c5ba37d03fe90614c
7
+ data.tar.gz: 930b53a089d8e62a093ef09bda37a4aab7004ab4d4b64a1f8636840819ae8c5b67c60c04c4bee6e84ceb469c551bba8365a5cb071e23c5e0fe4ce9c15bf7d474
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kalc (1.1.1)
4
+ kalc (1.2.0)
5
5
  parslet (~> 1.7)
6
6
 
7
7
  GEM
@@ -9,22 +9,22 @@ GEM
9
9
  specs:
10
10
  blankslate (3.1.3)
11
11
  diff-lcs (1.2.5)
12
- parslet (1.7.0)
12
+ parslet (1.7.1)
13
13
  blankslate (>= 2.0, <= 4.0)
14
- rake (10.4.2)
15
- rspec (3.3.0)
16
- rspec-core (~> 3.3.0)
17
- rspec-expectations (~> 3.3.0)
18
- rspec-mocks (~> 3.3.0)
19
- rspec-core (3.3.1)
20
- rspec-support (~> 3.3.0)
21
- rspec-expectations (3.3.0)
14
+ rake (11.2.2)
15
+ rspec (3.5.0)
16
+ rspec-core (~> 3.5.0)
17
+ rspec-expectations (~> 3.5.0)
18
+ rspec-mocks (~> 3.5.0)
19
+ rspec-core (3.5.0)
20
+ rspec-support (~> 3.5.0)
21
+ rspec-expectations (3.5.0)
22
22
  diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.3.0)
24
- rspec-mocks (3.3.1)
23
+ rspec-support (~> 3.5.0)
24
+ rspec-mocks (3.5.0)
25
25
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.3.0)
27
- rspec-support (3.3.0)
26
+ rspec-support (~> 3.5.0)
27
+ rspec-support (3.5.0)
28
28
 
29
29
  PLATFORMS
30
30
  java
@@ -36,4 +36,4 @@ DEPENDENCIES
36
36
  rspec
37
37
 
38
38
  BUNDLED WITH
39
- 1.10.6
39
+ 1.12.5
@@ -45,6 +45,11 @@ module Kalc
45
45
  Ast::StringValue.new(string)
46
46
  }
47
47
 
48
+ rule(:string => sequence(:string)) {
49
+ string = '' if string == nil
50
+ Ast::StringValue.new(string)
51
+ }
52
+
48
53
  rule(:boolean => simple(:boolean)) {
49
54
  Ast::BooleanValue.new(boolean)
50
55
  }
@@ -1,3 +1,3 @@
1
1
  module Kalc
2
- VERSION = '1.1.2'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -126,6 +126,14 @@ describe Kalc::Interpreter do
126
126
  it { expect(evaluate('ROUND(233.256,-2)')).to eq(200) }
127
127
  end
128
128
 
129
+ # https://github.com/mrcsparker/kalc/issues/9
130
+ # https://github.com/kschiess/parslet/issues/126
131
+ context 'empty strings' do
132
+ it { expect(evaluate('""')).to eq('') }
133
+ it { expect(evaluate('var1 := 1; var2 := 2; IF(var1=var2,"","ERROR")')).to eq('ERROR') }
134
+ it { expect(evaluate('var1 := 1; var2 := 1; IF(var1=var2,"","ERROR")')).to eq('') }
135
+ end
136
+
129
137
  private
130
138
  def evaluate(expression)
131
139
  g = @grammar.parse(expression)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Parker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project: kalc
106
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.6.4
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Small calculation language.
@@ -112,3 +112,4 @@ test_files:
112
112
  - spec/interpreter_spec.rb
113
113
  - spec/spec_helper.rb
114
114
  - spec/stdlib_spec.rb
115
+ has_rdoc: