summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/internal/number/pattern.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/text/internal/number/pattern.go')
-rw-r--r--vendor/golang.org/x/text/internal/number/pattern.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/vendor/golang.org/x/text/internal/number/pattern.go b/vendor/golang.org/x/text/internal/number/pattern.go
index 2714b7318..018cf02d5 100644
--- a/vendor/golang.org/x/text/internal/number/pattern.go
+++ b/vendor/golang.org/x/text/internal/number/pattern.go
@@ -31,14 +31,14 @@ import (
// TODO: replace special characters in affixes (-, +, ยค) with control codes.
-// Format holds information for formatting numbers. It is designed to hold
+// Pattern holds information for formatting numbers. It is designed to hold
// information from CLDR number patterns.
//
// This pattern is precompiled for all patterns for all languages. Even though
// the number of patterns is not very large, we want to keep this small.
//
// This type is only intended for internal use.
-type Format struct {
+type Pattern struct {
// TODO: this struct can be packed a lot better than it is now. Should be
// possible to make it 32 bytes.
@@ -53,7 +53,7 @@ type Format struct {
FormatWidth uint16
GroupingSize [2]uint8
- Flags FormatFlag
+ Flags PatternFlag
// Number of digits.
MinIntegerDigits uint8
@@ -65,11 +65,11 @@ type Format struct {
MinExponentDigits uint8
}
-// A FormatFlag is a bit mask for the flag field of a Format.
-type FormatFlag uint8
+// A PatternFlag is a bit mask for the flag field of a Format.
+type PatternFlag uint8
const (
- AlwaysSign FormatFlag = 1 << iota
+ AlwaysSign PatternFlag = 1 << iota
AlwaysExpSign
AlwaysDecimalSeparator
ParenthesisForNegative // Common pattern. Saves space.
@@ -85,7 +85,7 @@ const (
)
type parser struct {
- *Format
+ *Pattern
leadingSharps int
@@ -126,8 +126,8 @@ var (
// ParsePattern extracts formatting information from a CLDR number pattern.
//
// See http://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns.
-func ParsePattern(s string) (f *Format, err error) {
- p := parser{Format: &Format{}}
+func ParsePattern(s string) (f *Pattern, err error) {
+ p := parser{Pattern: &Pattern{}}
s = p.parseSubPattern(s)
@@ -137,7 +137,7 @@ func ParsePattern(s string) (f *Format, err error) {
p.setError(errors.New("format: error parsing first sub pattern"))
return nil, p.err
}
- neg := parser{Format: &Format{}} // just for extracting the affixes.
+ neg := parser{Pattern: &Pattern{}} // just for extracting the affixes.
s = neg.parseSubPattern(s[len(";"):])
p.NegOffset = uint16(len(p.buf))
p.buf = append(p.buf, neg.buf...)
@@ -154,7 +154,7 @@ func ParsePattern(s string) (f *Format, err error) {
} else {
p.Affix = affix
}
- return p.Format, nil
+ return p.Pattern, nil
}
func (p *parser) parseSubPattern(s string) string {
@@ -170,7 +170,7 @@ func (p *parser) parseSubPattern(s string) string {
return s
}
-func (p *parser) parsePad(s string, f FormatFlag) (tail string) {
+func (p *parser) parsePad(s string, f PatternFlag) (tail string) {
if len(s) >= 2 && s[0] == '*' {
r, sz := utf8.DecodeRuneInString(s[1:])
if p.PadRune != 0 {