Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(220)

Issue 224068: code review 224068: go/scanner: the position of '\n's chars must be the las... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years ago by gri
Modified:
15 years ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

go/scanner: the position of '\n's chars must be the last position of the current line Background: This didn't matter until recently, because '\n' don't appear as token starts in source code and thus the exact position was irrelevant (and set as was easiest in the code). With auto semicolon insertion, a virtual semicolon may be inserted when a '\n' is seen. The position of the semicolon is the position of the '\n'. Without this fix, these semicolons appeared on the next line instead of the line where they were inserted. This affected the association of comments to declarations in the parser. As a result, some lead comments where considered line comments, not collected in the ast, and not shown in godoc pages. (This affected only godoc pages, not gofmt-formatted programs). Fixes issue 592.

Patch Set 1 #

Patch Set 2 : code review 224068: go/scanner: the position of '\n's chars must be the las... #

Patch Set 3 : code review 224068: go/scanner: the position of '\n's chars must be the las... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -8 lines) Patch
M src/pkg/go/scanner/scanner.go View 4 chunks +8 lines, -6 lines 0 comments Download
M src/pkg/go/scanner/scanner_test.go View 2 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 3
gri
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
15 years ago (2010-02-26 02:49:47 UTC) #1
rsc
LGTM
15 years ago (2010-02-26 02:51:36 UTC) #2
gri
15 years ago (2010-02-26 19:23:26 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=b53a867d0db6 ***

go/scanner: the position of '\n's chars must be the last position of the current
line

Background: This didn't matter until recently, because '\n' don't appear as
token starts
in source code and thus the exact position was irrelevant (and set as was
easiest in the
code). With auto semicolon insertion, a virtual semicolon may be inserted when a
'\n' is
seen. The position of the semicolon is the position of the '\n'. Without this
fix, these
semicolons appeared on the next line instead of the line where they were
inserted.  This
affected the association of comments to declarations in the parser. As a result,
some
lead comments where considered line comments, not collected in the ast, and not
shown in
godoc pages. (This affected only godoc pages, not gofmt-formatted programs).

Fixes issue 592.

R=rsc
CC=golang-dev
http://codereview.appspot.com/224068
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b