kalc 0.5.7 → 0.5.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kalc/ast.rb CHANGED
@@ -49,6 +49,25 @@ module Kalc
49
49
  end
50
50
  end
51
51
 
52
+ # Does nothing. For compat.
53
+ class Positive
54
+ attr_reader :value
55
+
56
+ def initialize(value)
57
+ @value = value
58
+ end
59
+
60
+ def eval(context)
61
+ begin
62
+ +(@value.eval(context))
63
+ rescue
64
+ @value.eval(context)
65
+ end
66
+ end
67
+ end
68
+
69
+
70
+
52
71
  class BooleanValue
53
72
  attr_reader :value
54
73
 
data/lib/kalc/grammar.rb CHANGED
@@ -166,6 +166,7 @@ class Kalc::Grammar < Parslet::Parser
166
166
  # AND(1, 2, ...)
167
167
  rule(:function_call_expression) {
168
168
  (identifier.as(:name) >> paren_variable_list.as(:variable_list)).as(:function_call) |
169
+ (str('+') >> non_ops_expression).as(:positive) |
169
170
  (str('-') >> non_ops_expression).as(:negative) | non_ops_expression
170
171
  }
171
172
 
@@ -33,6 +33,10 @@ module Kalc
33
33
  Ast::Negative.new(negative)
34
34
  }
35
35
 
36
+ rule(:positive => simple(:positive)) {
37
+ Ast::Positive.new(positive)
38
+ }
39
+
36
40
  rule(:expressions => sequence(:expressions)) {
37
41
  Ast::Expressions.new(expressions)
38
42
  }
data/lib/kalc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kalc
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.7.1"
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.7
4
+ version: 0.5.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: