jgrep 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/jgrep +1 -1
- data/jgrep.gemspec +2 -2
- data/lib/jgrep.rb +10 -12
- data/lib/parser/parser.rb +5 -0
- metadata +3 -3
data/bin/jgrep
CHANGED
data/jgrep.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "jgrep"
|
3
|
-
s.version = "1.1.
|
3
|
+
s.version = "1.1.3"
|
4
4
|
|
5
5
|
s.authors = ["P Loubser"]
|
6
|
-
s.date = %q{2011-07-
|
6
|
+
s.date = %q{2011-07-27}
|
7
7
|
s.default_executable = "jgrep"
|
8
8
|
s.description = "Compare a list of json documents to a simple logical language and returns matches as output"
|
9
9
|
s.email = ["ploubser@gmail.com"]
|
data/lib/jgrep.rb
CHANGED
@@ -4,7 +4,6 @@ require 'parser/parser.rb'
|
|
4
4
|
require 'parser/scanner.rb'
|
5
5
|
require 'rubygems'
|
6
6
|
require 'json'
|
7
|
-
require 'pp'
|
8
7
|
|
9
8
|
module JGrep
|
10
9
|
@verbose = false
|
@@ -86,16 +85,16 @@ module JGrep
|
|
86
85
|
tmp, value = format(tmp, value.gsub(/"|'/, ""))
|
87
86
|
|
88
87
|
case op
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
88
|
+
when "="
|
89
|
+
(tmp == value) ? (return true) : (return false)
|
90
|
+
when "<="
|
91
|
+
(tmp <= value) ? (return true) : (return false)
|
92
|
+
when ">="
|
93
|
+
(tmp >= value) ? (return true) : (return false)
|
94
|
+
when ">"
|
95
|
+
(tmp > value) ? (return true) : (return false)
|
96
|
+
when "<"
|
97
|
+
(tmp < value) ? (return true) : (return false)
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
@@ -111,7 +110,6 @@ module JGrep
|
|
111
110
|
return false
|
112
111
|
end
|
113
112
|
|
114
|
-
|
115
113
|
#Check if complex statement (defined as [key=value...]) is
|
116
114
|
#present over an array of key value pairs
|
117
115
|
def self.has_complex?(document, compound)
|
data/lib/parser/parser.rb
CHANGED
@@ -67,6 +67,11 @@ module JGrep
|
|
67
67
|
parse(c_token_value, 0)
|
68
68
|
end
|
69
69
|
|
70
|
+
if c_token_value =~ /!=/
|
71
|
+
c_token_value = c_token_value.gsub("!=", "=")
|
72
|
+
@execution_stack << {"not", "not"}
|
73
|
+
end
|
74
|
+
|
70
75
|
unless n_token =~ /and|or|\)/
|
71
76
|
unless n_token.nil?
|
72
77
|
raise "Error at column #{scanner.token_index}. \nExpected 'and', 'or', ')'. Found '#{n_token_value}'"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 3
|
9
|
+
version: 1.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- P Loubser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-07-
|
17
|
+
date: 2011-07-27 00:00:00 +01:00
|
18
18
|
default_executable: jgrep
|
19
19
|
dependencies: []
|
20
20
|
|