[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Include column in syntax error message
From: |
Chet Ramey |
Subject: |
Re: Include column in syntax error message |
Date: |
Mon, 28 Dec 2015 20:24:02 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/22/15 6:17 PM, Karl-Philipp Richter wrote:
> Hi,
> Currently, syntax error messages like ``bash: syntax error near
> unexpected token `;'``, e.g. after issuing `echo a &; echo b &; echo c
> &;` aren't as helpful as they could be. It'd be nice to know at which
> column, i.e. which `;`, the message refers to by adding the column to
> the error message, e.g. ``bash: syntax error near unexpected token `;'
> (col. y)``.
That's not easy to do with yacc/bison, which often reads one or more tokens
ahead before determining whether or not a syntax error occurred. That's
why the error message uses the token that caused the error, not the current
input string index.
- --
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: GPGTools - http://gpgtools.org
iEYEARECAAYFAlaB4KMACgkQu1hp8GTqdKu0ywCdG6JzYZJs10GiqElPKOgU+BZ9
puMAoJBril6ditjbFIAZM/Ec5d7BX1jq
=3YU/
-----END PGP SIGNATURE-----