github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/regexp/syntax/regexp.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package syntax 6 7 // 正規表現(RegExp)は正規表現構文木のノードです。 8 type Regexp struct { 9 Op Op 10 Flags Flags 11 Sub []*Regexp 12 Sub0 [1]*Regexp 13 Rune []rune 14 Rune0 [2]rune 15 Min, Max int 16 Cap int 17 Name string 18 } 19 20 // Opは単一の正規表現演算子です。 21 type Op uint8 22 23 const ( 24 OpNoMatch Op = 1 + iota 25 OpEmptyMatch 26 OpLiteral 27 OpCharClass 28 OpAnyCharNotNL 29 OpAnyChar 30 OpBeginLine 31 OpEndLine 32 OpBeginText 33 OpEndText 34 OpWordBoundary 35 OpNoWordBoundary 36 OpCapture 37 OpStar 38 OpPlus 39 OpQuest 40 OpRepeat 41 OpConcat 42 OpAlternate 43 ) 44 45 // Equalはxとyが同じ構造を持っているかどうかを報告します。 46 func (x *Regexp) Equal(y *Regexp) bool 47 48 func (re *Regexp) String() string 49 50 // MaxCapは正規表現を辿って最大のキャプチャーインデックスを見つけます。 51 func (re *Regexp) MaxCap() int 52 53 // CapNamesは正規表現を走査してキャプチャグループの名前を見つけます。 54 func (re *Regexp) CapNames() []string