kalc 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kalc/ast.rb CHANGED
@@ -107,14 +107,10 @@ module Kalc
107
107
  end
108
108
 
109
109
  def eval(context)
110
+
110
111
  @ops.inject(@left.eval(context)) { |x, op|
111
- if op[:right].kind_of? Kalc::Ast::Ops
112
- a = Arithmetic.new(x, op[:right].left.eval(context), op[:operator])
113
- Ops.new(a, op[:right].ops).eval(context)
114
- else
115
- a = Arithmetic.new(x, op[:right].eval(context), op[:operator])
116
- a.eval(context)
117
- end
112
+ a = Arithmetic.new(x, op[:right].eval(context), op[:operator])
113
+ a.eval(context)
118
114
  }
119
115
  end
120
116
 
data/lib/kalc/grammar.rb CHANGED
@@ -184,7 +184,7 @@ class Kalc::Grammar < Parslet::Parser
184
184
  rule(:additive_expression) {
185
185
  multiplicative_expression.as(:left) >>
186
186
  ((add | subtract) >>
187
- additive_expression.as(:right)).repeat.as(:ops)
187
+ multiplicative_expression.as(:right)).repeat.as(:ops)
188
188
  }
189
189
 
190
190
  # 1 < 2
data/lib/kalc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kalc
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000 Z
12
+ date: 2012-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake