2
* This file is part of the FortranProject plugin for Code::Blocks IDE
3
* and licensed under the GNU General Public License, version 3
4
* http://www.gnu.org/licenses/gpl-3.0.html
10
#include <wx/string.h>
11
#include <filemanager.h>
15
//bool cbRead(wxFile& file,wxString& st);
17
// Writes a wxString to a non-unicode file. File must be open. File is closed automatically.
18
//bool cbWrite(wxFile& file, const wxString& buff);
20
bool ReadFileToString(wxFile& file,wxString& st);
22
enum FortranSourceForm
31
Tokenizerf(const wxString& filename = wxEmptyString, FortranSourceForm sourceForm = fsfFree);
34
bool Init(const wxString& filename, FortranSourceForm sourceForm);
35
bool InitFromBuffer(const wxString& buffer, FortranSourceForm sourceForm);
37
wxString GetTokenSameLine();
38
wxString GetTokenSameFortranLine();
40
wxString PeekTokenSameFortranLine();
41
const wxString& GetFilename(){ return m_Filename; }
42
unsigned int GetLineNumber(){ return m_LineNumber; }
43
unsigned int GetPeekedLineNumber(){ return m_PeekedLineNumber; }
44
unsigned int GetCurrentIndex(){ return m_TokenIndex; }
45
unsigned int GetLineCount(){ return m_LineStartIdx.size(); }
46
bool IsOK(){ return m_IsOK; }
47
bool SkipToOneOfChars(const char* chars, bool toLineEnd = false);
48
wxArrayString GetTokensToEOL(wxArrayString* arrStrLines = 0);
49
wxArrayString PeekTokensToEOL();
50
wxString GetCurrentLine();
51
wxString GetLineFortran();
52
wxString GetLine(unsigned int nl);
53
unsigned int GetLineStartIndex(unsigned int indexInLine);
54
unsigned int GetLineEndIndex(unsigned int indexInLine);
55
void SetDetailedParsing(bool detPars);
56
void SetFilename(const wxString& filename);
61
wxString DoGetToken();
63
bool SkipWhiteSpace();
64
bool SkipToChar(const wxChar& ch, bool toLineEnd = false);
65
bool SkipBlock(const wxChar& ch, int maxLines = 0);
66
bool SkipUnwanted(); // skips comments, assignments, preprocessor etc.
67
bool IsEOF(){ return m_TokenIndex >= m_BufferLen; }
68
bool MoveToNextChar();
69
void AdjustLineNumber();
72
wxChar PreviousChar();
75
bool CharInString(const char ch, const char* chars);
78
unsigned int m_BufferLen;
79
unsigned int m_TokenIndex;
80
unsigned int m_UndoTokenIndex;
81
unsigned int m_PeekedTokenIndex;
82
unsigned int m_LineNumber;
83
unsigned int m_LineNumberStart;
84
unsigned int m_UndoLineNumber;
85
unsigned int m_UndoLineNumberStart;
86
unsigned int m_PeekedLineNumber;
87
unsigned int m_PeekedLineNumberStart;
88
unsigned int m_Column;
89
unsigned int m_UndoColumn;
90
unsigned int m_PeekedColumn;
92
bool m_UndoWasNextLine;
93
bool m_PeekedWasNextLine;
96
FortranSourceForm m_SourceForm;
97
wxString m_PeekedToken;
98
bool m_DetailedParsing;
99
std::vector<unsigned int> m_LineStartIdx;
102
#endif // FTOKINIZER_H