spec/rley/support/grammar_ambig01_helper.rb in rley-0.4.06 vs spec/rley/support/grammar_ambig01_helper.rb in rley-0.4.07
- old
+ new
@@ -10,17 +10,16 @@
# (based on example in article on Earley's algorithm in Wikipedia)
def grammar_ambig01_builder()
builder = Rley::Syntax::GrammarBuilder.new do
add_terminals('integer', '+', '*')
rule 'P' => 'S'
- rule 'S' => %w(S + S)
- rule 'S' => %w(S * S)
+ rule 'S' => %w[S + S]
+ rule 'S' => %w[S * S]
rule 'S' => 'L'
rule 'L' => 'integer'
end
builder
end
-
# Highly simplified tokenizer implementation.
def tokenizer_ambig01(aText, aGrammar)
tokens = aText.scan(/\S+/).map do |lexeme|
case lexeme