diff options
Diffstat (limited to 'src/parse.c')
| -rw-r--r-- | src/parse.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c index 79c1dc4..fcaab5d 100644 --- a/src/parse.c +++ b/src/parse.c @@ -23,6 +23,11 @@ sym_t* init_sym_int(int value) { *vp = value; return init_sym(LITERAL, INT, vp); } +sym_t* init_sym_float(float value) { + int* vp = malloc(sizeof(float)); + *vp = value; + return init_sym(LITERAL, FLOAT, vp); +} sym_t* init_sym_str(char* value) { char* vp = malloc((strlen(value) + 1) * sizeof(char)); strcpy(vp, value); @@ -77,7 +82,7 @@ symset_t* parse_symbols(char** str) { symbolSet->count = 0; while (1) { /* clear whitespace */ - while (!isalnum(**str) && **str != '(' && **str != ')' && **str != '\0') { + while (!isalnum(**str) && **str != '-' && **str != '(' && **str != ')' && **str != '\0') { (*str)++; } if (**str == ')') { |
