KDevelop API Documentation

lib/antlr/antlr/LexerSharedInputState.hpp

Go to the documentation of this file.
00001 #ifndef INC_LexerSharedInputState_hpp__ 00002 #define INC_LexerSharedInputState_hpp__ 00003 00004 /* ANTLR Translator Generator 00005 * Project led by Terence Parr at http://www.jGuru.com 00006 * Software rights: http://www.antlr.org/RIGHTS.html 00007 * 00008 * $Id: LexerSharedInputState.hpp,v 1.2 2003/05/02 00:36:19 okellogg Exp $ 00009 */ 00010 00011 #include <antlr/config.hpp> 00012 #include <antlr/InputBuffer.hpp> 00013 #include <antlr/RefCount.hpp> 00014 #include <antlr/CharBuffer.hpp> 00015 #include <string> 00016 00017 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 00018 namespace antlr { 00019 #endif 00020 00026 class ANTLR_API LexerInputState { 00027 public: 00032 LexerInputState(InputBuffer* inbuf) 00033 : column(1) 00034 , line(1) 00035 , tokenStartColumn(1) 00036 , tokenStartLine(1) 00037 , guessing(0) 00038 , filename("") 00039 , input(inbuf) 00040 , inputResponsible(true) 00041 { 00042 } 00043 00047 LexerInputState(InputBuffer& inbuf) 00048 : column(1) 00049 , line(1) 00050 , tokenStartColumn(1) 00051 , tokenStartLine(1) 00052 , guessing(0) 00053 , filename("") 00054 , input(&inbuf) 00055 , inputResponsible(false) 00056 { 00057 } 00058 00063 LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in) 00064 : column(1) 00065 , line(1) 00066 , tokenStartColumn(1) 00067 , tokenStartLine(1) 00068 , guessing(0) 00069 , filename("") 00070 , input(new CharBuffer(in)) 00071 , inputResponsible(true) 00072 { 00073 } 00074 00080 virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in, const char* file = "" ) 00081 { 00082 column = 1; 00083 line = 1; 00084 tokenStartColumn = 1; 00085 tokenStartLine = 1; 00086 guessing = 0; 00087 filename = file; 00088 00089 if( input && inputResponsible ) 00090 delete input; 00091 00092 input = new CharBuffer(in); 00093 inputResponsible = true; 00094 } 00095 00099 virtual void reset( void ) 00100 { 00101 column = 1; 00102 line = 1; 00103 tokenStartColumn = 1; 00104 tokenStartLine = 1; 00105 guessing = 0; 00106 input->reset(); 00107 } 00108 00113 void setPosition( int line_, int column_ ) 00114 { 00115 line = line_; 00116 column = column_; 00117 } 00118 00119 virtual ~LexerInputState() 00120 { 00121 if (inputResponsible) 00122 delete input; 00123 } 00124 00125 int column; 00126 int line; 00127 int tokenStartColumn; 00128 int tokenStartLine; 00129 int guessing; 00131 ANTLR_USE_NAMESPACE(std)string filename; 00132 InputBuffer& getInput(); 00133 private: 00135 InputBuffer* input; 00137 bool inputResponsible; 00138 00139 // we don't want these: 00140 LexerInputState(const LexerInputState&); 00141 LexerInputState& operator=(const LexerInputState&); 00142 }; 00143 00145 typedef RefCount<LexerInputState> LexerSharedInputState; 00146 00147 inline InputBuffer& LexerInputState::getInput() 00148 { 00149 return *input; 00150 } 00151 00152 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 00153 } 00154 #endif 00155 00156 #endif //INC_LexerSharedInputState_hpp__
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003