]> git.corax.cc Git - ccc/commitdiff
token: Add token_value() method to get the lexeme of a token
authorMatthias Kruk <m@m10k.eu>
Sat, 20 Jun 2020 07:46:02 +0000 (16:46 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 20 Jun 2020 07:46:02 +0000 (16:46 +0900)
src/token.c
src/token.h

index 3baa0e39e214d21cace1e2e98f02a441b3ef658d..05772d47008efa07ff4b9b8e28e4da8d259e39be 100644 (file)
@@ -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));
+}
index 87cb8ab28ad8ebb8ced6f5172a0b021226bd2be7..3f06ba31198dd8a8af2817fae8497d9ccdb5c094 100644 (file)
@@ -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 */