lex

package
v0.0.0-...-dc6f9f8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Uncomment

func Uncomment(raw string) string

Types

type Char

type Char interface {
	Char() string
}

type Comment

type Comment struct {
	String string `ko:"name=string"`
}

Comment is a character.

func (Comment) Char

func (comm Comment) Char() string

type EmptyRegion

type EmptyRegion struct{}

func (EmptyRegion) EndPosition

func (er EmptyRegion) EndPosition() Position

func (EmptyRegion) FilePath

func (er EmptyRegion) FilePath() string

func (EmptyRegion) RegionString

func (er EmptyRegion) RegionString() string

func (EmptyRegion) StartPosition

func (er EmptyRegion) StartPosition() Position

type Lex

type Lex interface {
	Region
}

func LexUnion

func LexUnion(monotone ...Lex) Lex

func LexifyFile

func LexifyFile(fileName string) ([]Lex, error)

func LexifyReader

func LexifyReader(fileName string, r io.Reader) ([]Lex, error)

func LexifyString

func LexifyString(fileName, src string) ([]Lex, error)

type LexFloat

type LexFloat struct {
	Float64 float64 `ko:"name=float64"`
}

func (LexFloat) Char

func (float LexFloat) Char() string

func (LexFloat) Negative

func (float LexFloat) Negative() Char

type LexInteger

type LexInteger struct {
	Int64 int64 `ko:"name=int64"`
}

func (LexInteger) Char

func (integer LexInteger) Char() string

func (LexInteger) Negative

func (integer LexInteger) Negative() Char

type LexOther

type LexOther struct {
	String string `ko:"name=string"`
}

func (LexOther) Char

func (str LexOther) Char() string

type LexString

type LexString struct {
	String string `ko:"name=string"`
}

func (LexString) Char

func (str LexString) Char() string

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer(fileName string, r io.Reader) *Lexer

func (*Lexer) Error

func (l *Lexer) Error() error

func (*Lexer) Next

func (l *Lexer) Next() bool

func (*Lexer) Token

func (l *Lexer) Token() Token

type Line

type Line struct {
	N int `ko:"name=n"`
}

Line is a character.

func (Line) Char

func (line Line) Char() string

type Name

type Name struct {
	String string `ko:"name=string"`
}

Name is a character.

func (Name) Char

func (name Name) Char() string

type Position

type Position scanner.Position
type Position struct {
   Filename string // filename, if any
   Offset   int    // byte offset, starting at 0
   Line     int    // line number, starting at 1
   Column   int    // column number, starting at 1 (character count per line)
}

A source position is represented by a Position value. A position is valid if Line > 0.

type Punc

type Punc struct {
	String string `ko:"name=string"`
}

Punc is a character.

func (Punc) Char

func (punc Punc) Char() string

type Region

type Region interface {
	FilePath() string
	StartPosition() Position
	EndPosition() Position
	RegionString() string
}

func RegionEnd

func RegionEnd(r Region) Region

func RegionStart

func RegionStart(r Region) Region

func RegionUnion

func RegionUnion(monotone ...Region) Region

type StartEndRegion

type StartEndRegion struct {
	Start Position `ko:"name=start"`
	End   Position `ko:"name=end"`
}

func (*StartEndRegion) EndPosition

func (sr *StartEndRegion) EndPosition() Position

func (*StartEndRegion) FilePath

func (sr *StartEndRegion) FilePath() string

func (*StartEndRegion) RegionString

func (sr *StartEndRegion) RegionString() string

func (*StartEndRegion) StartPosition

func (sr *StartEndRegion) StartPosition() Position

type Token

type Token struct {
	Lex  `ko:"name=lex" ctx:"expand"`
	Text string `ko:"name=text"`
	Char Char   `ko:"name=char" ctx:"expand"`
}

Token is a Lex.

type White

type White struct {
	String string `ko:"name=string"`
}

func (White) Char

func (white White) Char() string

Jump to

Keyboard shortcuts

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