parse_queue 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 383a2388d540d992e658a3b6e3eff0a04ffcaab4
4
- data.tar.gz: 63aac7b0b20544d1e596a58d8e1e88d8f6c012b0
3
+ metadata.gz: 680c9173be954876332f5a14f657c07d077efa62
4
+ data.tar.gz: 57b611ff761a311887b602646f8027f7893ec5d7
5
5
  SHA512:
6
- metadata.gz: 0f7a07e5d590f807e8d9097ac5ea0b9fd567f9366fef702a5d5e0cf2be17d07b22b8127107db635ea828964ca2044fcc9267a22c8554b57500265d0d35baa72e
7
- data.tar.gz: 37fa8202815532981dfd6d5327117e6e83fc5618d9be63f2317ebcb2bdde2a9c059140823d5c1ce7eb48c072ba175adf576cbc08c768f2b1539c52fee6ff01e2
6
+ metadata.gz: b90020ad6dda6613549e9b4da6f45992e23a11475225fc8f2b9c93764143514677dbba428d6dc88b1b722dda90df96a161606a2ad1692e7155c8ab1201a0c344
7
+ data.tar.gz: 8add940d513b2ba9883dc1c266d24511011f04b1205269f685133a0f68323f6fb8f4c833fba2427018dee0a0e13b4edd508b24a685110df58e90a84c6da94d0f
data/README.md CHANGED
@@ -46,9 +46,9 @@ analyzer on it (see the
46
46
  gem for more details) and then uses that as the source for the parse queue.
47
47
  The queue is returned for use by the compiler's parser.
48
48
 
49
- Note: If the fetch block is omitted, then items will have to added to the parse
50
- queue using the add method. The add method accepts single items, multiple items
51
- or an array of items.
49
+ Note: The constant LEXICAL_RULES is a set of rules used to define the tokens
50
+ extracted by the lexical analyzer. As such it is not discussed further here.
51
+ See that gem for more details on how rules are constructed.
52
52
 
53
53
  #### Getting a queued item:
54
54
 
@@ -1,3 +1,3 @@
1
1
  class ParseQueue
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/parse_queue.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  require_relative "parse_queue/exceptions"
5
5
  require_relative "parse_queue/version"
6
6
 
7
+ # The RCTP queue for parser token flow with backtracking.
7
8
  class ParseQueue
8
9
 
9
10
  # The current read point of the queue.
@@ -14,7 +15,7 @@ class ParseQueue
14
15
 
15
16
  # Set up the parser queue.
16
17
  def initialize(&fetch)
17
- @fetch = fetch || DFB
18
+ @fetch = fetch
18
19
  @buffer = []
19
20
  @offset = @position = 0
20
21
  end
@@ -31,16 +32,7 @@ class ParseQueue
31
32
 
32
33
  # Get an item from the buffer.
33
34
  def get
34
- if @position == index_limit
35
- item = @fetch.call
36
-
37
- unless item
38
- @fetch = DFB
39
- fail ParseQueueNoFwd
40
- end
41
-
42
- @buffer << item
43
- end
35
+ @buffer << fetch_one if @position == index_limit
44
36
 
45
37
  result = @buffer[rev_count]
46
38
  @position += 1
@@ -104,4 +96,17 @@ private
104
96
  def index_limit
105
97
  @buffer.length + @offset
106
98
  end
99
+
100
+ # Fetch a single item.
101
+ def fetch_one
102
+ item = @fetch.call
103
+
104
+ unless item
105
+ @fetch = DFB
106
+ fail ParseQueueNoFwd
107
+ end
108
+
109
+ item
110
+ end
111
+
107
112
  end
data/parse_queue.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
26
  spec.add_development_dependency 'minitest_visible', "~> 0.1"
27
+ spec.add_development_dependency 'reek', "~> 5.0.2"
27
28
  end
data/rakefile.rb CHANGED
@@ -9,6 +9,11 @@ end
9
9
 
10
10
  task :default => :test
11
11
 
12
+ desc "Run a scan for smelly code!"
13
+ task :reek do |t|
14
+ `reek --no-color lib > reek.txt`
15
+ end
16
+
12
17
  desc "What version of parse queue is this?"
13
18
  task :vers do |t|
14
19
  puts
data/reek.txt ADDED
@@ -0,0 +1 @@
1
+ 0 total warnings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PeterCamilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: reek
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.0.2
69
83
  description: The RCTP object queue for moving compiler tokens with nestable backtrack
70
84
  capability.
71
85
  email:
@@ -84,6 +98,7 @@ files:
84
98
  - lib/parse_queue/version.rb
85
99
  - parse_queue.gemspec
86
100
  - rakefile.rb
101
+ - reek.txt
87
102
  homepage: https://github.com/PeterCamilleri/parse_queue
88
103
  licenses:
89
104
  - MIT