parser

package
v0.0.0-...-9db1a63 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryExpression

type BinaryExpression struct {
	Left  IExpression
	Op    *Token
	Right IExpression
}

Implements IExpression

type CallExpression

type CallExpression struct {
	Func      IExpression
	Arguments []IExpression
}

Implements IExpression

type ConstantExpression

type ConstantExpression struct {
	Value *Token
}

Implements IExpression

type ContextExpression

type ContextExpression struct {
	Object     IExpression
	Statements []IExpression
}

type DimensionExpression

type DimensionExpression struct {
	Value     IExpression
	Dimension *Token
}

Implements IExpression

type DotExpression

type DotExpression struct {
	Context    IExpression
	Identifier *Token
	Arguments  []IExpression
}

Implements IExpression

type File

type File struct {
	Statements []IDirective
	Location   errlog.Location
}

type GroundPlate

type GroundPlate struct {
	Expressions []IExpression
	Location    errlog.LocationRange
}

Implements IDirective

type IDirective

type IDirective interface {
}

type IExpression

type IExpression interface {
}

type IdentifierExpression

type IdentifierExpression struct {
	Identifier *Token
}

Implements IExpression

type Layer

type Layer struct {
	Name        *Token
	Expressions []IExpression
	Location    errlog.LocationRange
}

Implements IDirective

type Lexer

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

Lexer ...

func NewLexer

func NewLexer(file int, str string, log *errlog.ErrorLog) *Lexer

NewLexer ...

func (*Lexer) Scan

func (l *Lexer) Scan() *Token

Scan ...

func (*Lexer) ScanRawText

func (l *Lexer) ScanRawText(term byte) (string, errlog.LocationRange)

This function is used to scan ASCII-Art text, until it encounters a new line that starts with the character 'term'. The function expands tabulators, assuming a tab-width of 4 characters.

func (*Lexer) TokenKindToString

func (l *Lexer) TokenKindToString(kind TokenKind) string

TokenKindToString ...

type Parameter

type Parameter struct {
	Name *Token
}

type Parser

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

Parser ...

func NewParser

func NewParser(log *errlog.ErrorLog) *Parser

NewParser creates a new parser that reports to the given error log.

func (*Parser) Parse

func (p *Parser) Parse(fileId int, str string) *File

Parse a file. For efficieny, files are identified by a number instead of their path.

type Switchboard

type Switchboard struct {
	Name          *Token
	RawText       string
	LocationToken errlog.LocationRange
	LocationText  errlog.LocationRange
}

Implements IDirective

type Token

type Token struct {
	Raw          string
	Kind         TokenKind
	StringValue  string
	RuneValue    rune
	IntegerValue *big.Int
	FloatValue   *big.Float
	ErrorCode    errlog.ErrorCode
	Location     errlog.LocationRange
}

Token ...

type TokenKind

type TokenKind int

TokenKind ...

const (
	TokenIdentifier TokenKind = 1 + iota
	TokenOctal
	TokenHex
	TokenInteger
	TokenFloat
	TokenString
	TokenRune
	TokenLineComment
	TokenBlockComment
	TokenAsterisk
	TokenSlash
	TokenDash
	TokenPipe
	TokenAt
	TokenOpenParanthesis
	TokenCloseParanthesis
	TokenOpenBraces
	TokenCloseBraces
	TokenComma

	// TokenDot ...
	TokenDot
	// TokenAmpersand ...
	TokenAmpersand
	// TokenTilde ...
	TokenTilde
	// TokenHash ...
	TokenHash
	// TokenBang ...
	TokenBang
	// TokenCaret ...
	TokenCaret
	// TokenPlus ...
	TokenPlus
	// TokenPercent ...
	TokenPercent
	// TokenLogicalOr ...
	TokenLogicalOr
	// TokenLogicalAnd ...
	TokenLogicalAnd
	// TokenBitClear ...
	TokenBitClear
	TokenFalse
	TokenTrue
	TokenNull

	TokenOpenBracket
	// TokenCloseBracket ...
	TokenCloseBracket
	// TokenColon ...
	TokenColon
	// TokenSemicolon ...
	TokenSemicolon
	// TokenAssign ...
	TokenAssign
	// TokenAssignPlus ...
	TokenAssignPlus
	// TokenAssignMinus ...
	TokenAssignMinus
	// TokenAssignAsterisk ...
	TokenAssignAsterisk
	// TokenAssignDivision ...
	TokenAssignDivision
	// TokenAssignShiftLeft ...
	TokenAssignShiftLeft
	// TokenAssignShiftRight ...
	TokenAssignShiftRight
	// TokenAssignBinaryOr ...
	TokenAssignBinaryOr
	// TokenAssignBinaryAnd ...
	TokenAssignBinaryAnd
	// TokenAssignPercent ...
	TokenAssignPercent
	// TokenAssignAndCaret ...
	TokenAssignAndCaret
	// TokenAssignCaret ...
	TokenAssignCaret
	// TokenWalrus ...
	TokenWalrus
	// TokenShiftLeft ...
	TokenShiftLeft
	// TokenShiftRight ...
	TokenShiftRight
	// TokenEqual ...
	TokenEqual
	// TokenNotEqual ...
	TokenNotEqual
	// TokenLessOrEqual ...
	TokenLessOrEqual
	// TokenGreaterOrEqual ...
	TokenGreaterOrEqual
	// TokenLess ...
	TokenLess
	// TokenGreater ...
	TokenGreater
	// TokenEllipsis ...
	TokenEllipsis

	TokenUnit

	TokenNewline
	TokenError
	TokenEOF
)

type Tracks

type Tracks struct {
	// Optional
	Name        *Token
	Parameters  []*Parameter
	Expressions []IExpression
	Location    errlog.LocationRange
}

Implements IDirective

type VectorExpression

type VectorExpression struct {
	Values   []IExpression
	Location errlog.LocationRange
}

Implements IExpression

Jump to

Keyboard shortcuts

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