lib/raabro.rb in raabro-1.1.2 vs lib/raabro.rb in raabro-1.1.3
- old
+ new
@@ -23,11 +23,11 @@
#++
module Raabro
- VERSION = '1.1.2'
+ VERSION = '1.1.3'
class Input
attr_accessor :string, :offset
attr_reader :options
@@ -100,10 +100,15 @@
def string
@input.string[@offset, @length]
end
+ def nonstring(l=7)
+
+ @input.string[@offset, l]
+ end
+
def lookup(name)
name = name ? name.to_s : nil
return self if @name && name == nil
@@ -527,17 +532,24 @@
nc = lc if tree.name == nil
sc = tree.result == 1 ? _yl : _dg
str =
if tree.children.size == 0
- " #{sc}#{tree.string.length == 0 ? "''" : tree.string.inspect}"
+ " #{sc}#{tree.string.length == 0 ?
+ "#{_dg} >#{tree.nonstring(14).inspect[1..-2]}<" :
+ tree.string.inspect}"
else
''
end
print "#{_dg}t---\n" if depth == 0
- print "#{' ' * depth}"
+ #print "#{' ' * depth}"
+ depth.times do |i|
+ pipe = i % 3 == 0 ? ': ' : '| '
+ print i.even? ? "#{_dg}#{pipe} " : ' '
+ end
+
print "#{lc}#{tree.result}"
print " #{nc}#{tree.name.inspect} #{lc}#{tree.offset},#{tree.length}"
print str
print "#{_rs}\n"