MCPcopy Create free account
hub / github.com/OpenMW/openmw / parseKeyword

Method parseKeyword

components/compiler/controlparser.cpp:188–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 }
187
188 bool ControlParser::parseKeyword(int keyword, const TokenLoc& loc, Scanner& scanner)
189 {
190 if (mState == StartState)
191 {
192 if (keyword == Scanner::K_if || keyword == Scanner::K_elseif)
193 {
194 if (keyword == Scanner::K_elseif)
195 getErrorHandler().warning("elseif without matching if", loc);
196
197 mExprParser.reset();
198 scanner.scan(mExprParser);
199
200 mState = IfEndState;
201 return true;
202 }
203 else if (keyword == Scanner::K_while)
204 {
205 mExprParser.reset();
206 scanner.scan(mExprParser);
207
208 mState = WhileEndState;
209 return true;
210 }
211 }
212 else if (mState == IfBodyState || mState == IfElseifBodyState || mState == IfElseBodyState)
213 {
214 if (parseIfBody(keyword, loc, scanner))
215 return true;
216 }
217 else if (mState == WhileBodyState)
218 {
219 if (parseWhileBody(keyword, loc, scanner))
220 return true;
221 }
222 else if (mState == IfElseJunkState)
223 {
224 getErrorHandler().warning("Extra text after else", loc);
225 SkipParser skip(getErrorHandler(), getContext());
226 scanner.scan(skip);
227 mState = IfElseBodyState;
228 return true;
229 }
230
231 return Parser::parseKeyword(keyword, loc, scanner);
232 }
233
234 bool ControlParser::parseSpecial(int code, const TokenLoc& loc, Scanner& scanner)
235 {

Callers 2

parseIfBodyMethod · 0.45
parseWhileBodyMethod · 0.45

Calls 3

warningMethod · 0.80
scanMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected