formatter

package
v0.0.0-...-b5cb46a Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 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 Declare

type Declare struct {
	Methods []DeclareLine // Stores an array of all the line
}

type DeclareLine

type DeclareLine struct {
	Models            map[int]*declareModel // Stores all the declare models
	WholeSomeFunction bool                  // WholeSomeFunction would be that a function is present inside the arguments when 2 of more declarations are found but not other elements
}

type ExpressionIF

type ExpressionIF struct {
	Args    []lexer.Token
	Body    []FormattedPacket
	Keyword lexer.Token
}

Model used when if statements are found

type Format

type Format struct {
	Parser *parse.Parser // Holds mainly the instructions
	Lexer  *lexer.Lexer  // Holds mainly the tokens

	Manuals  []FormattedPacket // Holds our entire formatter output
	Position int               // Scanners current position inside the array
}

func NewFormat

func NewFormat(parser *parse.Parser) *Format

Makes the new formatter model

func (*Format) Format

func (f *Format) Format() error

Format will run the formatter on the information

func (*Format) FuncCreate

func (F *Format) FuncCreate(body *parse.FunctionBody) (*FormattedPacket, error)

FuncCreate will return the function inside a formatted packet

func (*Format) IF

func (F *Format) IF(body *parse.IfStatement) (*FormattedPacket, error)

IF will work the needed information within the if statement

type FormatNode

type FormatNode int

Stores the formatted node type

type FormattedPacket

type FormattedPacket struct {
	Node             FormatNode     // Stores the formatted nodeType
	DeclareStatement *Declare       // Holds information if the statement is a declaration
	CallStatement    *FunctionCall  // Holds information if the statement is a call statement
	IFCall           []ExpressionIF // Holds information if the call statement is if statement
	Returns          []lexer.Token  // Holds information if the statement is a return statement
	Axis             []lexer.Token  // Holds all the token axis attributes
	FunctionBody     *FunctionBody
}

Stores the formatted node output

type FunctionBody

type FunctionBody struct {
	Keyword    lexer.Token       // Stores the keyword
	ArgsWants  []lexer.Token     // Stores all the arguments needed
	ReturnArgs []lexer.Token     // Stores all the return arguments
	Bodys      []FormattedPacket // Stores the body of the function
}

type FunctionCall

type FunctionCall struct {
	Path []lexer.Token // Stores the path for the function path
	Args []lexer.Token // Stores the complete leadup for the system
}

Model when functions are used

Jump to

Keyboard shortcuts

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