lib/Generator.rb in re_expand-0.0.3 vs lib/Generator.rb in re_expand-0.0.4
- old
+ new
@@ -24,16 +24,11 @@
@s = s
@substrings = substrings
@accept = accept
@state = state
end
-
- attr :id, true
- attr :s, true
- attr :substrings, true
- attr :accept, true
- attr :state, true
+ attr_accessor :id,:s,:substrings,:accept,:state
end
class Generator
def initialize(s = nil)
@s = (s ? [s] : [])
@@ -192,11 +187,17 @@
if t =~ /^[\?]$/ then
startnode.addTrans('',endnode)
elsif t =~ /^[\+]$/ then
endnode.addTrans('',startnode)
elsif t =~ /^[\*]$/ then
+ n = Node.new
startnode.addTrans('',endnode)
- endnode.addTrans('',startnode)
+ endnode.addTrans('',n)
+ n.addTrans('',startnode)
+
+ # ループがあるとマズいのか? 上のように修正すると動くようなのだが
+ #startnode.addTrans('',endnode)
+ #endnode.addTrans('',startnode)
else
s.ungettoken
end
return [startnode,endnode]
end