Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
go/parser: implement line directives that allow column information #24143
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 <email@example.com>