// Copyright {Jagger Software Limited} 2003 #ifndef GRAMMAR_TOOLS_TREE_BUILDING_PARSEABLE_SOURCE_INCLUDED #define GRAMMAR_TOOLS_TREE_BUILDING_PARSEABLE_SOURCE_INCLUDED #include "ast/standard_symbol_factory.hpp" #include "ast/symbol.hpp" #include "grammar_tools/parseable_source.hpp" #include namespace ast { template class symbol; } namespace grammar_tools { template class tree_building_parseable_source // <> : public parseable_source // <> { public: // 'tors tree_building_parseable_source(iterator, iterator); public: // tree build typedef ::ast::symbol symbol_type; const symbol_type * extract_tree(); public: // parsing using parseable_source::parse; virtual bool parse(const ::grammar::production_symbol_definition &, ::grammar::visitor &); virtual bool parse(const ::grammar:: qualified_symbol_definition &, ::grammar::visitor &); virtual bool reposition(const ::grammar::symbol_definition &, iterator, iterator); private: // implementation void tree_grow(symbol_type *); void tree_graft(); symbol_type * tree_lop(); private: // tree state ::std::stack tree; ::ast::standard_symbol_factory symbol_factory; }; } #include "grammar_tools/tree_building_parseable_source-template.hpp" #endif