static pANTLR3_BASE_TREE createTypeTokenText (pANTLR3_BASE_TREE_ADAPTOR adaptor, ANTLR3_UINT32 tokenType, pANTLR3_COMMON_TOKEN fromToken, pANTLR3_UINT8 text) { /* Create the new token */ fromToken = adaptor->createTokenFromToken(adaptor, fromToken); /* Set the type of the new token to that supplied */ fromToken->setType(fromToken, tokenType); /* Set the text of the token accordingly */ fromToken->setText8(fromToken, text); /* Return a new node based upon this token */ return (pANTLR3_BASE_TREE)adaptor->create(adaptor, fromToken); }
static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token) { if (token->text != NULL) { return token->text; } if (token->type == ANTLR3_TOKEN_EOF) { token->setText8(token, (pANTLR3_UINT8)"<EOF>"); return token->text; } if (token->input != NULL) { return token->input->substr( token->input, token->getStartIndex(token), token->getStopIndex(token)); } /* Nothing to return */ return NULL; }