diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-10-08 16:02:50 -0500 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-10-08 16:02:50 -0500 |
commit | baf7141d1dd0f99d561a2197a909c66dd389809d (patch) | |
tree | 92c176f713b0b28893344261b1e567db5e30ba79 /vendor/golang.org/x/text/internal/ucd | |
parent | 696aebffe56853345d679d4d2b3051236423c6db (diff) |
Update dependencies
Diffstat (limited to 'vendor/golang.org/x/text/internal/ucd')
-rw-r--r-- | vendor/golang.org/x/text/internal/ucd/ucd.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/vendor/golang.org/x/text/internal/ucd/ucd.go b/vendor/golang.org/x/text/internal/ucd/ucd.go index 2b0d1a1..60b27d5 100644 --- a/vendor/golang.org/x/text/internal/ucd/ucd.go +++ b/vendor/golang.org/x/text/internal/ucd/ucd.go @@ -78,6 +78,14 @@ func Part(f func(p *Parser)) Option { } } +// The CommentHandler option passes comments that are on a line by itself to +// a given handler. +func CommentHandler(f func(s string)) Option { + return func(p *Parser) { + p.commentHandler = f + } +} + // A Parser parses Unicode Character Database (UCD) files. type Parser struct { scanner *bufio.Scanner @@ -92,7 +100,8 @@ type Parser struct { parsedRange bool rangeStart, rangeEnd rune - partHandler func(p *Parser) + partHandler func(p *Parser) + commentHandler func(s string) } func (p *Parser) setError(err error) { @@ -138,7 +147,13 @@ func (p *Parser) Next() bool { for p.scanner.Scan() { b := p.scanner.Bytes() - if len(b) == 0 || b[0] == '#' { + if len(b) == 0 { + continue + } + if b[0] == '#' { + if p.commentHandler != nil { + p.commentHandler(strings.TrimSpace(string(b[1:]))) + } continue } |