rley 0.0.14 → 0.0.15
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 +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/parser/earley_parser.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWU4NWFjYTZkZmY5NDhiNDBkNzVkMTRlNTIzYWIxODhkZjBmNDZlMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDJhZWQ4MWFhYzYzNzg5NjkyMGQ5ZGFiNmQ5MDc2NWE0ODg3Yjk2Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGUwODkxYjA3ZDQwZjRjYWM4ZmI0NWI3ODdmYWI5MDcwOTI1M2FmYjYxMzE5
|
10
|
+
ZGYxYTcxNDU5OWJlNWYwNTg4MTM4YTQyMWI4NmE1MTM5OTI5ODZiNjIyZjYz
|
11
|
+
ZDI4YTcyODIyNTk5NGNmNDQ3MjE0ZTczODAyYWMyNDAzZmVmYzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGUyYzA1YTAzMDM2M2MwYjM1YzI5MTIwMTc4YjVjNzEzNGYwZDk1ZmY0YWRh
|
14
|
+
MDNiZmRiZTQwNDcyNjIwNWQ2MjYxZjU2MmFhMzA2YzgyYTU5MzM2ODI0YTcw
|
15
|
+
ZTM0MTY4MjJhOTMxOGUyMzdlMTU0ZDBlODY5ZGM5M2FjYzdmNzk=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
### 0.0.15 / 2014-11-20
|
2
|
+
* [FIX] `EarleyParser` class source code was out-of-sync.
|
3
|
+
|
1
4
|
### 0.0.14 / 2014-11-20
|
2
5
|
* [NEW] `EarleyParser` now supports grammar with empty productions (i.e. nullable nonterminals).
|
3
6
|
* [CHANGE] (private) method `EarleyParser#prediction` updated with Ayock-Horspool improvement.
|
data/lib/rley/constants.rb
CHANGED
@@ -44,7 +44,7 @@ module Rley # This module is used as a namespace
|
|
44
44
|
else
|
45
45
|
next_symbol = state.next_symbol
|
46
46
|
if next_symbol.kind_of?(Syntax::NonTerminal)
|
47
|
-
prediction(result, next_symbol, i)
|
47
|
+
prediction(result, state, next_symbol, i)
|
48
48
|
elsif i < last_token_index
|
49
49
|
# Expecting a terminal symbol
|
50
50
|
scanning(result, next_symbol, i)
|
@@ -125,17 +125,23 @@ module Rley # This module is used as a namespace
|
|
125
125
|
# in a left-most derivation.
|
126
126
|
# @param aParsing [Parsing] the object that encapsulates the results
|
127
127
|
# result of the parsing process
|
128
|
+
# @param aState [ParseState] current parse state being processed
|
128
129
|
# @param aNonTerminal [NonTerminal] a non-terminal symbol that
|
129
130
|
# immediately follows a dot
|
130
131
|
# (= is expected/predicted by the production rule)
|
131
132
|
# @param aPosition [Fixnum] position in the input token sequence.
|
132
|
-
def prediction(aParsing, aNonTerminal, aPosition)
|
133
|
+
def prediction(aParsing, aState, aNonTerminal, aPosition)
|
133
134
|
# Retrieve all start dotted items for productions
|
134
135
|
# with aNonTerminal as its lhs
|
135
136
|
items = start_mapping[aNonTerminal]
|
136
137
|
items.each do |an_item|
|
137
138
|
aParsing.push_state(an_item, aPosition, aPosition)
|
138
139
|
end
|
140
|
+
|
141
|
+
if aNonTerminal.nullable? # Ayock-Horspool trick for nullable rules
|
142
|
+
next_item = next_mapping[aState.dotted_rule]
|
143
|
+
aParsing.push_state(next_item, aState.origin, aPosition)
|
144
|
+
end
|
139
145
|
end
|
140
146
|
|
141
147
|
# This method is called when a parse state for chart entry at position
|