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

Error reporting #44

Open
ademenev opened this issue Jun 1, 2022 · 2 comments
Open

Error reporting #44

ademenev opened this issue Jun 1, 2022 · 2 comments

Comments

@ademenev
Copy link

ademenev commented Jun 1, 2022

Is there a way to report errors when input cannot be parsed?

@ph1lm
Copy link

ph1lm commented Jul 22, 2022

👍 +1 to the question ^

@ph1lm
Copy link

ph1lm commented Jul 22, 2022

The only way I found how to report errors is:

scanner := p.NewScanner([]byte(str))

result, next := parser(scanner)

if !next.Endof() {
  return fmt.Errorf("failed to parse '%s' char number %d", str, next.GetCursor())
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants