synvert-core 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0554ef349e1fe725c68cd277b40751ca7373b04fe118313bf70fdf307852e01
4
- data.tar.gz: 283a4ca6bf2d0fc09ba1f63bb5831524dc0634184072c340d7092a9253a93700
3
+ metadata.gz: a19f84568d17d7d51bf4f4486a7f95a299261c25eacd5ff57faea07fd597bc26
4
+ data.tar.gz: 8dce2d09629733e239046581aa03433a7231cf8094ba0e1aec99f1df7ec0f867
5
5
  SHA512:
6
- metadata.gz: 9152e5eea03cbc9a842fdad557cc8ea9ecb2e7d3dc3480708b886100393c0167a804f3cd0f4fd5aca968c4992ce85b0b604d36ab6beabe9ac4023e6102e2c05e
7
- data.tar.gz: 4b35baab2ebe3c76a9151e0148dc185a8e6776d4dd6ece7abcd2cb3cd4ad21bc63b5cc68b75d6410827ef9089bf52fc6871bacb1e44c39cffce36faef07b9a8f
6
+ metadata.gz: 2a731bae510193fccf6c5682ff7559e7610b7774af5e2d0a196bad1ed838f84c5700e9dfcb123d0314b2ac40034d6246cd676b9e60e01f148ed17e6c32f1bc90
7
+ data.tar.gz: 15fad0af1dce17af70f2b3a8ab1af3827f57892437076ddda86acdde19f7b24691b05c5c7b064ef33985815e0fdb0eb7fc4ad29924433c955067ee715f302138
@@ -20,8 +20,8 @@ macros
20
20
  REGEXP /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
21
21
  SYMBOL /:[\w!\?<>=]+/
22
22
  TRUE /true/
23
- SINGLE_QUOTE_STRING /'(.+?)'/
24
- DOUBLE_QUOTE_STRING /"(.+?)"/
23
+ SINGLE_QUOTE_STRING /'(.*?)'/
24
+ DOUBLE_QUOTE_STRING /"(.*?)"/
25
25
 
26
26
  rules
27
27
 
@@ -33,8 +33,8 @@ class Synvert::Core::NodeQuery::Lexer
33
33
  REGEXP = /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
34
34
  SYMBOL = /:[\w!\?<>=]+/
35
35
  TRUE = /true/
36
- SINGLE_QUOTE_STRING = /'(.+?)'/
37
- DOUBLE_QUOTE_STRING = /"(.+?)"/
36
+ SINGLE_QUOTE_STRING = /'(.*?)'/
37
+ DOUBLE_QUOTE_STRING = /"(.*?)"/
38
38
  # :startdoc:
39
39
  # :stopdoc:
40
40
  class LexerError < StandardError ; end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
7
7
  end
@@ -187,6 +187,19 @@ module Synvert::Core::NodeQuery
187
187
  assert_tokens source, expected_tokens
188
188
  end
189
189
 
190
+ it 'matches empty string' do
191
+ source = ".send[arguments.first='']"
192
+ expected_tokens = [
193
+ [:tNODE_TYPE, "send"],
194
+ [:tOPEN_ATTRIBUTE, "["],
195
+ [:tKEY, "arguments.first"],
196
+ [:tEQUAL, "="],
197
+ [:tSTRING, ""],
198
+ [:tCLOSE_ATTRIBUTE, "]"]
199
+ ]
200
+ assert_tokens source, expected_tokens
201
+ end
202
+
190
203
  it 'matches attribute value' do
191
204
  source = '.pair[key={{value}}]'
192
205
  expected_tokens = [
@@ -108,6 +108,11 @@ module Synvert::Core::NodeQuery
108
108
  assert_parser(source)
109
109
  end
110
110
 
111
+ it 'parses empty string' do
112
+ source = '.send[arguments.first=""]'
113
+ assert_parser(source)
114
+ end
115
+
111
116
  describe '#query_nodes' do
112
117
  let(:node) {
113
118
  parse(<<~EOS)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang