From d92209e3ec223a380c7ad540622caa15712c490c Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 18 Jun 2014 08:28:36 +0200 Subject: better integration, chart.to_json --- grammar.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'grammar.rb') diff --git a/grammar.rb b/grammar.rb index 6c95de2..2ff3af1 100644 --- a/grammar.rb +++ b/grammar.rb @@ -93,8 +93,10 @@ class Grammar def initialize fn @rules = []; @startn = []; @startt = []; @flat = [] + n = 0 ReadFile.readlines_strip(fn).each_with_index { |s,i| - STDERR.write '.'; STDERR.write " #{i+1}\n" if (i+1)%80==0 + STDERR.write '.'; STDERR.write " #{i+1}\n" if (i+1)%40==0 + n += 1 @rules << Rule.from_s(s) if @rules.last.rhs.first.class == NT @startn << @rules.last @@ -106,7 +108,7 @@ class Grammar end end } - STDERR.write "\n" + STDERR.write " #{n}\n" end def to_s @@ -131,5 +133,5 @@ class Grammar end -end # module +end #module -- cgit v1.2.3