Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log messages generated even by failing parsers #3447

Closed
jgm opened this issue Feb 15, 2017 · 0 comments
Closed

Log messages generated even by failing parsers #3447

jgm opened this issue Feb 15, 2017 · 0 comments
Labels
Milestone

Comments

@jgm
Copy link
Owner

jgm commented Feb 15, 2017

Since we're handling log messages outside of parsec's own state mechanism, we now get log messages even for parsers that fail. This leads to repeated, and in some cases misleading messages.

Example:

% pandoc -f rst
`click here`__

.. _link1: link2_
.. _link2: link1_

__ link1_
^D
WARNING Circular reference 'link1' at line 1 column 15
WARNING Circular reference 'link1' at line 1 column 15
WARNING Circular reference 'link1' at line 1 column 15
<p><a href="">click here</a></p>

Why do we get three messages? Well, first we're parsing the first line looking for a field list, then we're parsing for something else, then a paragraph.

Previously we used updateState from parsec to add messages to state. This worked well, because an update in a parser that fails is rolled back, so we'd only get one message.

A band-aid would be to go through the list and remove duplicates. But better to design so these duplicates don't occur. Especially because in some cases they may be misleading.

@jgm jgm changed the title log messages even on failing parsers Log messages generated even by failing parsers Feb 15, 2017
@jgm jgm added this to the pandoc 2.0 milestone Feb 15, 2017
@jgm jgm added the reader label Feb 17, 2017
jgm added a commit that referenced this issue Feb 17, 2017
We need to do logging by updating parser state, or we'll get
inappropriate and repeated log messages when there is parser
backtracking.

See #3447.
jgm added a commit that referenced this issue Feb 17, 2017
See #3447.  To complete fixes on this issue, we need to
do the same for the other readers.  Note that the changes
required are minimal -- add reportLogMessages to the end
of the main parser, and replace report with logMessage.
(except for trace)
@jgm jgm closed this as completed Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant