command_search 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command_search/lexer.rb +4 -1
- data/lib/command_search/parser.rb +13 -13
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0fcd48aa860c52997a4d321cbd60da14cf1655a7def93428da30ab593992a25
|
4
|
+
data.tar.gz: '093079892f0bb5dfeb7dc0e041349e106a791a4e0dfcc94a66fff0e4100c7058'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d2638ace20b629f1e4ff71358e2573293d3e08c397a216479eefb3f5a995f50d84b14cfcfafbc1c4d8c76bb48a45cc8cb20a2aa300ac7f3dfca7809396ae3c8
|
7
|
+
data.tar.gz: db0bc500aa61bda6dcb1f28c29b1822b1fcfb0b712c708aecb4b4badfcd72b840f42c3a1e90ae60efa84784cc800ccf5e7372289b1dd2e8702dc57b5541dc054
|
data/lib/command_search/lexer.rb
CHANGED
@@ -29,7 +29,10 @@ module CommandSearch
|
|
29
29
|
type = :paren
|
30
30
|
when /^[<>]=?/
|
31
31
|
type = :compare
|
32
|
-
when
|
32
|
+
# when /^([^\s"|<>()]+):/
|
33
|
+
# match = Regexp.last_match[1]
|
34
|
+
# type = :command
|
35
|
+
when /^[^\s:"|<>()]+/
|
33
36
|
type = :str
|
34
37
|
when /^./
|
35
38
|
type = :str
|
@@ -21,7 +21,7 @@ module CommandSearch
|
|
21
21
|
out
|
22
22
|
end
|
23
23
|
|
24
|
-
def cluster(type, input, cluster_type = :binary)
|
24
|
+
def cluster!(type, input, cluster_type = :binary)
|
25
25
|
binary = (cluster_type == :binary)
|
26
26
|
out = input
|
27
27
|
out = out[:value] while out.is_a?(Hash)
|
@@ -39,18 +39,18 @@ module CommandSearch
|
|
39
39
|
value: val
|
40
40
|
}
|
41
41
|
end
|
42
|
-
out.map do |x|
|
42
|
+
out.map! do |x|
|
43
43
|
next x unless x[:type] == :nest
|
44
|
-
x[:value] = cluster(type, x[:value], cluster_type)
|
44
|
+
x[:value] = cluster!(type, x[:value], cluster_type)
|
45
45
|
x
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def unchain(type, input)
|
50
|
-
input.
|
51
|
-
front = input
|
52
|
-
mid = input
|
53
|
-
back = input
|
49
|
+
def unchain!(type, input)
|
50
|
+
(input.length - 2).times do |i|
|
51
|
+
front = input[i][:type]
|
52
|
+
mid = input[i + 1][:type]
|
53
|
+
back = input[i + 2][:type]
|
54
54
|
if front == type && mid != type && back == type
|
55
55
|
input.insert(i + 1, input[i + 1])
|
56
56
|
end
|
@@ -74,11 +74,11 @@ module CommandSearch
|
|
74
74
|
def parse(input)
|
75
75
|
out = input
|
76
76
|
out = group_parens(out)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
cluster!(:colon, out)
|
78
|
+
unchain!(:compare, out)
|
79
|
+
cluster!(:compare, out)
|
80
|
+
cluster!(:minus, out, :prefix)
|
81
|
+
cluster!(:pipe, out)
|
82
82
|
out = clean_ununused_syntax(out)
|
83
83
|
out
|
84
84
|
end
|
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zumbalogy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2018-11-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: chronic
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.2
|
27
|
+
description: Build powerful and friendly search APIs for users.
|
14
28
|
email:
|
15
29
|
executables: []
|
16
30
|
extensions: []
|
@@ -36,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
50
|
requirements:
|
37
51
|
- - ">="
|
38
52
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
53
|
+
version: 2.0.0
|
40
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
55
|
requirements:
|
42
56
|
- - ">="
|
@@ -44,8 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
58
|
version: '0'
|
45
59
|
requirements: []
|
46
60
|
rubyforge_project:
|
47
|
-
rubygems_version:
|
61
|
+
rubygems_version: 3.0.0.beta1
|
48
62
|
signing_key:
|
49
63
|
specification_version: 4
|
50
|
-
summary:
|
64
|
+
summary: Let users query collections with ease.
|
51
65
|
test_files: []
|