parsing

package
v0.0.0-...-c51fe07 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2015 License: MPL-2.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 Generator

type Generator func() *Token

type StdScanner

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

The standard scanner. It uses the "text/scanner" package.

func (*StdScanner) FirstToken

func (s *StdScanner) FirstToken() *Token

Returns the first token. This method should only called once. The names of the token types are derived from the "text/scanner" package.

func (*StdScanner) Init

func (s *StdScanner) Init(kmap map[string]string, src io.Reader) *StdScanner

Initializes the Scanner.

kmap map[string]string: the keyword map. Initialize with SyntaxFile.ScanForKeyWords

src io.Reader: the source code.

type Token

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

Represents a token resolved from a scanner.

func MakeToken

func MakeToken(
	typ, distinct, text string,
	pos interface{}, nxt Generator) (t *Token)

func Retempty

func Retempty() *Token

func (*Token) Distinct

func (tl *Token) Distinct() string

Returns the token text, if the token is a keyword or a distinct one-character-token.

func (*Token) Next

func (tl *Token) Next() *Token

Returns the next token following to this.

func (*Token) Position

func (tl *Token) Position() interface{}

Returns the token text position.

func (*Token) Text

func (tl *Token) Text() string

Returns the token text.

func (*Token) Type

func (tl *Token) Type() string

Returns the general token type, if the token is not a keyword and not a distinct one-character-token.

Jump to

Keyboard shortcuts

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