Documentation
¶
Index ¶
- type Converter
- func (c *Converter) Convert(prog *nast.Program, files FileSystem) (*ast.Program, error)
- func (c *Converter) ConvertFile(mainfile string) (*ast.Program, error)
- func (c *Converter) ConvertFileEx(mainfile string, files FileSystem) (*ast.Program, error)
- func (c *Converter) Debug(b bool)
- func (c *Converter) GetVariableTranslations() map[string]string
- type DiskFileSystem
- type FileSystem
- type MemoryFileSystem
- type Parser
- func (p *Parser) Debug(b bool)
- func (p *Parser) Parse(prog string) (*nast.Program, error)
- func (p *Parser) ParseBlock(stop func() bool) *nast.Block
- func (p *Parser) ParseBreak() ast.Statement
- func (p *Parser) ParseContinue() ast.Statement
- func (p *Parser) ParseDefinition() *nast.Definition
- func (p *Parser) ParseElement() nast.Element
- func (p *Parser) ParseFuncCall() *nast.FuncCall
- func (p *Parser) ParseGoto() ast.Statement
- func (p *Parser) ParseIf() ast.Statement
- func (p *Parser) ParseInclude() *nast.IncludeDirective
- func (p *Parser) ParseMacroDefinition() *nast.MacroDefinition
- func (p *Parser) ParseMacroInsertion() *nast.MacroInsetion
- func (p *Parser) ParseMultilineIf() nast.Element
- func (p *Parser) ParseNestableElement() nast.NestableElement
- func (p *Parser) ParseProgram() *nast.Program
- func (p *Parser) ParseSingleExpression() ast.Expression
- func (p *Parser) ParseStatement() ast.Statement
- func (p *Parser) ParseStatementLine() *nast.StatementLine
- func (p *Parser) ParseWaitDirective() *nast.WaitDirective
- func (p *Parser) ParseWhile() nast.Element
- func (p *Parser) SetFilename(name string)
- type Printer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converter ¶
type Converter struct {
// UseSpaces disables the default spaceless-mode
UseSpaces bool
// contains filtered or unexported fields
}
Converter can convert a nolol-ast to a yolol-ast
func (*Converter) Convert ¶
Convert converts a nolol-program to a yolol-program files is an object to access files that are referenced in prog's include directives
func (*Converter) ConvertFile ¶ added in v0.0.10
ConvertFile is a shortcut that loads a file from the file-system, parses it and directly convertes it. mainfile is the path to the file on the disk. All included are loaded relative to the mainfile.
func (*Converter) ConvertFileEx ¶ added in v0.0.10
ConvertFileEx acts like ConvertFile, but allows the passing of a custom filesystem from which the source files are retrieved. This way, files that are not stored on disk can be converted
func (*Converter) GetVariableTranslations ¶ added in v0.0.13
GetVariableTranslations returns a table that can be used to find the original names of the variables whos names where shortened during conversion
type DiskFileSystem ¶ added in v0.0.10
type DiskFileSystem struct {
Dir string
}
DiskFileSystem retrieves files from a directory on the disk
type FileSystem ¶ added in v0.0.10
FileSystem defines an interface to get the content of files by name used so the converter can query for the content of files mentioned in include-directives
type MemoryFileSystem ¶ added in v0.0.10
MemoryFileSystem serves files from Memory
type Parser ¶
Parser parses a nolol-program
func (*Parser) ParseBlock ¶ added in v0.0.9
ParseBlock parse lines until stop() returns true
func (*Parser) ParseBreak ¶ added in v0.0.14
ParseBreak parses the break keyword
func (*Parser) ParseContinue ¶ added in v0.0.14
ParseContinue parses the continue keyword
func (*Parser) ParseDefinition ¶ added in v0.0.12
func (p *Parser) ParseDefinition() *nast.Definition
ParseDefinition parses a constant declaration
func (*Parser) ParseElement ¶ added in v0.0.10
ParseElement parses an element
func (*Parser) ParseFuncCall ¶ added in v0.0.6
ParseFuncCall parse a function call
func (*Parser) ParseInclude ¶ added in v0.0.10
func (p *Parser) ParseInclude() *nast.IncludeDirective
ParseInclude parses an include directive
func (*Parser) ParseMacroDefinition ¶ added in v0.0.11
func (p *Parser) ParseMacroDefinition() *nast.MacroDefinition
ParseMacroDefinition parses the definition of a macro
func (*Parser) ParseMacroInsertion ¶ added in v0.0.11
func (p *Parser) ParseMacroInsertion() *nast.MacroInsetion
ParseMacroInsertion parses a macro insertion
func (*Parser) ParseMultilineIf ¶
ParseMultilineIf parses a nolol-style multiline if
func (*Parser) ParseNestableElement ¶ added in v0.0.11
func (p *Parser) ParseNestableElement() nast.NestableElement
ParseNestableElement parses a NOLOL-Element which can appear inside a blocl
func (*Parser) ParseProgram ¶
ParseProgram parses the program
func (*Parser) ParseSingleExpression ¶ added in v0.0.14
func (p *Parser) ParseSingleExpression() ast.Expression
ParseSingleExpression wraps the method of the yolol-parser and adds parsing of func-calls
func (*Parser) ParseStatement ¶ added in v0.0.14
ParseStatement wraps the method of the yolol-parser to add new statement-types
func (*Parser) ParseStatementLine ¶
func (p *Parser) ParseStatementLine() *nast.StatementLine
ParseStatementLine parses a statement line
func (*Parser) ParseWaitDirective ¶ added in v0.0.13
func (p *Parser) ParseWaitDirective() *nast.WaitDirective
ParseWaitDirective parses a NOLOL wait-statement
func (*Parser) ParseWhile ¶
ParseWhile pasres a nolol while
func (*Parser) SetFilename ¶ added in v0.0.10
SetFilename sets the filename that is included in the position of every returned ast.node Necessary when parsing an included file to differenciate between positions in different files