diff options
author | Camil Staps | 2018-04-03 19:53:08 +0200 |
---|---|---|
committer | Camil Staps | 2018-04-03 19:53:08 +0200 |
commit | 4ecf8f54cd0ea04fa39469f5f7ea021e15c5e178 (patch) | |
tree | 59329b47453f613894c305549387ba8d7742cf0a | |
parent | Resolve #5: list notation shortcut in patterns (diff) |
Fix some minor bugs
-rw-r--r-- | interpreter/eval.c | 4 | ||||
-rw-r--r-- | interpreter/lex.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/interpreter/eval.c b/interpreter/eval.c index aa70e5a..b82f9b2 100644 --- a/interpreter/eval.c +++ b/interpreter/eval.c @@ -114,8 +114,8 @@ bool match_expr(struct fuspel *rules, struct expression *expr, struct node **nod if ((int) (*node)->kind != (int) expr->kind) return 0; - if (!expr->var1) - return (*node)->var1 == NULL; + if (!expr->var1 || !(*node)->var1) + return expr->var1 == (*node)->var1; return match_expr(rules, expr->var1, (struct node**) &(*node)->var1, _repls) && diff --git a/interpreter/lex.c b/interpreter/lex.c index 497ee8e..c33d816 100644 --- a/interpreter/lex.c +++ b/interpreter/lex.c @@ -5,11 +5,11 @@ #include "mem.h" -inline bool is_space_char(char input) { +static inline bool is_space_char(char input) { return input == '\t' || input == ' ' || input == '\n' || input == '\r'; } -inline bool is_int_char(char input) { +static inline bool is_int_char(char input) { return '0' <= input && input <= '9'; } @@ -20,7 +20,7 @@ unsigned char lex_int_length(char *input) { return n; } -inline bool is_name_char(char input) { +static inline bool is_name_char(char input) { return (('A' <= input && input <= 'Z') || ('a' <= input && input <= 'z') || input == '_'); |