script: fix parse_word()
With the `c > ' '` requirement we can't have an assertion for length in there.
This commit is contained in:
parent
8fde2e72aa
commit
8ece6a4f64
|
@ -469,13 +469,16 @@ parse_word (struct tokenizer *self)
|
||||||
struct buffer buf = BUFFER_INITIALIZER;
|
struct buffer buf = BUFFER_INITIALIZER;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
// Here we accept almost anything that doesn't break the grammar...
|
// Here we accept almost anything that doesn't break the grammar
|
||||||
while (!strchr (" []\"", (c = *self->cursor++)) && (unsigned char) c > ' ')
|
while (!strchr (" []\"", (c = *self->cursor++)) && (unsigned char) c > ' ')
|
||||||
buffer_append_c (&buf, c);
|
buffer_append_c (&buf, c);
|
||||||
self->cursor--;
|
self->cursor--;
|
||||||
|
|
||||||
// ...so an empty word can only mean a bug within our caller.
|
if (!buf.len)
|
||||||
assert (buf.len != 0);
|
{
|
||||||
|
self->error = "invalid input";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct item *item = new_word (buf.s, buf.len);
|
struct item *item = new_word (buf.s, buf.len);
|
||||||
free (buf.s);
|
free (buf.s);
|
||||||
|
|
Loading…
Reference in New Issue