lexer

package
v0.0.0-...-a2d88c7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directive

type Directive struct {
	Name       string
	Args       []string
	Directives []*Directive
}

func ParseDirective

func ParseDirective(l *Lexer) *Directive

type Lexer

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

Lexer gets values, token by token, from an io.Reader.

func NewLexer

func NewLexer(input io.Reader) Lexer

Loads an io.Reader and wraps it into a bufio.Reader to prepare the Lexer for scanning tokens.

func (*Lexer) Next

func (l *Lexer) Next() bool

Loads a token only if on the same line. Returns true if a token is found, false otherwise.

func (*Lexer) NextLine

func (l *Lexer) NextLine() bool

Loads the first token of the next line. Returns true if a token is found, false otherwise.

func (*Lexer) NextVal

func (l *Lexer) NextVal() string

Returns the next token value.

func (*Lexer) Val

func (l *Lexer) Val() string

Returns the current token value.

type Token

type Token struct {
	Val  string
	Line uint
}

Token stores a value, and metadata associated to it.

Jump to

Keyboard shortcuts

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