1
0
mirror of https://github.com/golang/go synced 2024-11-21 17:34:40 -07:00

gc: line comments may end in EOF

R=ken2
CC=golang-dev
https://golang.org/cl/2907041
This commit is contained in:
Russ Cox 2010-11-04 16:04:04 -04:00
parent 68b4255a96
commit 132e5435e3
2 changed files with 10 additions and 5 deletions

View File

@ -728,14 +728,10 @@ l0:
if(c1 == '/') { if(c1 == '/') {
c = getlinepragma(); c = getlinepragma();
for(;;) { for(;;) {
if(c == '\n') { if(c == '\n' || c == EOF) {
ungetc(c); ungetc(c);
goto l0; goto l0;
} }
if(c == EOF) {
yyerror("eof in comment");
errorexit();
}
c = getr(); c = getr();
} }
} }

9
test/eof1.go Normal file
View File

@ -0,0 +1,9 @@
// $G $D/$F.go
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// No newline at the end of this comment.