scanner

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner converts a sequence of characters into a sequence of tokens.

func New

func New(input string) *Scanner

New returns new Scanner.

func (*Scanner) NextToken

func (s *Scanner) NextToken(ctx context.Context) token.Token

NextToken scans the next token and returns the token position, the token, and its literal string if applicable. The source end is indicated by token.EOF.

If the returned token is a literal (token.Identifier, token.Value, token.RawValue) or token.Comment, the literal string has the corresponding value.

If the returned token is token.Illegal, the literal string is the offending character.

Jump to

Keyboard shortcuts

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