lexer

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package lexer contains a simple lexer for reading an input-string and converting it into a series of tokens.

In terms of syntax we're not very complex, so our lexer only needs to care about simple tokens:

- Comments - Strings - Some simple characters such as "(", ")", "[", "]", "=>", "=", etc. -

We can catch some basic errors in the lexing stage, such as unterminated strings, but the parser is the better place to catch such things.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

Lexer is used as the lexer for our deployr "language".

func New

func New(input string) *Lexer

New a Lexer instance from string input.

func (*Lexer) NextToken

func (l *Lexer) NextToken() token.Token

NextToken consumes and returns the next token from our input.

It is a simple method which can optionally dump the tokens to the console if $DEBUG_LEXER is non-empty.

Jump to

Keyboard shortcuts

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