From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 71a3b72d for ; Wed, 8 Jan 2020 07:16:27 -0500 (EST) Date: Wed, 8 Jan 2020 07:16:27 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Skip whitespace before tokens, too. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Skip whitespace before tokens, too. Bug found by bentley@ with input like "delim $$ delim off". Modified Files: -------------- mandoc: eqn.c mandoc/regress/eqn/delim: Makefile basic.in basic.out_ascii Added Files: ----------- mandoc/regress/eqn/delim: basic.out_utf8 Revision Data ------------- Index: eqn.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/eqn.c,v retrieving revision 1.83 retrieving revision 1.84 diff -Leqn.c -Leqn.c -u -p -r1.83 -r1.84 --- eqn.c +++ eqn.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * 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 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); Index: Makefile =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/eqn/delim/Makefile -Lregress/eqn/delim/Makefile -u -p -r1.2 -r1.3 --- regress/eqn/delim/Makefile +++ regress/eqn/delim/Makefile @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile,v 1.2 2020/01/08 10:50:54 schwarze Exp $ +# $OpenBSD: Makefile,v 1.3 2020/01/08 12:09:14 schwarze Exp $ REGRESS_TARGETS = basic +UTF8_TARGETS = basic GOPTS = -e SKIP_GROFF = --- /dev/null +++ regress/eqn/delim/basic.out_utf8 @@ -0,0 +1,10 @@ +DELIM-BASIC(1) General Commands Manual DELIM-BASIC(1) + +NNAAMMEE + ddeelliimm--bbaassiicc – inline eqn delimiters + +DDEESSCCRRIIPPTTIIOONN + initial text α inline β γ inline [delta] ε inline ζ inline $eta$ inline θ + final text + +OpenBSD January 8, 2020 OpenBSD Index: basic.out_ascii =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/basic.out_ascii,v retrieving revision 1.4 retrieving revision 1.5 diff -Lregress/eqn/delim/basic.out_ascii -Lregress/eqn/delim/basic.out_ascii -u -p -r1.4 -r1.5 --- regress/eqn/delim/basic.out_ascii +++ regress/eqn/delim/basic.out_ascii @@ -5,6 +5,6 @@ NNAAMMEE DDEESSCCRRIIPPTTIIOONN initial text inline inline [delta] - inline final text + inline inline $eta$ inline final text OpenBSD January 8, 2020 OpenBSD Index: basic.in =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/basic.in,v retrieving revision 1.3 retrieving revision 1.4 diff -Lregress/eqn/delim/basic.in -Lregress/eqn/delim/basic.in -u -p -r1.3 -r1.4 --- regress/eqn/delim/basic.in +++ regress/eqn/delim/basic.in @@ -1,4 +1,4 @@ -.\" $OpenBSD: basic.in,v 1.3 2020/01/08 10:58:09 schwarze Exp $ +.\" $OpenBSD: basic.in,v 1.4 2020/01/08 12:09:14 schwarze Exp $ .Dd $Mdocdate$ .Dt DELIM-BASIC 1 .Os @@ -19,4 +19,13 @@ inline [delta] delim onepsilon .EN inline [zeta] +.EQ +delim $$ +delim off +.EN +inline $eta$ +.EQ +delim on +.EN +inline $theta$ final text -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv