From: Matthias Kruk Date: Sat, 20 Jun 2020 07:46:02 +0000 (+0900) Subject: token: Add token_value() method to get the lexeme of a token X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=3a86549a4039308bcc1a6121bcf14a647f285468;p=ccc token: Add token_value() method to get the lexeme of a token --- diff --git a/src/token.c b/src/token.c index 3baa0e3..05772d4 100644 --- a/src/token.c +++ b/src/token.c @@ -123,3 +123,8 @@ int token_cmp(struct token *tok, const char *str) value = str_value(tok->value); return(strcmp(value, str)); } + +const char* token_value(struct token *tok) +{ + return(str_value(tok->value)); +} diff --git a/src/token.h b/src/token.h index 87cb8ab..3f06ba3 100644 --- a/src/token.h +++ b/src/token.h @@ -108,5 +108,6 @@ int token_setvalue(struct token*, const char*); int token_append_str(struct token*, const char*); int token_append_char(struct token*, const char); int token_cmp(struct token*, const char*); +const char* token_value(struct token*); #endif /* TOKEN_H */