aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2014-08-13 12:53:50 -0700
committerRobert Griesemer <gri@golang.org>2014-08-13 12:53:50 -0700
commite9bbcea81d90890a04155d81300b59a71a47472d (patch)
tree275d55752abe88d2b9fe3b078965b623ddbd3f99 /src/pkg
parent078a9cbc6cf539074ae975debc5d5396352d16b7 (diff)
downloadgo-e9bbcea81d90890a04155d81300b59a71a47472d.tar.xz
text/scanner: improve documentation
LGTM=r R=r CC=golang-codereviews https://golang.org/cl/123390043
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/text/scanner/scanner.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/text/scanner/scanner.go b/src/pkg/text/scanner/scanner.go
index 25b2c9e02a..5199ee4fc7 100644
--- a/src/pkg/text/scanner/scanner.go
+++ b/src/pkg/text/scanner/scanner.go
@@ -66,6 +66,12 @@ func (pos Position) String() string {
//
// ScanIdents | ScanInts | SkipComments
//
+// With the exceptions of comments, which are skipped if SkipComments is
+// set, unrecognized tokens are not ignored. Instead, the scanner simply
+// returns the respective individual characters (or possibly sub-tokens).
+// For instance, if the mode is ScanIdents (not ScanStrings), the string
+// "foo" is scanned as the token sequence '"' Ident '"'.
+//
const (
ScanIdents = 1 << -Ident
ScanInts = 1 << -Int