summaryrefslogtreecommitdiff
path: root/intersect.rb
diff options
context:
space:
mode:
Diffstat (limited to 'intersect.rb')
-rw-r--r--intersect.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/intersect.rb b/intersect.rb
index a4b574f..41ddfd6 100644
--- a/intersect.rb
+++ b/intersect.rb
@@ -110,12 +110,12 @@ s = g.rules.reject { |r| r.rhs.first.class!=NonTerminal}#.reject{|r| r.lhs.sym =
+
+
+
# parse
-puts "parse"
-def visit i, j, sz, active_chart, passive_chart, g, input
- puts "| #{i},#{j}"
- # SCAN
+def scan i, j, active_chart, input
active_chart.at(i,j).each { |item|
if item.rhs[item.dot].class == Terminal
if item.rhs[item.dot].w == input[item.span.left+item.dot].w
@@ -127,6 +127,16 @@ def visit i, j, sz, active_chart, passive_chart, g, input
end
end
}
+end
+
+
+puts "parse"
+def visit i, j, sz, active_chart, passive_chart, g, input
+ puts "| #{i},#{j}"
+
+ # SCAN
+ scan i, j, active_chart, input
+
1.upto(sz) { |span|
break if span==(j-i)