kalculator 0.6.2 → 0.6.3
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 +6 -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: cdb02709346e7a946c7e7149213895a4fa44d4184600c11576925cf344047c4f
|
4
|
+
data.tar.gz: a86e405f4af81894477182f841e0036a6b69350e677dfdda5d7828c03044f9fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8eda4a0a651bfe1861cd74e2ba67e1e6d6fa0da0bd5b404f90f3822d150dafecdb24c259c6f1db3071125dfa594284556c0760a3531f3dd5019dc92c4990ffa
|
7
|
+
data.tar.gz: b2a69ca1b2e3865e438d12b2bd8db88157076b843d197d2daec164a4077b6157ac2afefe04802f935e510a50ec4c8251605d9ae19f4c6e6a2482cc26ff10a2d3
|
data/lib/kalculator/evaluator.rb
CHANGED
data/lib/kalculator/lexer.rb
CHANGED
@@ -16,6 +16,8 @@ class Kalculator
|
|
16
16
|
rule(/<=/) { :LTE }
|
17
17
|
rule(/==/) { :EQ }
|
18
18
|
rule(/!=/) { :NEQ }
|
19
|
+
rule(/and/) { :AND }
|
20
|
+
rule(/or/) { :OR }
|
19
21
|
rule(/AND/) { :AND }
|
20
22
|
rule(/OR/) { :OR }
|
21
23
|
rule(/!/) { :BANG }
|
@@ -35,6 +37,10 @@ class Kalculator
|
|
35
37
|
rule(/sum/) { |t| :SUM }
|
36
38
|
rule(/true/) { |t| :TRUE }
|
37
39
|
rule(/false/) { |t| :FALSE }
|
40
|
+
rule(/null/) { |t| :NULL }
|
41
|
+
rule(/TRUE/) { |t| :TRUE }
|
42
|
+
rule(/FALSE/) { |t| :FALSE }
|
43
|
+
rule(/NULL/) { |t| :NULL }
|
38
44
|
rule(/"[^"]*"/) { |t| [:STRING, t[1..-2]] }
|
39
45
|
rule(/[A-Za-z][A-Za-z0-9\._]*/) { |t| [:IDENT, t] }
|
40
46
|
end
|
data/lib/kalculator/parser.rb
CHANGED
@@ -36,6 +36,7 @@ class Kalculator
|
|
36
36
|
clause('IDENT') { |n| [:variable, n] }
|
37
37
|
clause('TRUE') { |n| [:boolean, true] }
|
38
38
|
clause('FALSE') { |n| [:boolean, false] }
|
39
|
+
clause('NULL') { |n| [:null, nil] }
|
39
40
|
|
40
41
|
clause('expression GT expression') { |e0, _, e1| [:>, e0, e1] }
|
41
42
|
clause('expression GTE expression') { |e0, _, e1| [:>=, e0, e1] }
|
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.3
|
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-
|
11
|
+
date: 2018-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rltk
|