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 * Copyright (C) 2003 by the Board of Trustees of Leland Stanford 00011 * Junior University and by New York University. 00012 * 00013 * License to use, copy, modify, sell and/or distribute this software 00014 * and its documentation for any purpose is hereby granted without 00015 * royalty, subject to the terms and conditions defined in the \ref 00016 * LICENSE file provided with this distribution. In particular: 00017 * 00018 * - The above copyright notice and this permission notice must appear 00019 * in all copies of the software and related documentation. 00020 * 00021 * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES, 00022 * EXPRESSED OR IMPLIED. USE IT AT YOUR OWN RISK. 00023 * 00024 * <hr> 00025 * 00026 * A class used to communicate with the actual parser. No one else 00027 * should use it. 00028 */ 00029 /*****************************************************************************/ 00030 00031 #ifndef _CVC_lite__parser_temp_h_ 00032 #define _CVC_lite__parser_temp_h_ 00033 00034 #include "expr.h" 00035 #include "exception.h" 00036 00037 namespace CVCL { 00038 00039 class ValidityChecker; 00040 00041 class ParserTemp { 00042 private: 00043 // Counter for uniqueID of bound variables 00044 int d_uid; 00045 // The main prompt when running interactive 00046 std::string prompt1; 00047 // The interactive prompt in the middle of a multi-line command 00048 std::string prompt2; 00049 // The currently used prompt 00050 std::string prompt; 00051 public: 00052 ValidityChecker* vc; 00053 std::istream* is; 00054 // The current input line 00055 int lineNum; 00056 // File name 00057 std::string fileName; 00058 // The last parsed Expr 00059 Expr expr; 00060 // Whether we are done or not 00061 bool done; 00062 // Whether we are running interactive 00063 bool interactive; 00064 // Whether arrays are enabled for smt-lib format 00065 bool arrFlag; 00066 // Default constructor 00067 ParserTemp() : d_uid(0), prompt1("CVC> "), prompt2("- "), 00068 prompt("CVC> "), lineNum(1), done(false), arrFlag(false) { } 00069 // Parser error handling (implemented in parser.cpp) 00070 int error(const std::string& s) throw (Exception); 00071 // Get the next uniqueID as a string 00072 std::string uniqueID() { 00073 std::ostringstream ss; 00074 ss << d_uid++; 00075 return ss.str(); 00076 } 00077 // Get the current prompt 00078 std::string getPrompt() { return prompt; } 00079 // Set the prompt to the main one 00080 void setPrompt1() { prompt = prompt1; } 00081 // Set the prompt to the secondary one 00082 void setPrompt2() { prompt = prompt2; } 00083 }; 00084 00085 } // end of namespace CVCL 00086 00087 #endif