Documentation
¶
Overview ¶
Package syntax implements the lexer of the glob pattern syntax. The parser lives in package glob; the syntax itself is described at [glob.Compile].
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Lexer ¶ added in v1.0.0
type Lexer struct {
// contains filtered or unexported fields
}
Lexer splits a pattern into tokens; see Lexer.Next.
type Token ¶ added in v1.0.0
Token is a lexeme of the pattern: its kind and the source text it was read from (or the error message for Error, the literal characters with the escapes resolved for Text).
type TokenType ¶ added in v1.0.0
type TokenType int
TokenType tells the kind of a Token.
const ( // EOF marks the end of the input; the lexer returns it repeatedly. EOF TokenType = iota // Error carries an error message in Token.Data; the lexer keeps // returning it once it happened. Note that the lexer catches only the // errors local to a token (an invalid UTF-8 sequence, a malformed // character class): the structural ones, like an unclosed `{`, are for // the parser to detect. Error // Text is a run of literal characters, with the escapes resolved. Text // Any is the `*` wildcard. Any // Super is the `**` wildcard. Super // Single is the `?` wildcard. Single // Not is the `!` right after the `[` of a character class. Not // TermSeparator is the `,` between the alternatives of a `{...}` group. // Outside of a group a comma is a plain Text character. TermSeparator // RangeOpen and RangeClose are the `[` and `]` of a character class. // Between them the lexer produces either a Text token (a set of // characters, `[abc]`) or a RangeLo, RangeBetween, RangeHi triple (a // range, `[a-c]`), possibly preceded by Not. RangeOpen RangeClose RangeLo RangeHi RangeBetween // TermsOpen and TermsClose are the `{` and `}` of an alternatives group. TermsOpen TermsClose )
Click to show internal directories.
Click to hide internal directories.