From 98cc12a3729c63e7dc46f5e74003d4df8b335c82 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 8 Jan 2020 12:16:24 +0000 Subject: Skip whitespace before tokens, too. Bug found by bentley@ with input like "delim $$ delim off". --- eqn.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'eqn.c') diff --git a/eqn.c b/eqn.c index 3d63382a..27f5cac3 100644 --- a/eqn.c +++ b/eqn.c @@ -1,7 +1,7 @@ -/* $Id: eqn.c,v 1.83 2018/12/14 06:33:14 schwarze Exp $ */ +/* $Id: eqn.c,v 1.84 2020/01/08 12:16:24 schwarze Exp $ */ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons - * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze + * Copyright (c) 2014,2015,2017,2018,2020 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -399,6 +399,14 @@ eqn_next(struct eqn_node *ep, enum parse_mode mode) case '"': quoted = 1; break; + case ' ': + case '\t': + case '~': + case '^': + if (quoted) + break; + ep->start++; + continue; default: break; } @@ -669,7 +677,7 @@ eqn_parse(struct eqn_node *ep) if (ep->data == NULL) return; - ep->start = ep->end = ep->data + strspn(ep->data, " ^~"); + ep->start = ep->end = ep->data; next_tok: tok = eqn_next(ep, MODE_TOK); -- cgit v1.2.3-56-ge451