lib/sequitur/formatter/base_text.rb in sequitur-0.1.17 vs lib/sequitur/formatter/base_text.rb in sequitur-0.1.18
- old
+ new
@@ -16,12 +16,10 @@
def initialize(anIO)
super(anIO)
@prod_lookup = {}
end
- public
-
# Method called by a GrammarVisitor to which the formatter subscribed.
# Notification of a visit event: the visitor is about to visit a grammar
# @param aGrammar [DynamicGrammar-like object]
def before_grammar(aGrammar)
aGrammar.productions.each_with_index do |a_prod, index|
@@ -80,10 +78,10 @@
# Generate a name of a given production.
# @param aProduction [Production]
def prod_name(aProduction)
prod_index = prod_lookup[aProduction]
- name = (prod_index == 0) ? 'start' : "P#{prod_index}"
+ name = prod_index.zero? ? 'start' : "P#{prod_index}"
return name
end
end # class
end # module
end # module