summaryrefslogtreecommitdiff
path: root/grammar.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-10 13:19:44 +0200
committerPatrick Simianer <p@simianer.de>2014-06-10 13:19:44 +0200
commit501de3c0b47ad219cc1372466c98d3fd534c5556 (patch)
treefaf84bfc1cb6d43ccbacd996815a8895eb705a40 /grammar.rb
parent1298b37784247d6de486814838b07ddcf69cd970 (diff)
fix glue/pass-through rules
Diffstat (limited to 'grammar.rb')
-rw-r--r--grammar.rb6
1 files changed, 3 insertions, 3 deletions
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