File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ func (s *Scanner) scanComment() (string, error) {
88 switch ch {
99 case '/' :
1010 for ch != '\n' {
11- if s .isEOF () {
12- return lit , s .unexpected (eof , "\n " )
13- }
1411 lit += string (ch )
1512
13+ if s .isEOF () {
14+ return lit , nil
15+ }
1616 ch = s .read ()
1717 }
1818 case '*' :
Original file line number Diff line number Diff line change @@ -305,6 +305,26 @@ fugafuga
305305 },
306306 },
307307 },
308+ {
309+ name : "scan a comment without a newline" ,
310+ input : `
311+ // hogehoge` ,
312+ mode : scanner .ScanComment ,
313+ wants : []want {
314+ {
315+ token : scanner .TCOMMENT ,
316+ text : "// hogehoge" ,
317+ pos : scanner.Position {
318+ Position : meta.Position {
319+
320+ Offset : 1 ,
321+ Line : 2 ,
322+ Column : 1 ,
323+ },
324+ },
325+ },
326+ },
327+ },
308328 {
309329 name : "scan strLits" ,
310330 input : `"" '' "abc" 'あいう' "\x1fzz" '\123\n\\'` ,
You can’t perform that action at this time.
0 commit comments