Sat, 14 Jul 2012 15:44:38 +0300
Restructured the command def parser, added parameter lists to definition file.
0 | 1 | /* |
2 | * botc source code | |
3 | * Copyright (C) 2012 Santeri `Dusk` Piippo | |
4 | * All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright notice, | |
10 | * this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright notice, | |
12 | * this list of conditions and the following disclaimer in the documentation | |
13 | * and/or other materials provided with the distribution. | |
3 | 14 | * 3. Neither the name of the developer nor the names of its contributors may |
15 | * be used to endorse or promote products derived from this software without | |
16 | * specific prior written permission. | |
0 | 17 | * 4. Redistributions in any form must be accompanied by information on how to |
18 | * obtain complete source code for the software and any accompanying | |
19 | * software that uses the software. The source code must either be included | |
20 | * in the distribution or be available for no more than the cost of | |
21 | * distribution plus a nominal fee, and must be freely redistributable | |
22 | * under reasonable conditions. For an executable file, complete source | |
23 | * code means the source code for all modules it contains. It does not | |
24 | * include source code for modules or files that typically accompany the | |
25 | * major components of the operating system on which the executable file | |
26 | * runs. | |
27 | * | |
28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
32 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
34 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
36 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
37 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
38 | * POSSIBILITY OF SUCH DAMAGE. | |
39 | */ | |
40 | ||
41 | #include <stdio.h> | |
42 | #include <stdlib.h> | |
43 | #include "string.h" | |
44 | #include "str.h" | |
45 | #include "common.h" | |
46 | #include "scriptreader.h" | |
47 | ||
8
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
48 | bool IsDelimeter (char c) { |
0 | 49 | // These characters are invisible, thus considered whitespace |
50 | if (c <= 32 || c == 127 || c == 255) | |
51 | return true; | |
52 | ||
53 | return false; | |
54 | } | |
55 | ||
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
56 | ScriptReader::ScriptReader (str path) { |
8
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
57 | extdelimeters = false; |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
58 | atnewline = false; |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
59 | filepath = path; |
2
bb2c45522eb6
Added event definitions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
60 | if (!(fp = fopen (path, "r"))) { |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
61 | error ("couldn't open %s for reading!\n", path.chars ()); |
2
bb2c45522eb6
Added event definitions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
62 | exit (1); |
bb2c45522eb6
Added event definitions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
63 | } |
0 | 64 | |
65 | curline = 1; | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
66 | curchar = 1; |
0 | 67 | pos = 0; |
68 | token = ""; | |
69 | } | |
70 | ||
1
f0c61c204bc8
Added support for #include directives, added basic header and statistics printing.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
71 | ScriptReader::~ScriptReader () { |
f0c61c204bc8
Added support for #include directives, added basic header and statistics printing.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
72 | fclose (fp); |
f0c61c204bc8
Added support for #include directives, added basic header and statistics printing.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
73 | } |
f0c61c204bc8
Added support for #include directives, added basic header and statistics printing.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
74 | |
0 | 75 | char ScriptReader::ReadChar () { |
76 | char* c = (char*)malloc (sizeof (char)); | |
77 | if (!fread (c, sizeof (char), 1, fp)) | |
78 | return 0; | |
79 | ||
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
80 | // We're at a newline, thus next char read will begin the next line |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
81 | if (atnewline) { |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
82 | atnewline = false; |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
83 | curline++; |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
84 | curchar = 0; // gets incremented to 1 |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
85 | } |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
86 | |
0 | 87 | if (c[0] == '\n') |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
88 | atnewline = true; |
0 | 89 | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
90 | curchar++; |
0 | 91 | return c[0]; |
92 | } | |
93 | ||
94 | // true if was found, false if not. | |
95 | bool ScriptReader::Next () { | |
96 | str tmp = ""; | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
97 | bool dontreadnext = false; |
0 | 98 | while (!feof (fp)) { |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
99 | c = ReadChar (); |
0 | 100 | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
101 | // Extended delimeters: basically any non-alnum characters. |
8
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
102 | // These delimeters break the word too. If there was prior data, |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
103 | // the delimeter pushes the cursor back so that the next character |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
104 | // will be the same delimeter. If there isn't, the delimeter itself |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
105 | // is included (and thus becomes a token itself.) |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
106 | bool shouldBreak = false; |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
107 | if (extdelimeters) { |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
108 | if ((c >= 33 && c <= 47) || |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
109 | (c >= 58 && c <= 64) || |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
110 | // underscore isn't a delimeter |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
111 | (c >= 91 && c <= 96 && c != 95) || |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
112 | (c >= 123 && c <= 126)) { |
8
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
113 | if (tmp.len()) |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
114 | fseek (fp, ftell (fp) - 1, SEEK_SET); |
8
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
115 | else |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
116 | tmp += c; |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
117 | shouldBreak = true; |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
118 | break; |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
119 | } |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
120 | } |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
121 | if (shouldBreak) |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
122 | break; |
c8bfa7e6ae1b
Commands are now read properly.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
123 | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
124 | if (IsDelimeter (c)) { |
0 | 125 | // Don't break if we haven't gathered anything yet. |
126 | if (tmp.len()) | |
127 | break; | |
128 | } else { | |
129 | tmp += c; | |
130 | } | |
131 | } | |
132 | ||
133 | // If we got nothing here, read failed. | |
134 | if (!tmp.len()) { | |
135 | token = ""; | |
136 | return false; | |
137 | } | |
138 | ||
139 | pos++; | |
140 | token = tmp; | |
141 | return true; | |
142 | } | |
143 | ||
144 | // Returns the next token without advancing the cursor. | |
145 | str ScriptReader::PeekNext () { | |
146 | // Store current position | |
147 | int cpos = ftell (fp); | |
148 | ||
149 | // Advance on the token. | |
150 | if (!Next ()) | |
151 | return ""; | |
152 | ||
153 | str tmp = token; | |
154 | ||
155 | // Restore position | |
156 | fseek (fp, cpos, SEEK_SET); | |
157 | pos--; | |
158 | ||
159 | return tmp; | |
160 | } | |
161 | ||
162 | void ScriptReader::Seek (unsigned int n, int origin) { | |
163 | switch (origin) { | |
164 | case SEEK_SET: | |
165 | fseek (fp, 0, SEEK_SET); | |
166 | pos = 0; | |
167 | break; | |
168 | case SEEK_CUR: | |
169 | break; | |
170 | case SEEK_END: | |
171 | printf ("ScriptReader::Seek: SEEK_END not yet supported.\n"); | |
172 | break; | |
173 | } | |
174 | ||
175 | for (unsigned int i = 0; i < n+1; i++) | |
176 | Next(); | |
177 | } | |
178 | ||
179 | void ScriptReader::MustNext (const char* c) { | |
180 | if (!Next()) { | |
181 | if (strlen (c)) | |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
182 | ParserError ("expected `%s`, reached end of file instead\n", c); |
0 | 183 | else |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
184 | ParserError ("expected a token, reached end of file instead\n"); |
0 | 185 | } |
186 | ||
187 | if (strlen (c) && token.compare (c) != 0) { | |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
188 | ParserError ("expected `%s`, got `%s` instead", c, token.chars()); |
0 | 189 | } |
190 | } | |
191 | ||
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
192 | void ScriptReader::ParserError (const char* message, ...) { |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
193 | PERFORM_FORMAT (message, outmessage); |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
194 | ParserMessage ("\nParse error\n", outmessage); |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
195 | exit (1); |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
196 | } |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
197 | |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
198 | void ScriptReader::ParserWarning (const char* message, ...) { |
0 | 199 | PERFORM_FORMAT (message, outmessage); |
7
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
200 | ParserMessage ("Warning: ", outmessage); |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
201 | } |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
202 | |
118d3d5db64f
Improved error handling; added parser warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
203 | void ScriptReader::ParserMessage (const char* header, char* message) { |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
204 | fprintf (stderr, "%sIn file %s, at line %u, col %u: %s\n", |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
205 | header, filepath.chars(), curline, curchar, message); |
9
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
206 | } |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
207 | |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
208 | // I guess this should be a void function putting the return value into token? |
9
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
209 | str ScriptReader::MustGetString () { |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
210 | if (!extdelimeters) |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
211 | ParserError ("MustGetString doesn't work with parsers not using extended delimeters!"); |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
212 | |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
213 | MustNext ("\""); |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
214 | |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
215 | str string; |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
216 | // Keep reading characters until we find a terminating quote. |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
217 | while (1) { |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
218 | // can't end here! |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
219 | if (feof (fp)) |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
220 | ParserError ("unterminated string"); |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
221 | |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
222 | char c = ReadChar (); |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
223 | if (c == '"') |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
224 | break; |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
225 | |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
226 | string += c; |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
227 | } |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
228 | |
d279af9afd6d
Added proper string checking
Teemu Piippo <crimsondusk64@gmail.com>
parents:
8
diff
changeset
|
229 | return string; |
10
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
230 | } |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
231 | |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
232 | void ScriptReader::MustNumber () { |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
233 | MustNext (); |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
234 | if (!token.isnumber()) |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
235 | ParserError ("expected a number, got `%s`", token.chars()); |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
236 | } |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
237 | |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
238 | void ScriptReader::MustBool () { |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
239 | MustNext(); |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
240 | if (!token.compare ("0") || !token.compare ("1") || |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
241 | !token.compare ("true") || !token.compare ("false") || |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
242 | !token.compare ("yes") || !token.compare ("no")) { |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
243 | return; |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
244 | } |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
245 | |
2c0f76090372
Restructured the command def parser, added parameter lists to definition file.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
9
diff
changeset
|
246 | ParserError ("expected a boolean value, got `%s`", token.chars()); |
0 | 247 | } |