# Getting information about syntactic errors

**URL:** <https://discuss.codemirror.net/t/getting-information-about-syntactic-errors/3628>\
**Category:** Lezer\
**Created:** [October 14, 2021, 5:01pm UTC](https://discuss.codemirror.net/t/getting-information-about-syntactic-errors/3628 "2021-10-14T17:01:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfc-gh-nlele](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/sfc-gh-nlele/32/1105_2.png) [@sfc-gh-nlele](https://discuss.codemirror.net/u/sfc-gh-nlele)\
**Post date:** [October 14, 2021, 5:01pm UTC](https://discuss.codemirror.net/t/getting-information-about-syntactic-errors/3628/1 "2021-10-14T17:01:44Z")

</div>

Hi, we’re working on getting syntactic errors from queries, with our Lezer grammar.

In this, we have a query like below, where `replace` and `api` are misspelled as ‘replac’ and ‘ap’,

```auto
create or replac ap integration foobar
    api_provider=aws_api_gateway
    api_aws_role_arn='arn:aws:iam::123456789012:role/my_cloud_account_role'
    api_allowed_prefixes=('https://xyz.execute-api.us-west-2.amazonaws.com/production')
    enabled=true;

```

these are the errors we get.

Only the first two are wanted since the rest of tokens are okay. Is there any way to retrieve only the ‘important’ errors, for example the ones that are mis-spelled?

| | Errors: |
| --- | --- |
| | Error near replac |
| | Error near ap |
| | Error near integration |
| | Error near foobar |
| | Error near api\_provider |
| | Error near = |
| | Error near aws\_api\_gateway |
| | Error near api\_aws\_role\_arn |
| | Error near = |
| | Error near ‘arn:aws:iam::123456789012:role/my\_cloud\_account\_role’ |
| | Error near api\_allowed\_prefixes |
| | Error near = |
| | Error near ( |
| | Error near ‘[https://xyz.execute-api.us-west-2.amazonaws.com/production](https://xyz.execute-api.us-west-2.amazonaws.com/production)’ |
| | Error near ) |
| | Error near enabled |
| | Error near = |
| | Error near true |
| | Error near ; |

Is this mainly due to error insensitivity of the Lezer parser system? We ran this with a different parser, and the result was, only the first mis-spelled instance pointed as an error, so only `Error near replace`.

Is it possible to stop this “cascading” of errors?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [October 14, 2021, 9:02pm UTC](https://discuss.codemirror.net/t/getting-information-about-syntactic-errors/3628/2 "2021-10-14T21:02:05Z")

</div>

No. The parser isn’t always able to figure out the most likely parse, and might just completely lose its way for some kinds of invalid syntax.
