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 +4 -4
- data/README.md +3 -3
- data/lib/parse_queue/version.rb +1 -1
- data/lib/parse_queue.rb +16 -11
- data/parse_queue.gemspec +1 -0
- data/rakefile.rb +5 -0
- data/reek.txt +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 680c9173be954876332f5a14f657c07d077efa62
|
4
|
+
data.tar.gz: 57b611ff761a311887b602646f8027f7893ec5d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
50
|
-
|
51
|
-
|
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
|
|
data/lib/parse_queue/version.rb
CHANGED
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
|
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
data/rakefile.rb
CHANGED
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.
|
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-
|
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
|