Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LookupUnicodeClass ¶
func LookupUnicodeClass(name string) (*unicode.RangeTable, bool)
Types ¶
type Node ¶
type Node struct {
Op Op
Children []*Node
Rune rune // for OpLiteral
Ranges []CharRange // for OpCharClass (explicit ranges)
UnicodeTable interface{} // *unicode.RangeTable for Unicode property classes
Min, Max int // for OpRepeat: {min,max}, Max == -1 means unbounded
Cap int // capture group index (0 = whole match)
Name string // for OpNamedCapture, OpBackref by name
Ref int // for OpBackref by number
Flags Flags
Negated bool // for OpCharClass (negated class)
}
type Op ¶
type Op int
const ( OpLiteral Op = iota // single rune OpDot // . (any char except \n, or any char if DotAll) OpCharClass // character class [abc], [a-z] OpConcat // AB OpAlternate // A|B OpCapture // (...) capturing group OpGroup // (?:...) non-capturing group OpNamedCapture // (?<name>...) named capturing group OpStar // A* OpPlus // A+ OpQuest // A? OpRepeat // A{n,m} OpLazy // wraps quantifier for lazy mode OpPossessive // wraps quantifier for possessive mode OpLookahead // (?=A) OpNegLookahead // (?!A) OpLookbehind // (?<=A) OpNegLookbehind // (?<!A) OpAtomic // (?>A) OpBackref // \1, \k<name> OpBeginLine // ^ OpEndLine // $ OpBeginText // \A OpEndText // \z OpWordBoundary // \b OpNoWordBoundary // \B OpEmpty // empty match )
type SyntaxError ¶
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type Token ¶
type Token struct {
Kind TokenKind
Rune rune // for TokLiteral
Value string // raw text of the token
Min, Max int // for TokQuantifier: {Min,Max}, Max == -1 means unbounded
GroupKind GroupKind // for TokGroupOpen
Name string // for named groups, named backrefs
Ref int // for TokBackref by number
Negated bool // for TokCharClass/TokUnicodeClass (uppercase variants)
Pos int // byte offset in original pattern
}
type TokenKind ¶
type TokenKind int
const ( TokLiteral TokenKind = iota // single rune: 'a', '\n', '\x41' TokDot // '.' TokCaret // '^' TokDollar // '$' TokStar // '*' TokPlus // '+' TokQuestion // '?' TokPipe // '|' TokLParen // '(' TokRParen // ')' TokLBracket // '[' TokRBracket // ']' TokLBrace // '{' TokRBrace // '}' TokBackref // \1..\99, \k<name> TokGroupOpen // (?:, (?=, (?!, (?<=, (?<!, (?<name>, (?P<name> TokQuantifier // {n}, {n,}, {n,m} TokCharClass // \d, \w, \s, \D, \W, \S TokUnicodeClass // \p{L}, \P{Lu} TokEOF )
Click to show internal directories.
Click to hide internal directories.