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