spec/rley/formatter/debug_spec.rb in rley-0.4.01 vs spec/rley/formatter/debug_spec.rb in rley-0.4.02
- old
+ new
@@ -1,11 +1,11 @@
require_relative '../../spec_helper'
require 'stringio'
require_relative '../support/grammar_abc_helper'
-require_relative '../../../lib/rley/parser/token'
-require_relative '../../../lib/rley/parser/earley_parser'
+require_relative '../../../lib/rley/tokens/token'
+require_relative '../../../lib/rley/parser/gfg_earley_parser'
require_relative '../../../lib/rley/ptree/parse_tree'
require_relative '../../../lib/rley/parse_tree_visitor'
# Load the class under test
require_relative '../../../lib/rley/formatter/debug'
@@ -28,15 +28,15 @@
# Helper method that mimicks the output of a tokenizer
# for the language specified by gramma_abc
let(:grm_abc_tokens1) do
[
- Parser::Token.new('a', a_),
- Parser::Token.new('a', a_),
- Parser::Token.new('b', b_),
- Parser::Token.new('c', c_),
- Parser::Token.new('c', c_)
+ Tokens::Token.new('a', a_),
+ Tokens::Token.new('a', a_),
+ Tokens::Token.new('b', b_),
+ Tokens::Token.new('c', c_),
+ Tokens::Token.new('c', c_)
]
end
# Factory method that builds a sample parse tree.
# Generated tree has the following structure:
@@ -49,11 +49,11 @@
# | | +- b[2,3]
# | +- c[3,4]
# +- c[4,5]
# Capital letters represent non-terminal nodes
let(:grm_abc_ptree1) do
- parser = Parser::EarleyParser.new(grammar_abc)
+ parser = Parser::GFGEarleyParser.new(grammar_abc)
parse_result = parser.parse(grm_abc_tokens1)
parse_result.parse_tree
end
let(:destination) { StringIO.new('', 'w') }
@@ -77,33 +77,33 @@
visitor = Rley::ParseTreeVisitor.new(grm_abc_ptree1)
instance.render(visitor)
expectations = <<-SNIPPET
before_ptree
before_non_terminal
- before_children
+ before_subnodes
before_non_terminal
- before_children
+ before_subnodes
before_terminal
after_terminal
before_non_terminal
- before_children
+ before_subnodes
before_terminal
after_terminal
before_non_terminal
- before_children
+ before_subnodes
before_terminal
after_terminal
- after_children
+ after_subnodes
after_non_terminal
before_terminal
after_terminal
- after_children
+ after_subnodes
after_non_terminal
before_terminal
after_terminal
- after_children
+ after_subnodes
after_non_terminal
- after_children
+ after_subnodes
after_non_terminal
after_ptree
SNIPPET
expect(destination.string).to eq(expectations)
end