void compileBlock(void) { Object* constObj; ConstantValue* constValue; if (lookAhead->tokenType == KW_CONST) { eat(KW_CONST); do { eat(TK_IDENT); checkFreshIdent(currentToken->string); constObj = createConstantObject(currentToken->string); eat(SB_EQ); constValue = compileConstant(); constObj->constAttrs->value = constValue; declareObject(constObj); eat(SB_SEMICOLON); } while (lookAhead->tokenType == TK_IDENT); compileBlock2(); } else compileBlock2(); }
void compileConstDecl(void) { // TODO eat(TK_IDENT); eat(SB_EQ); compileConstant(); eat(SB_SEMICOLON); }
void compileBlock(void) { Object* constObj; ConstantValue* constValue; if (lookAhead->tokenType == KW_CONST) { eat(KW_CONST); do { eat(TK_IDENT); // TODO: Check if a constant identifier is fresh in the block checkFreshIdent(currentToken->string); // Create a constant object constObj = createConstantObject(currentToken->string); eat(SB_EQ); // Get the constant value constValue = compileConstant(); constObj->constAttrs->value = constValue; // Declare the constant object declareObject(constObj); eat(SB_SEMICOLON); } while (lookAhead->tokenType == TK_IDENT); compileBlock2(); } else compileBlock2(); }
void compileConstDecl(void) { // TODO assert("Parsing constant..."); eat(TK_IDENT); eat(SB_EQ); compileConstant(); eat(SB_SEMICOLON); assert("Constant parsed!"); }
void compileConstDecl(void) { // TODO if(lookAhead->tokenType != TK_IDENT) error(ERR_INVALIDCONSTDECL, lookAhead->lineNo, lookAhead->colNo); eat(TK_IDENT); eat(SB_EQ); compileConstant(); eat(SB_SEMICOLON); }
void compileBlock(void) { // TODO: create and declare constant objects# Object * obj = NULL; if (lookAhead->tokenType == KW_CONST) { eat(KW_CONST); do { eat(TK_IDENT); obj = createConstantObject(currentToken->string); eat(SB_EQ); obj->constAttrs->value = compileConstant(); eat(SB_SEMICOLON); declareObject(obj); } while (lookAhead->tokenType == TK_IDENT); compileBlock2(); } else compileBlock2(); }