@@ 44,13 44,16 @@ is_whitespace (char c)
static bool
is_number (const char *begin, uintptr_t len)
{
- const char *cur = begin;
- if (*cur == '-')
+ uintptr_t cur = 0;
+ if (begin[cur] == '-')
cur++;
- while (++cur < begin + len)
- if (!(isdigit (*cur) || *cur == '.'))
- return false;
+ while (cur < len)
+ {
+ if (!(isdigit (begin[cur]) || begin[cur] == '.'))
+ return false;
+ cur++;
+ }
return true;
}
@@ 47,8 47,8 @@ test_lex (const char *programme, const l
}
if (expected_tokens[i].type != tok->type)
{
- fprintf (stderr, "Expected: %d, Actual: %d", expected_tokens[i].type,
- tok->type);
+ fprintf (stderr, "\nExpected: %d, Actual: %d",
+ expected_tokens[i].type, tok->type);
TEST_FAIL (
"Mismatched token types, see laal_lexer.h for variant names")
}