Improve selection parsing error reporting
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 2 Nov 2014 13:45:21 +0000 (15:45 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 5 Dec 2014 15:44:31 +0000 (16:44 +0100)
commitbb406f89de96e2fe21fdc302fae4581fb083554e
treee035cc22d1a092747a5e8c5bd3baf69ad907598a
parent404e52bbba48c735dd654954b6fd68c076d05507
Improve selection parsing error reporting

Now the selection parser tracks the part of selection text that
contributes to the current parsing context, and uses that for more
useful error messages.  At least in some cases, there is now also
context information for syntax errors, although this could likely be
improved further.

Exception handling during selection parsing is also improved:
 - The above context is now added to the exception, similar to what the
   old reporting mechanism does.
 - The full selection is added to the exception as context, also for
   non-interactive parsing.
 - More consistent exception handling, e.g., in cases where an exception
   is thrown during error handling.

Improve documentation for related functions.

Part of #655.

Change-Id: Ib276ce4e219692c9819e45a1637e3660d958803f
14 files changed:
src/gromacs/selection/parser.cpp
src/gromacs/selection/parser.h
src/gromacs/selection/parser.patch
src/gromacs/selection/parser.y
src/gromacs/selection/parser_internal.h
src/gromacs/selection/parsetree.cpp
src/gromacs/selection/parsetree.h
src/gromacs/selection/scanner.cpp
src/gromacs/selection/scanner.h
src/gromacs/selection/scanner.l
src/gromacs/selection/scanner_internal.cpp
src/gromacs/selection/scanner_internal.h
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selelem.h