lexer

package
v0.0.0-...-c9bb408 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lexer implements the lexical scanner for the Suneido language

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIdentifier

func IsIdentifier(s string) bool

Types

type Item

type Item struct {
	Text  string
	Pos   int32
	Token tok.Token
}

Item is the return value from Lexer.Next

func (*Item) String

func (it *Item) String() string

type Lexer

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

Lexer implements the lexical scanner for Suneido It is designed so the sequence of values returned forms the complete source.

func NewLexer

func NewLexer(src string) *Lexer

NewLexer returns a new Lexer

func NewQueryLexer

func NewQueryLexer(src string) *Lexer

func (*Lexer) Ahead

func (lxr *Lexer) Ahead(i int) Item

Ahead provides lookahead, 0 is the next item Items are buffered so they can be used by Next

func (*Lexer) AheadSkip

func (lxr *Lexer) AheadSkip(i int) Item

AheadSkip provides lookahead like Ahead but skips Whitespace, Newline, and Comment

func (*Lexer) Dup

func (lxr *Lexer) Dup() *Lexer

func (*Lexer) Next

func (lxr *Lexer) Next() Item

Next returns the next Item

func (*Lexer) Position

func (lxr *Lexer) Position() int

Position will be out of sync if using Ahead

func (*Lexer) Remainder

func (lxr *Lexer) Remainder() string

Remainder is used by ParseAdmin to get view definitions

func (*Lexer) Source

func (lxr *Lexer) Source() string

Jump to

Keyboard shortcuts

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