lexer

package
v100.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package lexer is generated by GoGLL. Do not edit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer struct {
	// I is the input slice of runes
	I []rune

	// Tokens is the slice of tokens constructed by the lexer from I
	Tokens []*token.Token
}

Lexer contains both the input slice of runes and the slice of tokens parsed from the input

func New

func New(input []rune) *Lexer

New constructs a Lexer from a slice of runes.

All contents of the input slice are treated as input text.

func NewFile

func NewFile(fname string) *Lexer

NewFile constructs a Lexer created from the input file, fname.

If the input file is a markdown file NewFile process treats all text outside code blocks as whitespace. All text inside code blocks are treated as input text.

If the input file is a normal text file NewFile treats all text in the inputfile as input text.

func (*Lexer) GetLineColumn

func (l *Lexer) GetLineColumn(i int) (line, col int)

GetLineColumn returns the line and column of rune[i] in the input

func (*Lexer) GetLineColumnOfToken

func (l *Lexer) GetLineColumnOfToken(i int) (line, col int)

GetLineColumnOfToken returns the line and column of token[i] in the imput

func (*Lexer) GetString

func (l *Lexer) GetString(lext, rext int) string

GetString returns the input string from the left extent of Token[lext] to the right extent of Token[rext]

Jump to

Keyboard shortcuts

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