2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
39 void StartTokenParsing (const char *data)
46 bool WINAPI GetToken (bool crossline)
50 if (unget) // is a token allready waiting?
60 while (*script_p <= 32)
65 common->Printf("Warning: Line %i is incomplete [01]\n",scriptline);
68 if (*script_p++ == '\n')
71 common->Printf("Warning: Line %i is incomplete [02]\n",scriptline);
76 if (script_p[0] == '/' && script_p[1] == '/') // comment field
79 common->Printf("Warning: Line %i is incomplete [03]\n",scriptline);
80 while (*script_p++ != '\n')
84 common->Printf("Warning: Line %i is incomplete [04]\n",scriptline);
98 //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally
100 while ( *script_p != '"' )
103 Error ("EOF inside quoted token");
104 *token_p++ = *script_p++;
105 if (token_p == &token[MAXTOKEN])
106 Error ("Token too large on line %i",scriptline);
109 //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally
112 else while ( *script_p > 32 )
114 *token_p++ = *script_p++;
115 if (token_p == &token[MAXTOKEN])
116 Error ("Token too large on line %i",scriptline);
124 void WINAPI UngetToken (void)
134 Returns true if there is another token on the line
137 bool TokenAvailable (void)
139 const char *search_p;
143 while ( *search_p <= 32)
145 if (*search_p == '\n')
152 if (*search_p == ';')