1
0
mirror of https://github.com/golang/go synced 2024-11-25 00:07:56 -07:00

feat(comments): improve comment versatility

This commit enhances the versatility of comments in the codebase, providing clearer and more informative documentation for developers via ability to include direct urls.
This commit is contained in:
Anton Zavodchikov 2024-03-31 14:50:52 -07:00
parent d49a14c609
commit 9b36fa51b9

View File

@ -101,6 +101,29 @@ redo:
s.line, s.col = s.pos() s.line, s.col = s.pos()
s.blank = s.line > startLine || startCol == colbase s.blank = s.line > startLine || startCol == colbase
s.start() s.start()
if isLetter(s.ch) {
s.nextch()
// accelerate common case (7bit ASCII)
for isLetter(s.ch) || isDecimal(s.ch) {
s.nextch()
}
// protocol case (ex. http:// or https://)
if s.ch == ':' {
s.nextch()
if s.ch == '/' {
s.nextch()
if s.ch == '/' {
s.nextch()
s.lineComment()
goto redo
}
}
}
s.rewind()
}
if isLetter(s.ch) || s.ch >= utf8.RuneSelf && s.atIdentChar(true) { if isLetter(s.ch) || s.ch >= utf8.RuneSelf && s.atIdentChar(true) {
s.nextch() s.nextch()
s.ident() s.ident()