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

Fix lloc tracking for multi line blockrefs #2035

Merged
merged 4 commits into from May 19, 2018

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented May 14, 2018

The issue I noticed while finishing up a previous PR was that line tracking got broken by 2e196c3. While fixing the problem I've also improved error logging a bit more, which I've piggybacked to the same branch.

cfg-lex.l: fix location tracking for multi-line block-refs

For tokens that span multiple lines (in our case this only happens when
a block-ref is parsed that spans multiple lines), we blew up the line
number counter, so whenever reporting locations or errors we got an
incorrect value.

This patch fixes that by shifting to the new line number relative to
last_line, instead of simply increasing the first_line.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@furiel
Copy link
Collaborator

furiel commented May 15, 2018

Whops I forgot travis is failing before approve. When the style check problem is fixed, this pr is ready to be merged imo.

bazsi added 4 commits May 19, 2018 23:40
For tokens that span multiple lines (in our case this only happens when
a block-ref is parsed that spans multiple lines), we blew up the line
number counter, so whenever reporting locations or errors we got an
incorrect value.

This patch fixes that by shifting to the new line number relative to
last_line, instead of simply increasing the first_line.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
…vel configuration

We are user friendly by pointing users to the mailing list address when
reporting an error, however we did that even in cases where the error
happened in a recursive grammar, possibly printing it multiple
times. Avoid that by checking if we are indeed in the main parser.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Even in the case the block ref parsing fails, report a location that
spans the entire reference, just like in the true branch.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Whenever we report a syntax error, we include a description of the current
context. However this description was pretty concise a bit too much,
this patch improves those to make the error message easier to understand.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
@MrAnno MrAnno force-pushed the fix-lloc-tracking-for-multi-line-blockrefs branch from 1fa2234 to a8f2636 Compare May 19, 2018 21:41
@bazsi
Copy link
Collaborator Author

bazsi commented May 19, 2018 via email

@MrAnno
Copy link
Collaborator

MrAnno commented May 19, 2018

I've fixed it for you :)

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@MrAnno MrAnno merged commit b908a49 into master May 19, 2018
@MrAnno MrAnno deleted the fix-lloc-tracking-for-multi-line-blockrefs branch May 19, 2018 22:48
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

Successfully merging this pull request may close these issues.

None yet

4 participants