diff options
Diffstat (limited to 'libgo/go/regexp/syntax')
-rw-r--r-- | libgo/go/regexp/syntax/compile.go | 4 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/doc.go | 4 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/parse.go | 34 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/parse_test.go | 2 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/prog.go | 4 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/regexp.go | 6 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/simplify.go | 8 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/simplify_test.go | 6 |
8 files changed, 34 insertions, 34 deletions
diff --git a/libgo/go/regexp/syntax/compile.go b/libgo/go/regexp/syntax/compile.go index 95f6f15698..83e53ba6ca 100644 --- a/libgo/go/regexp/syntax/compile.go +++ b/libgo/go/regexp/syntax/compile.go @@ -8,11 +8,11 @@ import "unicode" // A patchList is a list of instruction pointers that need to be filled in (patched). // Because the pointers haven't been filled in yet, we can reuse their storage -// to hold the list. It's kind of sleazy, but works well in practice. +// to hold the list. It's kind of sleazy, but works well in practice. // See http://swtch.com/~rsc/regexp/regexp1.html for inspiration. // // These aren't really pointers: they're integers, so we can reinterpret them -// this way without using package unsafe. A value l denotes +// this way without using package unsafe. A value l denotes // p.inst[l>>1].Out (l&1==0) or .Arg (l&1==1). // l == 0 denotes the empty list, okay because we start every program // with a fail instruction, so we'll never want to point at its output link. diff --git a/libgo/go/regexp/syntax/doc.go b/libgo/go/regexp/syntax/doc.go index e5e71f14f5..efc0b43571 100644 --- a/libgo/go/regexp/syntax/doc.go +++ b/libgo/go/regexp/syntax/doc.go @@ -1,4 +1,4 @@ -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -66,7 +66,7 @@ Grouping: Empty strings: ^ at beginning of text or line (flag m=true) - $ at end of text (like \z not \Z) or line (flag m=true) + $ at end of text (like \z not Perl's \Z) or line (flag m=true) \A at beginning of text \b at ASCII word boundary (\w on one side and \W, \A, or \z on the other) \B not at ASCII word boundary diff --git a/libgo/go/regexp/syntax/parse.go b/libgo/go/regexp/syntax/parse.go index f38bbf66e3..7b8be55ddb 100644 --- a/libgo/go/regexp/syntax/parse.go +++ b/libgo/go/regexp/syntax/parse.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -141,9 +141,9 @@ func (p *parser) push(re *Regexp) *Regexp { } // maybeConcat implements incremental concatenation -// of literal runes into string nodes. The parser calls this +// of literal runes into string nodes. The parser calls this // before each push, so only the top fragment of the stack -// might need processing. Since this is called before a push, +// might need processing. Since this is called before a push, // the topmost literal is no longer subject to operators like * // (Otherwise ab* would turn into (ab)*.) // If r >= 0 and there's a node left over, maybeConcat uses it @@ -600,7 +600,7 @@ func (p *parser) leadingString(re *Regexp) ([]rune, Flags) { } // removeLeadingString removes the first n leading runes -// from the beginning of re. It returns the replacement for re. +// from the beginning of re. It returns the replacement for re. func (p *parser) removeLeadingString(re *Regexp, n int) *Regexp { if re.Op == OpConcat && len(re.Sub) > 0 { // Removing a leading string in a concatenation @@ -957,11 +957,11 @@ func (p *parser) parsePerlFlags(s string) (rest string, err error) { // Perl 5.10 gave in and implemented the Python version too, // but they claim that the last two are the preferred forms. // PCRE and languages based on it (specifically, PHP and Ruby) - // support all three as well. EcmaScript 4 uses only the Python form. + // support all three as well. EcmaScript 4 uses only the Python form. // // In both the open source world (via Code Search) and the // Google source tree, (?P<expr>name) is the dominant form, - // so that's the one we implement. One is enough. + // so that's the one we implement. One is enough. if len(t) > 4 && t[2] == 'P' && t[3] == '<' { // Pull out name. end := strings.IndexRune(t, '>') @@ -989,7 +989,7 @@ func (p *parser) parsePerlFlags(s string) (rest string, err error) { return t[end+1:], nil } - // Non-capturing group. Might also twiddle Perl flags. + // Non-capturing group. Might also twiddle Perl flags. var c rune t = t[2:] // skip (? flags := p.flags @@ -1257,7 +1257,7 @@ Switch: if c < utf8.RuneSelf && !isalnum(c) { // Escaped non-word characters are always themselves. // PCRE is not quite so rigorous: it accepts things like - // \q, but we don't. We once rejected \_, but too many + // \q, but we don't. We once rejected \_, but too many // programs and people insist on using it, so allow \_. return c, t, nil } @@ -1292,7 +1292,7 @@ Switch: if c == '{' { // Any number of digits in braces. // Perl accepts any text at all; it ignores all text - // after the first non-hex digit. We require only hex digits, + // after the first non-hex digit. We require only hex digits, // and at least one. nhex := 0 r = 0 @@ -1333,10 +1333,10 @@ Switch: } return x*16 + y, t, nil - // C escapes. There is no case 'b', to avoid misparsing + // C escapes. There is no case 'b', to avoid misparsing // the Perl word-boundary \b as the C backspace \b - // when in POSIX mode. In Perl, /\b/ means word-boundary - // but /[\b]/ means backspace. We don't support that. + // when in POSIX mode. In Perl, /\b/ means word-boundary + // but /[\b]/ means backspace. We don't support that. // If you want a backspace, embed a literal backspace // character or use \x08. case 'a': @@ -1377,7 +1377,7 @@ type charGroup struct { } // parsePerlClassEscape parses a leading Perl character class escape like \d -// from the beginning of s. If one is present, it appends the characters to r +// from the beginning of s. If one is present, it appends the characters to r // and returns the new slice r and the remainder of the string. func (p *parser) parsePerlClassEscape(s string, r []rune) (out []rune, rest string) { if p.flags&PerlX == 0 || len(s) < 2 || s[0] != '\\' { @@ -1391,7 +1391,7 @@ func (p *parser) parsePerlClassEscape(s string, r []rune) (out []rune, rest stri } // parseNamedClass parses a leading POSIX named character class like [:alnum:] -// from the beginning of s. If one is present, it appends the characters to r +// from the beginning of s. If one is present, it appends the characters to r // and returns the new slice r and the remainder of the string. func (p *parser) parseNamedClass(s string, r []rune) (out []rune, rest string, err error) { if len(s) < 2 || s[0] != '[' || s[1] != ':' { @@ -1454,7 +1454,7 @@ func unicodeTable(name string) (*unicode.RangeTable, *unicode.RangeTable) { } // parseUnicodeClass parses a leading Unicode character class like \p{Han} -// from the beginning of s. If one is present, it appends the characters to r +// from the beginning of s. If one is present, it appends the characters to r // and returns the new slice r and the remainder of the string. func (p *parser) parseUnicodeClass(s string, r []rune) (out []rune, rest string, err error) { if p.flags&UnicodeGroups == 0 || len(s) < 2 || s[0] != '\\' || s[1] != 'p' && s[1] != 'P' { @@ -1692,7 +1692,7 @@ const ( // minimum and maximum runes involved in folding. // checked during test. minFold = 0x0041 - maxFold = 0x118df + maxFold = 0x1e943 ) // appendFoldedRange returns the result of appending the range lo-hi @@ -1718,7 +1718,7 @@ func appendFoldedRange(r []rune, lo, hi rune) []rune { hi = maxFold } - // Brute force. Depend on appendRange to coalesce ranges on the fly. + // Brute force. Depend on appendRange to coalesce ranges on the fly. for c := lo; c <= hi; c++ { r = appendRange(r, c, c) f := unicode.SimpleFold(c) diff --git a/libgo/go/regexp/syntax/parse_test.go b/libgo/go/regexp/syntax/parse_test.go index 5ca54bbe1e..dd6529f7c8 100644 --- a/libgo/go/regexp/syntax/parse_test.go +++ b/libgo/go/regexp/syntax/parse_test.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/libgo/go/regexp/syntax/prog.go b/libgo/go/regexp/syntax/prog.go index ae6db31a44..c32ae8d9fa 100644 --- a/libgo/go/regexp/syntax/prog.go +++ b/libgo/go/regexp/syntax/prog.go @@ -144,7 +144,7 @@ func (i *Inst) op() InstOp { } // Prefix returns a literal string that all matches for the -// regexp must start with. Complete is true if the prefix +// regexp must start with. Complete is true if the prefix // is the entire match. func (p *Prog) Prefix() (prefix string, complete bool) { i, _ := p.skipNop(uint32(p.Start)) @@ -164,7 +164,7 @@ func (p *Prog) Prefix() (prefix string, complete bool) { } // StartCond returns the leading empty-width conditions that must -// be true in any match. It returns ^EmptyOp(0) if no matches are possible. +// be true in any match. It returns ^EmptyOp(0) if no matches are possible. func (p *Prog) StartCond() EmptyOp { var flag EmptyOp pc := uint32(p.Start) diff --git a/libgo/go/regexp/syntax/regexp.go b/libgo/go/regexp/syntax/regexp.go index 75822cf981..0fe9269f25 100644 --- a/libgo/go/regexp/syntax/regexp.go +++ b/libgo/go/regexp/syntax/regexp.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -139,7 +139,7 @@ func writeRegexp(b *bytes.Buffer, re *Regexp) { if len(re.Rune) == 0 { b.WriteString(`^\x00-\x{10FFFF}`) } else if re.Rune[0] == 0 && re.Rune[len(re.Rune)-1] == unicode.MaxRune { - // Contains 0 and MaxRune. Probably a negated class. + // Contains 0 and MaxRune. Probably a negated class. // Print the gaps. b.WriteRune('^') for i := 1; i < len(re.Rune)-1; i += 2 { @@ -252,7 +252,7 @@ const meta = `\.+*?()|[]{}^$` func escape(b *bytes.Buffer, r rune, force bool) { if unicode.IsPrint(r) { - if strings.IndexRune(meta, r) >= 0 || force { + if strings.ContainsRune(meta, r) || force { b.WriteRune('\\') } b.WriteRune(r) diff --git a/libgo/go/regexp/syntax/simplify.go b/libgo/go/regexp/syntax/simplify.go index 72390417bb..e439325139 100644 --- a/libgo/go/regexp/syntax/simplify.go +++ b/libgo/go/regexp/syntax/simplify.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -8,7 +8,7 @@ package syntax // and with various other simplifications, such as rewriting /(?:a+)+/ to /a+/. // The resulting regexp will execute correctly but its string representation // will not produce the same parse tree, because capturing parentheses -// may have been duplicated or removed. For example, the simplified form +// may have been duplicated or removed. For example, the simplified form // for /(x){1,2}/ is /(x)(x)?/ but both parentheses capture as $1. // The returned regexp may share structure with or be the original. func (re *Regexp) Simplify() *Regexp { @@ -117,13 +117,13 @@ func (re *Regexp) Simplify() *Regexp { } // simplify1 implements Simplify for the unary OpStar, -// OpPlus, and OpQuest operators. It returns the simple regexp +// OpPlus, and OpQuest operators. It returns the simple regexp // equivalent to // // Regexp{Op: op, Flags: flags, Sub: {sub}} // // under the assumption that sub is already simple, and -// without first allocating that structure. If the regexp +// without first allocating that structure. If the regexp // to be returned turns out to be equivalent to re, simplify1 // returns re instead. // diff --git a/libgo/go/regexp/syntax/simplify_test.go b/libgo/go/regexp/syntax/simplify_test.go index 5d0f1dea5e..9877db3d0a 100644 --- a/libgo/go/regexp/syntax/simplify_test.go +++ b/libgo/go/regexp/syntax/simplify_test.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -59,7 +59,7 @@ var simplifyTests = []struct { {`a{0,1}`, `a?`}, // The next three are illegible because Simplify inserts (?:) // parens instead of () parens to avoid creating extra - // captured subexpressions. The comments show a version with fewer parens. + // captured subexpressions. The comments show a version with fewer parens. {`(a){0,2}`, `(?:(a)(a)?)?`}, // (aa?)? {`(a){0,4}`, `(?:(a)(?:(a)(?:(a)(a)?)?)?)?`}, // (a(a(aa?)?)?)? {`(a){2,6}`, `(a)(a)(?:(a)(?:(a)(?:(a)(a)?)?)?)?`}, // aa(a(a(aa?)?)?)? @@ -117,7 +117,7 @@ var simplifyTests = []struct { // Empty string as a regular expression. // The empty string must be preserved inside parens in order // to make submatches work right, so these tests are less - // interesting than they might otherwise be. String inserts + // interesting than they might otherwise be. String inserts // explicit (?:) in place of non-parenthesized empty strings, // to make them easier to spot for other parsers. {`(a|b|)`, `([a-b]|(?:))`}, |