diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-10 13:19:44 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-10 13:19:44 +0200 |
commit | 501de3c0b47ad219cc1372466c98d3fd534c5556 (patch) | |
tree | faf84bfc1cb6d43ccbacd996815a8895eb705a40 /grammar.rb | |
parent | 1298b37784247d6de486814838b07ddcf69cd970 (diff) |
fix glue/pass-through rules
Diffstat (limited to 'grammar.rb')
-rw-r--r-- | grammar.rb | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |