void compileDoWhileSt(void) { assert("Parsing a do..while statement ...."); // TODO eat(KW_DO); compileStatement(); eat(KW_WHILE); compileCondition(); assert("Do..While statement parsed ...."); void compileForSt(void) { Type* varType; Type *type; eat(KW_FOR); varType = compileLValue(); eat(SB_ASSIGN); type = compileExpression(); checkTypeEquality(varType, type); eat(KW_TO); type = compileExpression(); checkTypeEquality(varType, type); eat(KW_DO); compileStatement(); }
void compileIfSt(void) { eat(KW_IF); compileCondition(); eat(KW_THEN); compileStatement(); if (lookAhead->tokenType == KW_ELSE) compileElseSt(); }
void compileWhileSt(void) { assert("Parsing a while statement ...."); eat(KW_WHILE); compileCondition(); eat(KW_DO); compileStatement(); assert("While statement pased ...."); }
void compileDoWhileSt(void) { assert("Parsing a do..while statement ...."); // TODO eat(KW_DO); compileStatement(); eat(KW_WHILE); compileCondition(); assert("Do..While statement parsed ...."); }
void compileIfSt(void) { assert("Parsing an if statement ...."); eat(KW_IF); compileCondition(); eat(KW_THEN); compileStatement(); if (lookAhead->tokenType == KW_ELSE) compileElseSt(); assert("If statement parsed ...."); }
void compileWhileSt(void) { assert("Parsing a while statement ...."); // TODO eat(KW_WHILE); compileCondition(); eat(KW_DO); compileStatement(); //chu y check lai cho nay assert("While statement parsed ...."); }
Op* RegularExpression::compile(const Token* const token, Op* const next, const bool reverse) { Op* ret = 0; const unsigned short tokenType = token->getTokenType(); switch(tokenType) { case Token::T_DOT: case Token::T_CHAR: case Token::T_ANCHOR: case Token::T_RANGE: case Token::T_NRANGE: case Token::T_STRING: case Token::T_BACKREFERENCE: case Token::T_EMPTY: ret = compileSingle(token, next, tokenType); break; case Token::T_CONCAT: ret = compileConcat(token, next, reverse); break; case Token::T_UNION: ret = compileUnion(token, next, reverse); break; case Token::T_CLOSURE: case Token::T_NONGREEDYCLOSURE: ret = compileClosure(token, next, reverse, tokenType); break; case Token::T_PAREN: ret = compileParenthesis(token, next, reverse); break; case Token::T_LOOKAHEAD: case Token::T_NEGATIVELOOKAHEAD: ret = compileLook(token, next, false, tokenType); break; case Token::T_LOOKBEHIND: case Token::T_NEGATIVELOOKBEHIND: ret = compileLook(token, next, true, tokenType); break; case Token::T_INDEPENDENT: case Token::T_MODIFIERGROUP: ret = compileLook(token, next, reverse, tokenType); break; case Token::T_CONDITION: ret = compileCondition(token, next, reverse); break; default: ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_UnknownTokenType, fMemoryManager); break; // this line to be deleted } return ret; }
void compileWhileSt(void) { CodeAddress beginWhile; Instruction* fjInstruction; beginWhile = getCurrentCodeAddress(); eat(KW_WHILE); compileCondition(); fjInstruction = genFJ(DC_VALUE); eat(KW_DO); compileStatement(); genJ(beginWhile); updateFJ(fjInstruction, getCurrentCodeAddress()); }
void compileIfSt(void) { Instruction* fjInstruction; Instruction* jInstruction; eat(KW_IF); compileCondition(); eat(KW_THEN); fjInstruction = genFJ(DC_VALUE); compileStatement(); if (lookAhead->tokenType == KW_ELSE) { jInstruction = genJ(DC_VALUE); updateFJ(fjInstruction, getCurrentCodeAddress()); eat(KW_ELSE); compileStatement(); updateJ(jInstruction, getCurrentCodeAddress()); } else { updateFJ(fjInstruction, getCurrentCodeAddress()); } }
void compileWhileSt(void) { eat(KW_WHILE); compileCondition(); eat(KW_DO); compileStatement(); }