rley 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODY2NWVkNGUzYzNlZDM0MmNhYWIyNGFkYjA2ZGU1NGYyZmNmZTkxMA==
4
+ OWU4NWFjYTZkZmY5NDhiNDBkNzVkMTRlNTIzYWIxODhkZjBmNDZlMA==
5
5
  data.tar.gz: !binary |-
6
- N2RlYjRlNDc5OWIxZWU1YmIwMzA4MWY0MDBhYmFjYzJlZWIyZTVlNg==
6
+ NDJhZWQ4MWFhYzYzNzg5NjkyMGQ5ZGFiNmQ5MDc2NWE0ODg3Yjk2Zg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTBkMTExZWZiZGYxMWZjYTQ0MmUwMDA1ZDE4ZTBlNzYxMDhmZmRkOTdiMWNk
10
- MzkwNWE0MmMzYjQzZGM5MjBiYjA3NTc3MmVkZDNmNmMzNTkxZGJiYjgxNDVl
11
- ZGY1N2QwYTY3NzgxNDJjYzc4ZjU1YWRkMmYwNmVmN2JkZGE0OGY=
9
+ OGUwODkxYjA3ZDQwZjRjYWM4ZmI0NWI3ODdmYWI5MDcwOTI1M2FmYjYxMzE5
10
+ ZGYxYTcxNDU5OWJlNWYwNTg4MTM4YTQyMWI4NmE1MTM5OTI5ODZiNjIyZjYz
11
+ ZDI4YTcyODIyNTk5NGNmNDQ3MjE0ZTczODAyYWMyNDAzZmVmYzI=
12
12
  data.tar.gz: !binary |-
13
- Zjc0YzVlNGU1N2YzNmQ3ZDRlM2VmYmYyNTJhZTQxNDdkZDBkZWYyYWVlZjcy
14
- NGQwODhmZTcwYzQ1YmY2Y2EzOWEyMmRlMDFlMGUyZjM3NjA4MmU0OGU1YWJj
15
- MjUwYmNjOWQ3NTAxYmY4ZjNiNWVlNWQ4ZmNjOThkMmQ0NGFkZDA=
13
+ MGUyYzA1YTAzMDM2M2MwYjM1YzI5MTIwMTc4YjVjNzEzNGYwZDk1ZmY0YWRh
14
+ MDNiZmRiZTQwNDcyNjIwNWQ2MjYxZjU2MmFhMzA2YzgyYTU5MzM2ODI0YTcw
15
+ ZTM0MTY4MjJhOTMxOGUyMzdlMTU0ZDBlODY5ZGM5M2FjYzdmNzk=
@@ -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.
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Rley # Module used as a namespace
5
5
  # The version number of the gem.
6
- Version = '0.0.14'
6
+ Version = '0.0.15'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = "Ruby implementation of the Earley's parsing algorithm"
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef