truth_serum 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe740d3a98649998bfc874b79cccc33b954ed0ad
4
- data.tar.gz: 22759b2db9b456e1072b2abae771568308cef393
3
+ metadata.gz: 4ef67ac7b09766e575e09a4e798dbd570032431a
4
+ data.tar.gz: dd3cb91aa96b3f411c05730ead221af4b986623f
5
5
  SHA512:
6
- metadata.gz: 1caac98110f89c78249c1c7726eeeca0ba2c4cfc5f64bdc56602e00e8baa1300b971e33380d88ceea8729ec22bd14d997373ba6d420ef68643dfb26310b6b674
7
- data.tar.gz: 043fe0f877d243500b715e6cde139fc4615cf76d8e0d31d2684b8e92c2545e4fe8faaaa2c4d793b97caa2ded3e007a39168185471f57788cce893a6abbe12464
6
+ metadata.gz: 2f61f0fd66f34cc3bf12fe591b799b2f07a486f54c9b1590a3811790d8ffa3c4cee0c1ced6bf74c3dc2f7cbb7d41373dbf1e4505e0b002dd047513521656bb25
7
+ data.tar.gz: 8559f6a508ec74474df8f87af83e0abc6d1bd1b9a2280a5380af46d9109a851e012f684729eee24332244283a897c57dd8291e534835f029f79afe78a8e9b6f0
@@ -2,13 +2,16 @@ module TruthSerum
2
2
  class Lexer
3
3
  def initialize(input)
4
4
  @input = input
5
+ end
6
+
7
+ def reset
5
8
  @index = 0
6
9
  @tokens = []
7
10
  @buffer = ''
8
11
  end
9
12
 
10
13
  def lex
11
- @tokens = []
14
+ reset
12
15
  lex_line
13
16
  @tokens
14
17
  end
@@ -51,10 +51,12 @@ module TruthSerum
51
51
  term = consume.text
52
52
  return emit_term(term, negate: negate) unless peek.colon?
53
53
 
54
- # if we have a filter (detect `:`)
55
- consume while peek.colon?
54
+ # initial `:` separator
55
+ consume
56
+
57
+ # the rest becomes value (including successive `:`s)
58
+ value += consume.text while peek.colon? || peek.term?
56
59
 
57
- value = consume.text
58
60
  emit_filter(term, value, negate: negate)
59
61
  end
60
62
 
@@ -1,3 +1,3 @@
1
1
  module TruthSerum
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truth_serum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chakrit Wichian