|
AndroMeta
2.0.0
|
00001 /* 00002 * Copyright 2009-2012 AndroMeta LLC. All rights reserved. 00003 * 00004 * AndroMeta LLC retains all intellectual property and proprietary 00005 * rights to this software and related documentation and any modifications 00006 * thereto. Any use, reproduction, disclosure, or distribution of this 00007 * software and related documentation without an express license agreement 00008 * from AndroMeta LLC is strictly prohibited. 00009 * 00010 */ 00011 00019 #ifndef ANDROMETA_M_PARSER_H 00020 #define ANDROMETA_M_PARSER_H 00021 00022 #include <ostream> 00023 00024 #include <AndroMeta/MNode.h> 00025 #include <AndroMeta/MEmitter.h> 00026 #include <AndroMeta/MVar.h> 00027 00028 namespace Meta{ 00029 00042 class MParser : public MEmitter{ 00043 public: 00044 00051 MParser(size_t historySize=50); 00052 00056 virtual ~MParser(); 00057 00067 bool readLine(const mstr& prompt, mstr& line); 00068 00085 mnode error(mnode n, 00086 const mstr& msg, 00087 bool warn=false, 00088 const mstr& type=""); 00089 00094 mnode func(const mstr& name) const; 00095 00100 mnode sym(const mstr& name) const; 00101 00106 mnode node(const mvar& v) const; 00107 00111 int& status(); 00112 00116 const mstr& fileName() const; 00117 00121 void setFileName(const mstr& fileName); 00122 00126 size_t& lineNumber(); 00127 00131 size_t& character(); 00132 00136 int& tokenId(); 00137 00141 bool reportErrors() const; 00142 00146 void setReportErrors(bool flag); 00147 00151 void submitError(const mvar& error); 00152 00156 const mvec& errors() const; 00157 00161 void clearErrors(); 00162 00167 void setErrorStream(std::ostream& estr); 00168 00169 private: 00170 MParser& operator=(const MParser&); 00171 MParser(const MParser&); 00172 00173 class MParser_* x_; 00174 }; 00175 00176 } // end namespace Meta 00177 00178 #endif // ANDROMETA_M_PARSER_H
1.7.6.1