diff options
author | Patrick Simianer <p@simianer.de> | 2014-05-25 17:17:58 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-05-25 17:17:58 +0200 |
commit | 660c715491c9d2079401a26d3ba9d329ff8b52e4 (patch) | |
tree | d2905b434cc360a1d6f98e7b9e91b0b7145f4508 | |
parent | e97fbb5a38b79e18699719634d8156a590a3bf3d (diff) |
fix
-rw-r--r-- | parse.rb | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |