Skip to content

Commit

Permalink
Remove Abstract_Class_Contextual_Parser ?
Browse files Browse the repository at this point in the history
  • Loading branch information
KineticTheory committed Sep 12, 2021
1 parent 2c4f21a commit 65c06b6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 424 deletions.
30 changes: 1 addition & 29 deletions src/parser/Abstract_Class_Parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* \file parser/Abstract_Class_Parser.hh
* \author Kent Budge
* \brief Define class Abstract_Class_Parser
* \note Copyright (C) 2016-2021 Triad National Security, LLC., All rights reserved. */
* \note Copyright (C) 2010-2021 Triad National Security, LLC., All rights reserved. */
//------------------------------------------------------------------------------------------------//

#ifndef parser_Abstract_Class_Parser_hh
Expand All @@ -15,34 +15,6 @@

namespace rtt_parser {

//================================================================================================//
/*!
* \brief Closure class for wrapping context-dependent parse functions
*
* This template class is used to bind a get_context() function to a parse function requiring a
* context argument, so that the function can be called with the usual two parameters (Token_Stream
* and int) from an Abstract_Class_Parse_Table.
*
* See test/tstAbstract_Class_Contextual_Parser.cc for an example of how it is used.
*/
//================================================================================================//
template <typename Abstract_Class, typename Context, Context const &get_context()>
class Contextual_Parse_Functor {
public:
//! Primary constructor
Contextual_Parse_Functor(std::shared_ptr<Abstract_Class> parse_function(Token_Stream &,
Context const &))
: f_(parse_function) {}

//! Return handle to the parse function.
std::shared_ptr<Abstract_Class> operator()(Token_Stream &tokens) const {
return f_(tokens, get_context());
}

private:
std::shared_ptr<Abstract_Class> (*f_)(Token_Stream &, Context const &);
};

//================================================================================================//
/*!
* \class Abstract_Class_Parser
Expand Down
Loading

0 comments on commit 65c06b6

Please sign in to comment.