From 501de3c0b47ad219cc1372466c98d3fd534c5556 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 10 Jun 2014 13:19:44 +0200 Subject: fix glue/pass-through rules --- grammar.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grammar.rb') diff --git a/grammar.rb b/grammar.rb index 003512c..ea16425 100644 --- a/grammar.rb +++ b/grammar.rb @@ -114,16 +114,16 @@ class Grammar def add_glue_rules @rules.map { |r| r.lhs.symbol }.select { |s| s != 'S' }.uniq.each { |symbol| - @rules << Rule.new(NT.new('S'), [NT.new(symbol)]) + @rules << Rule.new(NT.new('S'), [NT.new(symbol, 0)], [NT.new(symbol, 0)], [0]) @startn << @rules.last - @rules << Rule.new(NT.new('S'), [NT.new('S'), NT.new('X')]) + @rules << Rule.new(NT.new('S'), [NT.new('S', 0), NT.new('X'), 1], [NT.new('S', 0), NT.new('X'), 1], [0, 1]) @startn << @rules.last } end def add_pass_through_rules s s.each { |word| - @rules << Rule.new(NT.new('X'), [T.new(word)]) + @rules << Rule.new(NT.new('X'), [T.new(word)], [T.new(word)]) @flat << @rules.last } end -- cgit v1.2.3