Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Andrew Reynolds 4 : : * 5 : : * This file is part of the cvc5 project. 6 : : * 7 : : * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS 8 : : * in the top-level source directory and their institutional affiliations. 9 : : * All rights reserved. See the file COPYING in the top-level source 10 : : * directory for licensing information. 11 : : * **************************************************************************** 12 : : * 13 : : * The smt2 command parser. 14 : : */ 15 : : 16 : : #include "cvc5parser_public.h" 17 : : 18 : : #ifndef CVC5__PARSER__SMT2_CMD_PARSER_H 19 : : #define CVC5__PARSER__SMT2_CMD_PARSER_H 20 : : 21 : : #include "parser/smt2/smt2_state.h" 22 : : #include "parser/smt2/smt2_lexer.h" 23 : : #include "parser/smt2/smt2_term_parser.h" 24 : : 25 : : namespace cvc5 { 26 : : namespace parser { 27 : : 28 : : class Command; 29 : : 30 : : /** 31 : : * The smt2 command parser, which parses commands. It reads from the given 32 : : * lexer, and relies on a term parser for parsing terms in the body of commands. 33 : : */ 34 : : class Smt2CmdParser 35 : : { 36 : : public: 37 : : Smt2CmdParser(Smt2Lexer& lex, Smt2State& state, Smt2TermParser& tparser); 38 : 22951 : virtual ~Smt2CmdParser() {} 39 : : /** 40 : : * Parse and return the next command, or nullptr if we are at the end of file. 41 : : */ 42 : : std::unique_ptr<Cmd> parseNextCommand(); 43 : : 44 : : protected: 45 : : /** Next command token */ 46 : : Token nextCommandToken(); 47 : : /** The lexer */ 48 : : Smt2Lexer& d_lex; 49 : : /** The state */ 50 : : Smt2State& d_state; 51 : : /** The term parser */ 52 : : Smt2TermParser& d_tparser; 53 : : /** Map strings to tokens */ 54 : : std::map<std::string, Token> d_table; 55 : : }; 56 : : 57 : : } // namespace parser 58 : : } // namespace cvc5 59 : : 60 : : #endif /* CVC5__PARSER__SMT2_H */