X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/fcd2239eb2849432269ba4456718b657fdff3972..61bd408cda6cc14d11bd9815828df2e8dec39bec:/avr/eval_arg.c diff --git a/avr/eval_arg.c b/avr/eval_arg.c index 020dd98..b931509 100644 --- a/avr/eval_arg.c +++ b/avr/eval_arg.c @@ -38,7 +38,7 @@ static void next(void) { do ch = *bp++; - while (ch == ' ' || ch == '\n'); + while (isspace(ch)); } static long number (void) @@ -76,10 +76,15 @@ static long factor (void) next(); else error (); + } else { + char sign = ch; + if (sign == '+' || sign == '-') { + next(); + } + f = number(); + if (sign == '-') + f = -f; } - else - f = number (); - return f; } @@ -109,16 +114,7 @@ static long term (void) static long expr(void) { - long e; - - if (ch == '+') { - next(); - e = term (); - } else if (ch == '-') { - next(); - e = - term (); - } else - e = term (); + long e = term (); while (ch == '+' || ch == '-') { char op = ch;