1 /*****************************************************************************/ 2 /*! 3 * \file parser_temp.h 4 * 5 * Author: Sergey Berezin 6 * 7 * Created: Wed Feb 5 17:53:02 2003 8 * 9 * <hr> 10 * 11 * License to use, copy, modify, sell and/or distribute this software 12 * and its documentation for any purpose is hereby granted without 13 * royalty, subject to the terms and conditions defined in the \ref 14 * LICENSE file provided with this distribution. 15 * 16 * <hr> 17 * 18 * A class used to communicate with the actual parser. No one else 19 * should use it. 20 */ 21 /*****************************************************************************/ 22 23 #ifndef _cvc3__parser_temp_h_ 24 #define _cvc3__parser_temp_h_ 25 26 #include "expr.h" 27 #include "exception.h" 28 29 namespace CVC3 { 30 31 class ValidityChecker; 32 class Translator; 33 34 class ParserTemp { 35 private: 36 // Counter for uniqueID of bound variables 37 int d_uid; 38 // The main prompt when running interactive 39 std::string prompt1; 40 // The interactive prompt in the middle of a multi-line command 41 std::string prompt2; 42 // The currently used prompt 43 std::string prompt; 44 public: 45 ValidityChecker* vc; 46 Translator* translator; 47 std::istream* is; 48 // The current input line 49 int lineNum; 50 // File name 51 std::string fileName; 52 // The last parsed Expr 53 Expr expr; 54 // Whether we are done or not 55 bool done; 56 // Whether we are running interactive 57 bool interactive; 58 // Whether arrays are enabled for smt-lib format 59 bool arrFlag; 60 // Whether bit-vectors are enabled for smt-lib format 61 bool bvFlag; 62 // Size of bit-vectors for smt-lib format 63 int bvSize; 64 // Did we encounter a formula query (smtlib) 65 bool queryParsed; 66 // Default constructor ParserTemp()67 ParserTemp() : d_uid(0), prompt1("CVC> "), prompt2("- "), 68 prompt("CVC> "), lineNum(1), done(false), arrFlag(false), queryParsed(false) { } 69 // Parser error handling (implemented in parser.cpp) 70 int error(const std::string& s); 71 // Get the next uniqueID as a string uniqueID()72 std::string uniqueID() { 73 std::ostringstream ss; 74 ss << d_uid++; 75 return ss.str(); 76 } 77 // Get the current prompt getPrompt()78 std::string getPrompt() { return prompt; } 79 // Set the prompt to the main one setPrompt1()80 void setPrompt1() { prompt = prompt1; } 81 // Set the prompt to the secondary one setPrompt2()82 void setPrompt2() { prompt = prompt2; } 83 }; 84 85 } // end of namespace CVC3 86 87 #endif 88