diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 23:43:25 -0700 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 23:43:25 -0700 |
| commit | e9ca0738a4b18032151af42baca1f88629408d52 (patch) | |
| tree | bf264d9a029589a61c057acb00f15d4b675e3b90 /src | |
| parent | ca31bda6b8dd27d59c053a4f391164496577f479 (diff) | |
| download | stage-e9ca0738a4b18032151af42baca1f88629408d52.tar.gz stage-e9ca0738a4b18032151af42baca1f88629408d52.tar.bz2 stage-e9ca0738a4b18032151af42baca1f88629408d52.tar.xz stage-e9ca0738a4b18032151af42baca1f88629408d52.zip | |
While loops work perfectly :)
Diffstat (limited to 'src')
| -rw-r--r-- | src/gamestate.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gamestate.cpp b/src/gamestate.cpp index 3f09c3f..902d0a9 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp | |||
| @@ -366,7 +366,30 @@ void GameState::parse( const AstBranch::NodeList &lCode ) | |||
| 366 | break; | 366 | break; |
| 367 | 367 | ||
| 368 | case AstNode::tForEach: | 368 | case AstNode::tForEach: |
| 369 | |||
| 370 | break; | ||
| 371 | |||
| 369 | case AstNode::tWhile: | 372 | case AstNode::tWhile: |
| 373 | { | ||
| 374 | AstBranch::NodeList lWhile = | ||
| 375 | dynamic_cast<const AstBranch *>(*i)->getNodeList(); | ||
| 376 | AstBranch::NodeList::const_iterator iTest = lWhile.begin(); | ||
| 377 | AstBranch::NodeList::const_iterator iDo = iTest+1; | ||
| 378 | |||
| 379 | for(;;) | ||
| 380 | { | ||
| 381 | parse( dynamic_cast<const AstBranch *>(*iTest)-> | ||
| 382 | getNodeList() ); | ||
| 383 | Variable v = popDeref(); | ||
| 384 | if( v.getType() != Variable::tBool ) | ||
| 385 | throw Bu::ExceptionBase("conditional did not evaluate to boolean."); | ||
| 386 | if( !v.getBool() ) | ||
| 387 | break; | ||
| 388 | |||
| 389 | parse( dynamic_cast<const AstBranch *>(*iDo)-> | ||
| 390 | getNodeList() ); | ||
| 391 | } | ||
| 392 | } | ||
| 370 | break; | 393 | break; |
| 371 | } | 394 | } |
| 372 | 395 | ||
