lineparser 0.1.11 → 0.1.12

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: 8d174a713864f0a8db2939fd5b81461d358bd121
4
- data.tar.gz: ccd279d086903f8819808d7fce4c5d769323a4c1
3
+ metadata.gz: 5b17ab2c8546919d2a3eedeedb5ab9a90a07fdae
4
+ data.tar.gz: 1169df54ee693a8a7b8025cff77b2d4cb7fa42cd
5
5
  SHA512:
6
- metadata.gz: fffa692929c6342fd8baefaa0ff047e4452ca14456d85cb3bd60517355589c0d9e9896b2ccf68af7bd0f0f582d197197890f6648fa632836845184ff6b025a95
7
- data.tar.gz: 60543a5400d571eced3c9cedc813ed18af805403d5bcabdda18255eec56338a0a5c75294d172b50c832f436b593d108e82c498bd798cb1f0fd6b86facb2e5416
6
+ metadata.gz: c094653ed8f021cc12ac859dcb663f41067db4b6afd75a802259de0a15489b551ad84b381624c1c226f499bd2d5c130c24b0a18f559ab463ee0cbe2f5111b477
7
+ data.tar.gz: 5ac836e962ff35aec46538f51115875df085c10467304564e971ab48204748ca46270d72b20c085c96f257e46e6dc6ac0135b132b092f834a6f3395a39265e3f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -70,12 +70,14 @@ class LineParser
70
70
 
71
71
  def scan(xpatterns, items)
72
72
 
73
+ puts 'xpatterns : ' + xpatterns.inspect
73
74
  records = []
74
75
 
75
76
  while items.any? do
76
77
 
77
78
  x = items.shift
78
- params = nil
79
+ puts 'x : ' + x.inspect
80
+ params, context = nil, nil
79
81
 
80
82
  xpatterns = [xpatterns] unless xpatterns[0].is_a? Array
81
83
 
@@ -84,19 +86,34 @@ class LineParser
84
86
  end
85
87
 
86
88
  if found then
89
+
87
90
  children = nil
88
91
  children = scan(found.last, x[1..-1]) if found.last.is_a? Array
89
92
  records << [found[2], params, x, children]
93
+
90
94
  else
91
95
 
92
- found = xpatterns.detect do |_, pattern|
93
- params = @h[pattern.class.to_s.to_sym].call x.first, pattern
96
+ found = xpatterns.detect do |_, pattern, id|
97
+
98
+ if pattern == :root then
99
+
100
+ found = @tree_patterns.detect do |_, pattern2, id|
101
+ params = @h[pattern2.class.to_s.to_sym].call x.first, pattern2
102
+ context = id if params
103
+ end
104
+
105
+ else
106
+
107
+ params = @h[pattern.class.to_s.to_sym].call x.first, pattern
108
+ context = id if params
109
+ end
94
110
  end
95
111
 
96
112
  if found then
113
+
97
114
  children = nil
98
115
  children = scan(found[3..-1], x[1..-1]) if found.last.is_a? Array
99
- records << [found[2], params, x, children]
116
+ records << [context, params, x, children]
100
117
  end
101
118
  end
102
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lineparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  91WD0+jYVX++HpUKNCp85+avduv17ztFqGGok26cpRFYNdIIFFu8T4cl2jsqGI2l
32
32
  hT3uS3yIJ12YEQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-03-13 00:00:00.000000000 Z
34
+ date: 2014-03-24 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: line-tree
metadata.gz.sig CHANGED
Binary file