...

Source file src/regexp/syntax/op_string.go

Documentation: regexp/syntax

     1  // Code generated by "stringer -type Op -trimprefix Op"; DO NOT EDIT.
     2  
     3  package syntax
     4  
     5  import "strconv"
     6  
     7  func _() {
     8  	// An "invalid array index" compiler error signifies that the constant values have changed.
     9  	// Re-run the stringer command to generate them again.
    10  	var x [1]struct{}
    11  	_ = x[OpNoMatch-1]
    12  	_ = x[OpEmptyMatch-2]
    13  	_ = x[OpLiteral-3]
    14  	_ = x[OpCharClass-4]
    15  	_ = x[OpAnyCharNotNL-5]
    16  	_ = x[OpAnyChar-6]
    17  	_ = x[OpBeginLine-7]
    18  	_ = x[OpEndLine-8]
    19  	_ = x[OpBeginText-9]
    20  	_ = x[OpEndText-10]
    21  	_ = x[OpWordBoundary-11]
    22  	_ = x[OpNoWordBoundary-12]
    23  	_ = x[OpCapture-13]
    24  	_ = x[OpStar-14]
    25  	_ = x[OpPlus-15]
    26  	_ = x[OpQuest-16]
    27  	_ = x[OpRepeat-17]
    28  	_ = x[OpConcat-18]
    29  	_ = x[OpAlternate-19]
    30  	_ = x[opPseudo-128]
    31  }
    32  
    33  const (
    34  	_Op_name_0 = "NoMatchEmptyMatchLiteralCharClassAnyCharNotNLAnyCharBeginLineEndLineBeginTextEndTextWordBoundaryNoWordBoundaryCaptureStarPlusQuestRepeatConcatAlternate"
    35  	_Op_name_1 = "opPseudo"
    36  )
    37  
    38  var (
    39  	_Op_index_0 = [...]uint8{0, 7, 17, 24, 33, 45, 52, 61, 68, 77, 84, 96, 110, 117, 121, 125, 130, 136, 142, 151}
    40  )
    41  
    42  func (i Op) String() string {
    43  	switch {
    44  	case 1 <= i && i <= 19:
    45  		i -= 1
    46  		return _Op_name_0[_Op_index_0[i]:_Op_index_0[i+1]]
    47  	case i == 128:
    48  		return _Op_name_1
    49  	default:
    50  		return "Op(" + strconv.FormatInt(int64(i), 10) + ")"
    51  	}
    52  }
    53  

View as plain text