00001 /*****************************************************************************/ 00002 /*! 00003 * \file parser_temp.h 00004 * 00005 * Author: Sergey Berezin 00006 * 00007 * Created: Wed Feb 5 17:53:02 2003 00008 * 00009 * <hr> 00010 * 00011 * License to use, copy, modify, sell and/or distribute this software 00012 * and its documentation for any purpose is hereby granted without 00013 * royalty, subject to the terms and conditions defined in the \ref 00014 * LICENSE file provided with this distribution. 00015 * 00016 * <hr> 00017 * 00018 * A class used to communicate with the actual parser. No one else 00019 * should use it. 00020 */ 00021 /*****************************************************************************/ 00022 00023 #ifndef _cvc3__parser_temp_h_ 00024 #define _cvc3__parser_temp_h_ 00025 00026 #include "expr.h" 00027 #include "exception.h" 00028 00029 namespace CVC3 { 00030 00031 class ValidityChecker; 00032 00033 class ParserTemp { 00034 private: 00035 // Counter for uniqueID of bound variables 00036 int d_uid; 00037 // The main prompt when running interactive 00038 std::string prompt1; 00039 // The interactive prompt in the middle of a multi-line command 00040 std::string prompt2; 00041 // The currently used prompt 00042 std::string prompt; 00043 public: 00044 ValidityChecker* vc; 00045 std::istream* is; 00046 // The current input line 00047 int lineNum; 00048 // File name 00049 std::string fileName; 00050 // The last parsed Expr 00051 Expr expr; 00052 // Whether we are done or not 00053 bool done; 00054 // Whether we are running interactive 00055 bool interactive; 00056 // Whether arrays are enabled for smt-lib format 00057 bool arrFlag; 00058 // Whether bit-vectors are enabled for smt-lib format 00059 bool bvFlag; 00060 // Size of bit-vectors for smt-lib format 00061 int bvSize; 00062 // Did we encounter a formula query (smtlib) 00063 bool queryParsed; 00064 // Default constructor 00065 ParserTemp() : d_uid(0), prompt1("CVC> "), prompt2("- "), 00066 prompt("CVC> "), lineNum(1), done(false), arrFlag(false), queryParsed(false) { } 00067 // Parser error handling (implemented in parser.cpp) 00068 int error(const std::string& s); 00069 // Get the next uniqueID as a string 00070 std::string uniqueID() { 00071 std::ostringstream ss; 00072 ss << d_uid++; 00073 return ss.str(); 00074 } 00075 // Get the current prompt 00076 std::string getPrompt() { return prompt; } 00077 // Set the prompt to the main one 00078 void setPrompt1() { prompt = prompt1; } 00079 // Set the prompt to the secondary one 00080 void setPrompt2() { prompt = prompt2; } 00081 }; 00082 00083 } // end of namespace CVC3 00084 00085 #endif