kalculator 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kalculator/evaluator.rb +4 -0
- data/lib/kalculator/lexer.rb +3 -0
- data/lib/kalculator/parser.rb +1 -0
- data/lib/kalculator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd0089994743a43b5b8ad0b502bfc53758e08ed86f43f521f7e3df5c2d3d6508
|
4
|
+
data.tar.gz: 2946da73cce1290a9be9fd632af0bfc47b617838e847450196cf869e6d7b6e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28286114fd1e503f677099ffb567c1ab4eb899f7a4c2ec1d115fe073424a90d527d1f6416e673538a63afb6ed4e81b78e0ec8ae89763441a4f2f2f6fb1b26e8b
|
7
|
+
data.tar.gz: 12aeacb74451dad37bd06567b92cf4cd585dac83be897325f756a7d74365d297d736a3c06c54643242282ffe55bab455cdcbf6888138effbaaf0403e6ff2a550
|
data/lib/kalculator/evaluator.rb
CHANGED
data/lib/kalculator/lexer.rb
CHANGED
@@ -19,6 +19,9 @@ class Kalculator
|
|
19
19
|
rule(/AND/) { :AND }
|
20
20
|
rule(/OR/) { :OR }
|
21
21
|
rule(/!/) { :BANG }
|
22
|
+
rule(/\-?\d+%/) { |t| [:PERCENT, t.to_i] }
|
23
|
+
rule(/\-?\.\d+%/) { |t| [:PERCENT, t.to_f] }
|
24
|
+
rule(/\-?\d+\.\d+%/) { |t| [:PERCENT, t.to_f] }
|
22
25
|
rule(/\-?\d+/) { |t| [:NUMBER, t.to_i] }
|
23
26
|
rule(/\-?\.\d+/) { |t| [:NUMBER, t.to_f] }
|
24
27
|
rule(/\-?\d+\.\d+/) { |t| [:NUMBER, t.to_f] }
|
data/lib/kalculator/parser.rb
CHANGED
@@ -31,6 +31,7 @@ class Kalculator
|
|
31
31
|
clause('LBRACKET expressions RBRACKET') { |_, expressions, _| [:list, expressions] }
|
32
32
|
|
33
33
|
clause('NUMBER') { |n| [:number, n] }
|
34
|
+
clause('PERCENT') { |n| [:percent, n] }
|
34
35
|
clause('STRING') { |s| [:string, s] }
|
35
36
|
clause('IDENT') { |n| [:variable, n] }
|
36
37
|
clause('TRUE') { |n| [:boolean, true] }
|
data/lib/kalculator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kalculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Ries
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rltk
|