parse_queue 0.2.1 → 0.2.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 +4 -4
- data/README.md +12 -0
- data/lib/parse_queue.rb +7 -0
- data/lib/parse_queue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36033d4abd23bd7092e28e8e1eb9fc405c87dbe1
|
4
|
+
data.tar.gz: c3d7c043db21c06ebd37e67ef0ab9e55fc7e59be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb132c9c248243091584674374a918723cd58e560202badf1675416f3d18bbda8ff4847628e8705522770bc74e827e6b6a6ca6808d098ef10619e36e63b1165
|
7
|
+
data.tar.gz: e1a412e86eb9bac422b7c387edd271d7fd4138ca237fb8a5ef2d4d1530a3823a04f87e7347bb4e6b2e17fc9389f1f15dc89294a71e62d1161df727976831759f
|
data/README.md
CHANGED
@@ -7,6 +7,12 @@ simple queue, it supports backing up or falling back to earlier states allowing
|
|
7
7
|
the parser to try other paths in the syntax tree when one path runs into a
|
8
8
|
dead end.
|
9
9
|
|
10
|
+
The parse queue was created to simplify the design of both the lexical analyzer
|
11
|
+
and the parser. Parsers often have a built-in limited "look-ahead" of tokens.
|
12
|
+
This can be seen in parser names like LL(0), LL(1), LR(1), LALR(n), etc. The
|
13
|
+
parse queue provides for a flexible look-ahead removing this burden from other
|
14
|
+
compiler components.
|
15
|
+
|
10
16
|
## Installation
|
11
17
|
|
12
18
|
Add this line to your application's Gemfile:
|
@@ -60,6 +66,12 @@ Getting an item from the queue is done with the get method. For example:
|
|
60
66
|
This method returns the next unread item from the queue. Note that if no items
|
61
67
|
are available, the exception **ParseQueueNoFwd** is raised.
|
62
68
|
|
69
|
+
Note: The get! method is a get without backtracking. In effect it is a get
|
70
|
+
followed by a shift (see Shifting below).
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
item = pq.get!
|
74
|
+
```
|
63
75
|
|
64
76
|
#### Backtracking:
|
65
77
|
|
data/lib/parse_queue.rb
CHANGED
data/lib/parse_queue/version.rb
CHANGED
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.2
|
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-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|