From be7f27e84ae2e18e9843808b72c2627b7b999d16 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 25 May 2014 14:32:43 +0200 Subject: faster self-fill, NT span --- grammar.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'grammar.rb') diff --git a/grammar.rb b/grammar.rb index 52d0fba..a674a7b 100644 --- a/grammar.rb +++ b/grammar.rb @@ -14,15 +14,16 @@ class T end class NT - attr_accessor :symbol, :index + attr_accessor :symbol, :index, :span def initialize symbol, index=0 @symbol = symbol @index = index + @span = Span.new end def to_s - "NT<#{@symbol},#{@index}>" + "NT(#{@span.left},#{@span.right})<#{@symbol},#{@index}>" end end -- cgit v1.2.3