summaryrefslogtreecommitdiff
path: root/grammar.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-18 08:28:36 +0200
committerPatrick Simianer <p@simianer.de>2014-06-18 08:28:36 +0200
commitd92209e3ec223a380c7ad540622caa15712c490c (patch)
tree91f985fc2d9726a4d1e9f7c86e17cbf7dd2b6ee6 /grammar.rb
parentae3bc3e1870d009c4d54c55416ebb4b7c07a483f (diff)
better integration, chart.to_json
Diffstat (limited to 'grammar.rb')
-rw-r--r--grammar.rb8
1 files changed, 5 insertions, 3 deletions
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