You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program:
http://play.golang.org/p/f3VrIs2Z70
parses a syntactically well-formed Go program, inserts an additional statement, then
prints it out again. The result cannot be parsed because a newline was inserted in an
inappropriate place to accommodate a comment. Here's the output:
package P
func f() {
print("12"
/*hi*/)
g(0, 1)
}
Note that the length of the literal "12" is critical: if a shorter expression
is used, the /*hi*/ comment, which is retains its association with its original byte
offset, will not be inserted at that point.
The text was updated successfully, but these errors were encountered:
The current go/printer has its limitations, and one of them is that it relies crucially
on correct position information in the input AST. Arguably the input to the printer is
incorrect.
The text was updated successfully, but these errors were encountered: