void testAsserEqualOperatorToken(const char* str,OperatorToken* actual,int lineNo) {
    UNITY_TEST_ASSERT_NOT_NULL(actual,lineNo,"The token should not be NULL!");
    if( TOKEN_OPERATOR_TYPE != actual->type) {
        CUSTOM_TEST_FAIL(lineNo,"Expected %s was %s. The token type is not the same.",        \
                         getTokenTypeName(TOKEN_OPERATOR_TYPE),getTokenTypeName(actual->type));
    }
    UNITY_TEST_ASSERT_EQUAL_INT(strlen(str),actual->length,lineNo,"The length is not the same.");
    UNITY_TEST_ASSERT_EQUAL_STRING(str,actual->symbol,lineNo,"The operator is not the same");
}
Exemple #2
0
/** pushes a token with content */
void pushInitializedToken(Lexer *self, int type, char *content) {
	Token *tok = createToken(self->lineNumber, self->charNumber, self->fileName);
	tok->type = type;
	tok->content = content;
	verboseModeMessage("Lexed token: %-15s, type %s", tok->content, getTokenTypeName(tok->type));
	pushBackItem(self->tokenStream, tok);
}
Exemple #3
0
/** pushes a token with no content */
void pushToken(Lexer *self, int type) {
	Token *tok = createToken(self->lineNumber, self->charNumber, self->fileName);
	tok->type = type;
	tok->content = extractToken(self, self->startPos, self->pos - self->startPos);
	verboseModeMessage("Lexed token: %-15s, type %s", tok->content, getTokenTypeName(tok->type));
	pushBackItem(self->tokenStream, tok);
}
Exemple #4
0
Fichier : lexer.c Projet : 8l/ark-c
/** pushes a token with content */
void pushInitializedToken(Lexer *self, int type, char *content) {
	int tokenLength = self->pos - self->startPos; // The length (in characters) of this token
	Token *tok = createToken(self->lineNumber, self->startPos, self->charNumber - tokenLength, self->charNumber, self->fileName);
	tok->type = type;
	tok->content = content;
	verboseModeMessage("Lexed token: %-15s, type %s", tok->content, getTokenTypeName(tok->type));
	pushBackItem(self->tokenStream, tok);
}