nolol

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

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

Converter can convert a nolol-ast to a yolol-ast

func NewConverter

func NewConverter() *Converter

NewConverter creates a new converter

func (*Converter) Convert

func (c *Converter) Convert(prog *nast.Program) (*ast.Program, error)

Convert converts a nolol-program to a yolol-program

func (*Converter) ConvertFromSource

func (c *Converter) ConvertFromSource(prog string) (*ast.Program, error)

ConvertFromSource is a shortcut that parses and directly convertes a nolol program

func (*Converter) Debug added in v0.0.7

func (c *Converter) Debug(b bool)

Debug enables/disables debug logging

type Parser

type Parser struct {
	*parser.Parser
}

Parser parses a nolol-program

func NewParser

func NewParser() *Parser

NewParser creates and returns a nolol parser

func (*Parser) Debug added in v0.0.7

func (p *Parser) Debug(b bool)

Debug enables/disables debug logging

func (*Parser) Parse

func (p *Parser) Parse(prog string) (*nast.Program, error)

Parse is the entry point for parsing

func (*Parser) ParseBlockStatement added in v0.0.6

func (p *Parser) ParseBlockStatement() *nast.BlockStatement

ParseBlockStatement parses a NOLOL block statement

func (*Parser) ParseConstantDeclaration

func (p *Parser) ParseConstantDeclaration() *nast.ConstDeclaration

ParseConstantDeclaration parses a constant declaration

func (*Parser) ParseExecutableLine

func (p *Parser) ParseExecutableLine() nast.ExecutableLine

ParseExecutableLine parses an if, while or statement-line

func (*Parser) ParseFuncCall added in v0.0.6

func (p *Parser) ParseFuncCall() ast.Expression

ParseFuncCall parse a function call

func (*Parser) ParseGoto

func (p *Parser) ParseGoto() ast.Statement

ParseGoto allows labeled-gotos and forbids line-based gotos

func (*Parser) ParseIf

func (p *Parser) ParseIf() ast.Statement

ParseIf overrides and disables the old yolol-style inline ifs

func (*Parser) ParseLine

func (p *Parser) ParseLine() nast.Line

ParseLine parses any kind of line

func (*Parser) ParseLinesUntil

func (p *Parser) ParseLinesUntil(stop func() bool) []nast.ExecutableLine

ParseLinesUntil parse lines until stop() returns true

func (*Parser) ParseMultilineIf

func (p *Parser) ParseMultilineIf() nast.Line

ParseMultilineIf parses a nolol-style multiline if

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *nast.Program

ParseProgram parses the program

func (*Parser) ParseStatementLine

func (p *Parser) ParseStatementLine() *nast.StatementLine

ParseStatementLine parses a statement line

func (*Parser) ParseWhile

func (p *Parser) ParseWhile() nast.Line

ParseWhile pasres a nolol while

type Printer

type Printer struct {
	Indentation string
	// contains filtered or unexported fields
}

Printer can generate the nolol-code corresponding to a nolol ast

func NewPrinter

func NewPrinter() *Printer

NewPrinter creates a new Printer

func (*Printer) Print

func (p *Printer) Print(prog *nast.Program) (string, error)

Print returns the nolol-code for the given ast

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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