From 7d267062cd109ac27cff8a818ff368b949d7f6a0 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 12 Jun 2014 14:29:51 +0200 Subject: cleanup --- grammar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grammar.rb') diff --git a/grammar.rb b/grammar.rb index 2506d61..a8ec07c 100644 --- a/grammar.rb +++ b/grammar.rb @@ -15,7 +15,7 @@ end class NT attr_accessor :symbol, :index - def initialize symbol=nil, index=nil + def initialize symbol=nil, index=-1 @symbol = symbol @index = index end @@ -119,7 +119,7 @@ class Grammar @rules.map { |r| r.lhs.symbol }.select { |s| s != 'S' }.uniq.each { |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', 0), NT.new('X'), 1], [NT.new('S', 0), NT.new('X'), 1], [0, 1]) + @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 -- cgit v1.2.3