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

go/parser: implement line directives that allow column information #24143

Closed
griesemer opened this issue Feb 27, 2018 · 2 comments
Closed

go/parser: implement line directives that allow column information #24143

griesemer opened this issue Feb 27, 2018 · 2 comments
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge
Milestone

Comments

@griesemer
Copy link
Contributor

This is tracking bug for the go/* library part of #22662: Enable line directives that allow column information.

@griesemer griesemer added the early-in-cycle A change that should be done early in the 3 month dev cycle. label Feb 27, 2018
@griesemer griesemer added this to the Go1.11 milestone Feb 27, 2018
@griesemer griesemer self-assigned this Feb 27, 2018
@gopherbot
Copy link

Change https://golang.org/cl/97795 mentions this issue: go/scanner: recognize //line and /*line directives incl. columns

@gopherbot
Copy link

Change https://golang.org/cl/99621 mentions this issue: go/printer: simplify handling of line directives

gopherbot pushed a commit that referenced this issue Mar 9, 2018
Strangely enough, the existing implementation used adjusted (by line
directives) source positions to determine layout and thus required
position corrections when printing a line directive.

Instead, just use the unadjusted, absolute source positions and then
printing a line directive doesn't require any adjustments, only some
care to make sure it remains in column 1 as before.

The new code doesn't need to parse line directives anymore and simply
ensures that comments with the //line prefix and starting in column 1
remain in that position. That is a slight change from the old behavior
(which ignored incorrect line directives, e.g. because they had an
invalid line number) but unlikely to show up in real code.

This is prep work for handling of line directives that also specify
columns (which now won't require much special handling anymore).

For #24143.

Change-Id: I07eb2e1b35b37337e632e3dbf5b70c783c615f8a
Reviewed-on: https://go-review.googlesource.com/99621
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Mar 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants