summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-05-26 19:46:47 +0200
committerPatrick Simianer <p@simianer.de>2014-05-26 19:46:47 +0200
commitaf62fcca3729c9763c374520e1665f782bbbdf42 (patch)
tree9abd7af854bf3019ab98f7c489140a3b5143ddf9
parent660c715491c9d2079401a26d3ba9d329ff8b52e4 (diff)
fix
-rw-r--r--parse.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/parse.rb b/parse.rb
index 772edf5..3ea4fc0 100644
--- a/parse.rb
+++ b/parse.rb
@@ -145,14 +145,17 @@ def parse input, n, active_chart, passive_chart, grammar
# 'self-filling' step
new_symbols.each { |s|
+ puts new_symbols.to_s if i==2&&j==5
remaining_items.each { |active_item|
next if active_item.dot!=0
next if active_item.rhs[active_item.dot].class!=NT
if active_item.rhs[active_item.dot].symbol == s
new_item = Item.new active_item, i, j, active_item.dot+1
new_item.rhs[new_item.dot-1].span = Span.new i, j
- new_symbols << new_item.lhs.symbol if !new_symbols.include? new_item.lhs.symbol
- passive_chart.add new_item, i, j if new_item.dot==new_item.rhs.size
+ if new_item.dot==new_item.rhs.size
+ new_symbols << new_item.lhs.symbol if !new_symbols.include? new_item.lhs.symbol
+ passive_chart.add new_item, i, j
+ end
end
}
}