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

Problem : Parser errors are not informative. #402

Closed
crocket opened this issue Sep 14, 2016 · 6 comments
Closed

Problem : Parser errors are not informative. #402

crocket opened this issue Sep 14, 2016 · 6 comments
Assignees
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. journal The journal file format, and its features. timedot The timedot file format.

Comments

@crocket
Copy link
Contributor

crocket commented Sep 14, 2016

commodity BTC
  note Bitcoin

When I parse the above journal with hledger, it should report that note is not a supported subdirective of commodity directive.

Instead, the parser reports the following error.

hledger: ledger.journal:1:1:
unexpected 'c'
expecting end of input or transaction or directive

The same happens when account directive contains unsupported subdirectives and when the end of a journal file is not a new line. When the end of a journal file is not a newline, the parser reports an error at the beginning of the last transaction or any last directive.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@simonmichael simonmichael added A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. journal The journal file format, and its features. labels Sep 14, 2016
@simonmichael
Copy link
Owner

Agreed, thanks.

@simonmichael simonmichael modified the milestone: 1.1 Dec 29, 2016
@karanahuja-android
Copy link

I started using timedot format and created a new file with contents :
2016/2/2
client1 .... ....
research .

but i got error -
using conversion rules file /karanahuja.timedot.rules
hledger: "/karanahuja.timedot" (line 2, column 1):
unexpected 'i'
expecting journal transaction or directive or end of input

@simonmichael
Copy link
Owner

That looks strange. I can't reproduce here with hledger 1.2..

@simonmichael simonmichael added the timedot The timedot file format. label May 1, 2017
@ony ony added the in progress label Nov 3, 2017
@ony ony self-assigned this Nov 3, 2017
@ony
Copy link
Collaborator

ony commented Nov 3, 2017

@crocket I agree that errors sometimes quiet hard to understand because of excessive backtracking in journal parser.

Note that it is hard to identify "not supported" because it means that we should already partially support that sub-directive in parser. On the other hand most of the parser able to generate meaningful error message with their expectations. Example:

hledger: -:2:3:
unexpected 'n'
expecting "format"

@ony
Copy link
Collaborator

ony commented Nov 27, 2017

With newer MegaParsec you can get even better error report:

hledger: -:2:3:
unexpected "note B"
expecting "format"

ony added a commit to ony/hledger that referenced this issue Nov 27, 2017
Effectively improves error reporting for directives.

Resolves simonmichael#402
simonmichael pushed a commit that referenced this issue Nov 27, 2017
Effectively improves error reporting for directives.

Resolves #402
@simonmichael
Copy link
Owner

The specific error reported by this issue has been improved: #640 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. journal The journal file format, and its features. timedot The timedot file format.
Projects
None yet
Development

No branches or pull requests

4 participants