From 660c715491c9d2079401a26d3ba9d329ff8b52e4 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 25 May 2014 17:17:58 +0200 Subject: fix --- parse.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/parse.rb b/parse.rb index fb14901..772edf5 100644 --- a/parse.rb +++ b/parse.rb @@ -42,9 +42,18 @@ class Item < Rule attr_accessor :lhs, :rhs, :dot def initialize rule_or_item, left, right, dot - @lhs = rule_or_item.lhs.dup - @rhs = rule_or_item.rhs.dup + @lhs = NT.new rule_or_item.lhs.symbol @lhs.span = Span.new left, right + @rhs = [] + rule_or_item.rhs.each { |x| + if x.class == T + @rhs << T.new(x.word) + end + if x.class == NT + @rhs << NT.new(x.symbol) + @rhs.last.span = Span.new x.span.left, x.span.right + end + } @dot = dot end -- cgit v1.2.3