From 1bd7f709f5217b248fcb3a4c7be2eeca84fec795 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Dec 2011 15:53:38 -0700 Subject: This commit...I dunno I'm using a different version of everything, and I don't know if it's forward compatible or not. --- src/astbranch.cpp | 2 +- src/astnode.cpp | 1 + src/astnode.h | 1 + src/functiondisplay.cpp | 2 +- src/gamestate.cpp | 4 ++++ src/parser.y | 5 +++-- test.stage | 11 ++++++++++- 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/astbranch.cpp b/src/astbranch.cpp index a422a62..e506d9c 100644 --- a/src/astbranch.cpp +++ b/src/astbranch.cpp @@ -31,7 +31,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &b ) { f << "(Branch " << b.getType() << ": "; f.incIndent(); - for( typename AstBranch::NodeList::const_iterator i = b.lNodes.begin(); + for( AstBranch::NodeList::const_iterator i = b.lNodes.begin(); i; i++ ) { f << f.nl << *(*i); diff --git a/src/astnode.cpp b/src/astnode.cpp index 7191292..d7295b3 100644 --- a/src/astnode.cpp +++ b/src/astnode.cpp @@ -39,6 +39,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, AstNode::Type t ) case AstNode::tMultiplyStore: return f << "tMultiplyStore"; case AstNode::tNegate: return f << "tNegate"; case AstNode::tIn: return f << "tIn"; + case AstNode::tGoto: return f << "tGoto"; case AstNode::tLeafLiteral: return f << "!tLeafLiteral!"; case AstNode::tVarName: return f << "tVarName"; diff --git a/src/astnode.h b/src/astnode.h index 28e5336..c0a8eea 100644 --- a/src/astnode.h +++ b/src/astnode.h @@ -29,6 +29,7 @@ public: tMultiplyStore = 0x01000011, tNegate = 0x01000012, tIn = 0x01000013, + tGoto = 0x01000014, tLeafLiteral = 0x02000000, tVarName = 0x02000001, diff --git a/src/functiondisplay.cpp b/src/functiondisplay.cpp index 16b1175..332a2c9 100644 --- a/src/functiondisplay.cpp +++ b/src/functiondisplay.cpp @@ -15,7 +15,7 @@ FunctionDisplay::~FunctionDisplay() Variable FunctionDisplay::call( class GameState &gState ) { - Variable v = gState.pop(); + Variable v = gState.popDeref(); sio << "Display: " << v << sio.nl; } diff --git a/src/gamestate.cpp b/src/gamestate.cpp index cd6414c..4cab5c1 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -5,6 +5,9 @@ #include "astleaf.h" #include "astleafliteral.h" +#include +using namespace Bu; + GameState::GameState( Game *pGame ) : pGame( pGame ) { @@ -115,6 +118,7 @@ void GameState::parse( const AstBranch::NodeList &lCode ) { for( AstBranch::NodeList::const_iterator i = lCode.begin(); i; i++ ) { + sio << "Stack: " << lStack << sio.nl; switch( (*i)->getType() ) { // tLeaf diff --git a/src/parser.y b/src/parser.y index 8f538a5..ffb6da2 100644 --- a/src/parser.y +++ b/src/parser.y @@ -12,7 +12,8 @@ typedef void *yyscan_t; %locations -%define api.pure +%pure-parser +/* %define api.pure */ %debug %error-verbose @@ -149,7 +150,7 @@ cmpltExprList: ; cmpltExpr: expr ';' - | tokGoto '(' expr ')' ';' + | tokGoto '(' expr ')' ';' { bld.addNode( AstNode::tGoto ); } | ifbase | tokFor tokEach forIterator tokIn expr tokDo '{' cmpltExprList '}' | tokWhile { diff --git a/test.stage b/test.stage index 04d959b..2b6e567 100644 --- a/test.stage +++ b/test.stage @@ -18,11 +18,20 @@ situation <> setup { name = "Bob"; - display("Hello " + name + ''' and then some'''); + display("This is the setup phase for start, " + name); + display("???"); } enter { + display('''This is the enter part of the start situation'''); } } +situation <> +{ + enter + { + display('''Entered stuff'''); + } +} -- cgit v1.2.3