mow.cli: github.com/jawher/mow.cli/internal/lexer Index | Files

package lexer

import "github.com/jawher/mow.cli/internal/lexer"

Index

Package Files

lexer.go

type ParseError Uses

type ParseError struct {
    // Input is the text to parse
    Input string
    // Msg s the error message
    Msg string
    // Post is where in the input the error occurred
    Pos int
}

ParseError represents a parsing error

func (*ParseError) Error Uses

func (t *ParseError) Error() string

type Token Uses

type Token struct {
    // Type is the token type
    Typ TokenType
    // Val the textual content
    Val string
    // Pos is the token position in the input
    Pos int
}

Token has a type, a value and a position in the input

func Tokenize Uses

func Tokenize(usage string) ([]*Token, error)

Tokenize transforms the provided input into a slice of tokens or returns a ParseError

func (*Token) String Uses

func (t *Token) String() string

type TokenType Uses

type TokenType string

TokenType is a type representing the different kinds of tokens

const (
    // TTArg is an arg token, e.g. ARG, SRC. DST
    TTArg TokenType = "Arg"
    // TTOpenPar (
    TTOpenPar TokenType = "OpenPar"
    // TTClosePar )
    TTClosePar TokenType = "ClosePar"
    // TTOpenSq [
    TTOpenSq TokenType = "OpenSq"
    // TTCloseSq ]
    TTCloseSq TokenType = "CloseSq"
    // TTChoice |
    TTChoice TokenType = "Choice"
    // TTOptions is the special OPTIONS keyword
    TTOptions TokenType = "Options"
    // TTRep ...
    TTRep TokenType = "Rep"
    // TTShortOpt -a, -f, ...
    TTShortOpt TokenType = "ShortOpt"
    // TTLongOpt --force, --retry, ...
    TTLongOpt TokenType = "LongOpt"
    // TTOptSeq a folded option sequence, -rm
    TTOptSeq TokenType = "OptSeq"
    // TTOptValue is the special =<example> syntax token
    TTOptValue TokenType = "OptValue"
    // TTDoubleDash --
    TTDoubleDash TokenType = "DblDash"
)

Package lexer imports 2 packages (graph) and is imported by 4 packages. Updated 2019-03-03. Refresh now. Tools for package owners.