OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
tokenizer.h
1/*
2===========================================================================
3Copyright (C) 2023 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23// tokenizer.h : Tokenizer
24
25#pragma once
26
27class Tokenizer
28{
29 char *pBuffer;
30 char *pEnd;
31 int iLength;
32 char *pCurrent;
33 int iLine;
34 int iError;
35 bool fTokenReady;
36 char szToken[256];
37
38public:
39 Tokenizer();
40 Tokenizer(const char *pInputBuffer, int iBufferLength);
41
42 void SetBuffer(const char *pInputBuffer, int iBufferLength);
43 void Reset();
44 int GetLineNumber();
45 bool HasError();
46 int GetError();
47 bool SkipToEOL();
48 bool CheckOverflow();
49 bool SkipWhiteSpace(bool fCrossLine);
50 bool AtComment();
51 void SkipNonToken(bool fCrossLine);
52 bool TokenAvailable(bool fCrossLine);
53 bool CommentAvailable(bool fCrossLine);
54 void UnGetToken();
55 bool AtString(bool fCrossLine);
56 char *GetToken(bool fCrossLine);
57 char *GetLine(bool fCrossLine);
58 char *GetRaw();
59 char *GetString(bool fCrossLine);
60 bool GetSpecific(const char *szString);
61 int GetInteger(bool fCrossLine);
62 double GetDouble(bool fCrossLine);
63 float GetFloat(bool fCrossLine);
64 int LinesInFile();
65 char *Token();
66 char *GetCurrentPointer();
67};