example

package
v0.0.0-...-c3a0e23 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: Unlicense Imports: 9 Imported by: 0

Documentation

Overview

Package example defines an example language.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLexer

func CreateLexer() *lexer.Lexer

CreateLexer returns a new lexer with the language definitions already registered.

func CreateSimpleAdderFunc

func CreateSimpleAdderFunc() string

CreateSimpleAdderFunc returns source code for an example function definition

func ParserProcessor

func ParserProcessor() parser.Processor

ParserProcessor returns the processor for the example language

Types

type StringSourceOperation

type StringSourceOperation struct {
	Src string
}

StringSourceOperation is a lexer operation that can be used to tokenize a string as source code

func (*StringSourceOperation) Finish

func (o *StringSourceOperation) Finish() error

Finish is called after the tokenization is completed

This method is even called after errors, and in that case any error returned by this function will de discarded

func (*StringSourceOperation) ID

func (o *StringSourceOperation) ID() string

ID returns a unique identifier for the source code

func (*StringSourceOperation) Prepare

func (o *StringSourceOperation) Prepare() error

Prepare is called before the tokenization begins

func (*StringSourceOperation) SourceReader

func (o *StringSourceOperation) SourceReader() io.Reader

SourceReader returns the reader for the source code

Jump to

Keyboard shortcuts

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