groonga-command-parser 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/text/news.md +8 -0
- data/lib/groonga/command/parser.rb +32 -0
- data/lib/groonga/command/parser/version.rb +1 -1
- metadata +48 -28
- checksums.yaml +0 -7
data/doc/text/news.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.0.1: 2013-10-29
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Supported backslash escape in single quoted token. It introduces
|
8
|
+
another problem that backslash escape is evaluated twice in double
|
9
|
+
quoted token. It is TODO item.
|
10
|
+
|
3
11
|
## 1.0.0: 2013-09-29
|
4
12
|
|
5
13
|
The first release!!! It is extracted from groonga-command gem.
|
@@ -370,6 +370,18 @@ module Groonga
|
|
370
370
|
|
371
371
|
def parse_command_line(command_line)
|
372
372
|
name, *arguments = Shellwords.shellwords(command_line)
|
373
|
+
arguments = arguments.collect do |argument|
|
374
|
+
# TODO: Groonga supports backslash escape in both single
|
375
|
+
# quoted argument and double quoted argument ('...' and
|
376
|
+
# "..."). We should not unescape except single quoted
|
377
|
+
# argument ('...') because Shellwords.shellwords unescape it
|
378
|
+
# in double quoted argument. But we can't determine whether
|
379
|
+
# the argument is single quoted or not after
|
380
|
+
# Shellwords.shellwords... And groonga supports '\n' -> new line
|
381
|
+
# conversion. It isn't done by Shellwords.shellwords.
|
382
|
+
# Should we implement Shellwords.shellwords by ourselves?
|
383
|
+
unescape_argument_in_command_line(argument)
|
384
|
+
end
|
373
385
|
pair_arguments = {}
|
374
386
|
ordered_arguments = []
|
375
387
|
until arguments.empty?
|
@@ -386,6 +398,26 @@ module Groonga
|
|
386
398
|
command
|
387
399
|
end
|
388
400
|
|
401
|
+
def unescape_argument_in_command_line(argument)
|
402
|
+
argument.gsub(/\\(.)/) do
|
403
|
+
character = $1
|
404
|
+
case character
|
405
|
+
when "b"
|
406
|
+
"\b"
|
407
|
+
when "f"
|
408
|
+
"\f"
|
409
|
+
when "n"
|
410
|
+
"\n"
|
411
|
+
when "r"
|
412
|
+
"\r"
|
413
|
+
when "t"
|
414
|
+
"\t"
|
415
|
+
else
|
416
|
+
character
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
389
421
|
def reset
|
390
422
|
@command = nil
|
391
423
|
@loading = false
|
metadata
CHANGED
@@ -1,139 +1,158 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-command-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Kouhei Sutou
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: groonga-command
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: yajl-ruby
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: test-unit
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: test-unit-notify
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- - '>='
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- - '>='
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: bundler
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: packnga
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- - '>='
|
115
|
+
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
|
-
- - '>='
|
123
|
+
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
110
125
|
version: '0'
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: yard
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
|
-
- - '>='
|
131
|
+
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
117
133
|
version: '0'
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
|
-
- - '>='
|
139
|
+
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
124
141
|
version: '0'
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: redcarpet
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
|
-
- - '>='
|
147
|
+
- - ! '>='
|
130
148
|
- !ruby/object:Gem::Version
|
131
149
|
version: '0'
|
132
150
|
type: :development
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
|
-
- - '>='
|
155
|
+
- - ! '>='
|
137
156
|
- !ruby/object:Gem::Version
|
138
157
|
version: '0'
|
139
158
|
description: ''
|
@@ -149,40 +168,41 @@ files:
|
|
149
168
|
- groonga-command-parser.gemspec
|
150
169
|
- .yardopts
|
151
170
|
- lib/groonga/command/parser.rb
|
152
|
-
- lib/groonga/command/parser/version.rb
|
153
171
|
- lib/groonga/command/parser/error.rb
|
172
|
+
- lib/groonga/command/parser/version.rb
|
154
173
|
- doc/text/news.md
|
155
174
|
- doc/text/lgpl-2.1.txt
|
156
175
|
- test/run-test.rb
|
157
|
-
- test/groonga-command-parser-test-utils.rb
|
158
176
|
- test/test-parser.rb
|
177
|
+
- test/groonga-command-parser-test-utils.rb
|
159
178
|
homepage: https://github.com/groonga/groonga-command-parser
|
160
179
|
licenses:
|
161
180
|
- LGPLv2.1+
|
162
|
-
metadata: {}
|
163
181
|
post_install_message:
|
164
182
|
rdoc_options: []
|
165
183
|
require_paths:
|
166
184
|
- lib
|
167
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
168
187
|
requirements:
|
169
|
-
- - '>='
|
188
|
+
- - ! '>='
|
170
189
|
- !ruby/object:Gem::Version
|
171
190
|
version: '0'
|
172
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
173
193
|
requirements:
|
174
|
-
- - '>='
|
194
|
+
- - ! '>='
|
175
195
|
- !ruby/object:Gem::Version
|
176
196
|
version: '0'
|
177
197
|
requirements: []
|
178
198
|
rubyforge_project:
|
179
|
-
rubygems_version:
|
199
|
+
rubygems_version: 1.8.23
|
180
200
|
signing_key:
|
181
|
-
specification_version:
|
201
|
+
specification_version: 3
|
182
202
|
summary: Groonga-command-parser is a Ruby library to parses [groonga](http://groonga.org/)'s
|
183
203
|
command syntax. You can write a program to process groonga's command by using groonga-command-parser.
|
184
204
|
test_files:
|
185
205
|
- test/run-test.rb
|
186
|
-
- test/groonga-command-parser-test-utils.rb
|
187
206
|
- test/test-parser.rb
|
207
|
+
- test/groonga-command-parser-test-utils.rb
|
188
208
|
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 8088aa2c1bbc2152739cae7d1163a1e82db91e08
|
4
|
-
data.tar.gz: 0fd85a57e664a04132d752c189292ff6bbfa8510
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 996655540d3dbaa69a241bbeb0512ccb7e0a3703e8761640485de0084bb91452ca46baca21ebbc24778b47623b098b39f5b79ed366bdd2a101023ba634fe25b9
|
7
|
-
data.tar.gz: ebbe9822fe2071fe9cbc12db81e166a08efcd02ace101b0fd003b4f9c071a4625911dc073a08273cc6e601b0795fe93c3f787c5a3daf2fd1da57a3a1f5f8706e
|