parse

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedEndOfInput = errors.New("unexpected end of input")
	ErrUnexpectedDoubleStar = errors.New("unexpected '**' token in the middle of the path")
	ErrUnexpectedToken      = errors.New("unexpected token")
	ErrSubVariable          = errors.New("sub variables are not allowed in thix context")
)

Functions

func NewLexer

func NewLexer(s string) *lexer

func ParseTemplate

func ParseTemplate(s string) (*pmpb.PathTemplate, error)

ParseTemplate parses a path template string and returns a PathMatch object or an error if the template is invalid.

Types

type Token

type Token struct {
	Type  TokenType
	Value string
}

func (Token) String

func (t Token) String() string

type TokenType

type TokenType int
const (
	TokenUnknown    TokenType = iota
	TokenSlash                // '/'
	TokenStar                 // '*'
	TokenDoubleStar           // '**'
	TokenLiteral              // LITERAL
	TokenLeftBrace            // '{'
	TokenRightBrace           // '}'
	TokenEq                   // '='
	TokenEOF
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL