From 143ef049494741ef37bbc2b73196692184cba3a0 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 28 Dec 2017 19:27:38 +1300 Subject: Eat whitespace before input label --- parser.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/parser.c b/parser.c index 0e9a90b..5b96739 100644 --- a/parser.c +++ b/parser.c @@ -53,6 +53,13 @@ expect(const char *expect, char *actual) { return 0; } +char * +eat_whitespace(char *string) { + while (*string && isspace(*string)) { + string++; + } + return string; +} int parse_uop(char *str, char *name, enum BINARY (*handler)(enum BINARY, enum BINARY)) { char *gate_name = str; @@ -138,6 +145,8 @@ parse_expr(char *str) { int parse_input(char *str) { strtok(str, " "); + str = eat_whitespace(str); + emit_info("Add input '%s'\n", str); gate_input_add(str); return 0; } -- cgit v1.1