tokens

package module
v0.0.0-...-6155d41 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package tokens contains the definitions for all gecko symbols/tokens

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addition

type Addition struct {
	Multiplication *Multiplication `parser:"@@"`
	Op             string          `parser:"[ @( '-' | '+' | '|' | '&' | '>' '>' '>' | '<' '<' '<')"`
	Next           *Addition       `parser:"  @@ ]"`
	// contains filtered or unexported fields
}

func (*Addition) GetID

func (t *Addition) GetID() string

func (*Addition) ToCString

func (a *Addition) ToCString(scope *ast.Ast) string

type Argument

type Argument struct {
	Name    string      `parser:"[ @Ident ':' ]"`
	Value   *Expression `parser:"( @@"`
	SubCall *FuncCall   `parser:"| @@)"`
	// contains filtered or unexported fields
}

func (*Argument) GetID

func (t *Argument) GetID() string

type Assignment

type Assignment struct {
	Name  string      `parser:"@Ident"`
	Value *Expression `parser:"'=' @@"`
	// contains filtered or unexported fields
}

func (*Assignment) GetID

func (t *Assignment) GetID() string

type CImport

type CImport struct {
	Header      string `parser:"'cimport' @String"`
	WithObject  string `parser:"[ 'withobject' @String"`
	WithLibrary string `parser:"| 'withlibrary' @String ]"`
	// contains filtered or unexported fields
}

func (*CImport) GetID

func (t *CImport) GetID() string

type Class

type Class struct {
	Visibility      string             `parser:"[ @'private' | @'public' | @'protected' ]"`
	ExternalName    string             `parser:"[ 'external' @String ]"`
	Name            string             `parser:"'class' @Ident"`
	Fields          []*ClassBlockField `parser:"'{' { @@ } '}'"`
	Implementations []*Implementation
	// contains filtered or unexported fields
}

func (*Class) GetID

func (t *Class) GetID() string

type ClassBlockField

type ClassBlockField struct {
	Method *Method `parser:"@@"`
	Field  *Field  `parser:"| @@"`
	// contains filtered or unexported fields
}

func (*ClassBlockField) GetID

func (t *ClassBlockField) GetID() string

type ClassField

type ClassField struct {
	Field
	// contains filtered or unexported fields
}

func (*ClassField) GetID

func (t *ClassField) GetID() string

type ClassMethod

type ClassMethod struct {
	Method
	// contains filtered or unexported fields
}

func (*ClassMethod) GetID

func (t *ClassMethod) GetID() string

type Comparison

type Comparison struct {
	Addition *Addition   `parser:"@@"`
	Op       string      `parser:"[ @( '>' | '>' '=' | '<' | '<' '=' )"`
	Next     *Comparison `parser:"  @@ ]"`
	// contains filtered or unexported fields
}

func (*Comparison) GetID

func (t *Comparison) GetID() string

func (*Comparison) ToCString

func (c *Comparison) ToCString(scope *ast.Ast) string

type Declaration

type Declaration struct {
	Method *Method `parser:"( 'declare' @@ "`
	Field  *Field  `parser:"| 'declare' @@)"`
	// contains filtered or unexported fields
}

func (*Declaration) GetID

func (t *Declaration) GetID() string

type Else

type Else struct {
	Value []*Entry `parser:"'else' '{' { @@ } '}'"`
	// contains filtered or unexported fields
}

func (*Else) GetID

func (t *Else) GetID() string

type ElseIf

type ElseIf struct {
	Expression *Expression `parser:"'else' 'if' '(' @@ ')'"`
	Value      []*Entry    `parser:"'{' { @@ } '}'"`
	ElseIf     *ElseIf     `parser:"[ @@ "`
	Else       *Else       `parser:"| @@ ]"`
	// contains filtered or unexported fields
}

func (*ElseIf) GetID

func (t *ElseIf) GetID() string

type Entry

type Entry struct {
	Return         *Expression     `parser:"'return' @@"`
	VoidReturn     *bool           `parser:"| @'return'"`
	Assignment     *Assignment     `parser:"| @@"`
	ElseIf         *ElseIf         `parser:"| @@"`
	Else           *Else           `parser:"| @@"`
	If             *If             `parser:"| @@"`
	FuncCall       *FuncCall       `parser:"| @@"`
	Method         *Method         `parser:"| @@"`
	Class          *Class          `parser:"| @@"`
	Implementation *Implementation `parser:"| @@"`
	Trait          *Trait          `parser:"| @@"`
	Enum           *Enum           `parser:"| @@"`
	Field          *Field          `parser:"| @@"`
	Loop           *Loop           `parser:"| @@"`
	CImport        *CImport        `parser:"| @@"`
	Declaration    *Declaration    `parser:"| @@"`
	Import         *Import         `parser:"| @@"`
	// contains filtered or unexported fields
}

func (*Entry) GetID

func (t *Entry) GetID() string

type Enum

type Enum struct {
	Name  string   `parser:"'enum' @Ident"`
	Cases []string `parser:"'{' { @Ident } '}'"`
	// contains filtered or unexported fields
}

func (*Enum) GetID

func (t *Enum) GetID() string

type Equality

type Equality struct {
	Comparison *Comparison `parser:"@@"`
	Op         string      `parser:"[ @( '!' '=' | '=' '=' )"`
	Next       *Equality   `parser:"  @@ ]"`
	// contains filtered or unexported fields
}

func (*Equality) GetID

func (t *Equality) GetID() string

func (*Equality) ToCString

func (eq *Equality) ToCString(scope *ast.Ast) string

type Expression

type Expression struct {
	Equality *Equality `parser:"@@"`
	// contains filtered or unexported fields
}

func (*Expression) GetID

func (t *Expression) GetID() string

func (*Expression) ToCString

func (e *Expression) ToCString(scope *ast.Ast) string

type Field

type Field struct {
	Visibility string      `parser:"[ @'private' | @'public' | @'protected' | @'external' ]"`
	Mutability string      `parser:"@'let'"`
	Name       string      `parser:"@Ident"`
	Type       *TypeRef    `parser:"[ ':' @@ ]"`
	Value      *Expression `parser:"[ '=' @@ ]"`
	// contains filtered or unexported fields
}

func (*Field) GetID

func (t *Field) GetID() string

func (*Field) ToCString

func (f *Field) ToCString(scope *ast.Ast) string

type File

type File struct {
	PackageName string   `parser:"['package' @Ident]"`
	Entries     []*Entry `parser:"@@*"`
	Imports     []*File
	Config      *config.CompileCfg
	Name        string
	Path        string
	Content     string
}

type ForInLoop

type ForInLoop struct {
	Variable    *Field      `parser:"@@ 'in'"`
	SourceArray *Expression `parser:"@@"`
	// contains filtered or unexported fields
}

func (*ForInLoop) GetID

func (t *ForInLoop) GetID() string

type ForOfLoop

type ForOfLoop struct {
	Variable    *Field      `parser:"@@ 'of'"`
	SourceArray *Expression `parser:"@@"`
	// contains filtered or unexported fields
}

func (*ForOfLoop) GetID

func (t *ForOfLoop) GetID() string

type FuncCall

type FuncCall struct {
	Function  string      `parser:"@Ident"`
	Arguments []*Argument `parser:"'(' [ @@ { ',' @@ } ] ')'"`
	// contains filtered or unexported fields
}

func (*FuncCall) GetID

func (t *FuncCall) GetID() string

func (*FuncCall) ToCString

func (f *FuncCall) ToCString(scope *ast.Ast) string

type If

type If struct {
	Expression *Expression `parser:"'if' '(' @@ ')'"`
	Value      []*Entry    `parser:"'{' { @@ } '}'"`
	ElseIf     *ElseIf     `parser:"[ @@ "`
	Else       *Else       `parser:"| @@ ]"`
	// contains filtered or unexported fields
}

func (*If) GetID

func (t *If) GetID() string

type Implementation

type Implementation struct {
	Visibility string                 `parser:"[ @'private' | @'public' | @'protected' ]"`
	Default    bool                   `parser:"[ @'default' ]"`
	Name       string                 `parser:"'impl' @Ident"`
	For        string                 `parser:"['for' @Ident]"`
	Fields     []*ImplementationField `parser:"[ '{' { @@ } '}' ]"`
	// contains filtered or unexported fields
}

func (*Implementation) GetID

func (t *Implementation) GetID() string

type ImplementationField

type ImplementationField struct {
	Name      string   `parser:"'func' @Ident"`
	Arguments []*Value `parser:"[ '(' [ @@ { ',' @@ } ] ')' ]"`
	Type      *TypeRef `parser:"':' @@"`
	Value     []*Entry `parser:"[ '{' @@* '}' ]"`
	// contains filtered or unexported fields
}

func (*ImplementationField) GetID

func (t *ImplementationField) GetID() string

func (*ImplementationField) ToMethodToken

func (i *ImplementationField) ToMethodToken() *Method

type Import

type Import struct {
	Package string   `parser:"'import' @Ident"`
	Objects []string `parser:"['use' '{' [ @Ident { ',' @Ident } ] '}']"`
	// contains filtered or unexported fields
}

func (*Import) GetID

func (t *Import) GetID() string

type Literal

type Literal struct {
	IsPointer  bool              `parser:"[ @'&' ]"`
	FuncCall   *FuncCall         `parser:"( @@"`
	Bool       string            `parser:" | @( 'true' | 'false' )"`
	String     string            `parser:" | @String"`
	Symbol     string            `parser:" | @Ident"`
	Number     string            `parser:" | @Number"`
	Object     []*ObjectKeyValue `parser:" | '{' [ @@ { ',' @@ } ] '}'"`
	Array      []*Literal        `parser:" | '[' [ @@ { ',' @@ } ] ']' )"`
	ArrayIndex *Literal          `parser:"[ '[' @@ ']' ]"`
	// contains filtered or unexported fields
}

func (*Literal) GetID

func (t *Literal) GetID() string

func (*Literal) ToCString

func (l *Literal) ToCString(scope *ast.Ast) string

func (*Literal) ToLLIRValue

func (l *Literal) ToLLIRValue(scope *ast.Ast) value.Value

type Loop

type Loop struct {
	For           string      `parser:"'for'"`
	ForOf         *ForOfLoop  `parser:"( @@"`
	ForIn         *ForInLoop  `parser:" | @@"`
	ForExpression *Expression `parser:" | @@ )"`
	Value         []*Entry    `parser:" '{' @@* '}' "`
	// contains filtered or unexported fields
}

func (*Loop) GetID

func (t *Loop) GetID() string

type Method

type Method struct {
	Visibility string   `parser:"[ @'private' | @'public' | @'protected' | @'external' ]"`
	Variardic  bool     `parser:"[ @'variardic' ]"`
	Name       string   `parser:"'func' @Ident"`
	Arguments  []*Value `parser:"'(' [ @@ { ',' @@ } ] ')'"`
	Type       *TypeRef `parser:"[ ':' @@ ]"`
	Value      []*Entry `parser:"[ '{' @@* '}' ]"`
	// contains filtered or unexported fields
}

func (*Method) GetID

func (t *Method) GetID() string

type Multiplication

type Multiplication struct {
	Unary *Unary          `parser:"@@"`
	Op    string          `parser:"[ @( '/' | '*' )"`
	Next  *Multiplication `parser:"  @@ ]"`
	// contains filtered or unexported fields
}

func (*Multiplication) GetID

func (t *Multiplication) GetID() string

func (*Multiplication) ToCString

func (m *Multiplication) ToCString(scope *ast.Ast) string

type Object

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

func (*Object) GetID

func (t *Object) GetID() string

type ObjectKeyValue

type ObjectKeyValue struct {
	Key   string      `parser:"@Ident ':'"`
	Value *Expression `parser:"@@"`
	// contains filtered or unexported fields
}

func (*ObjectKeyValue) GetID

func (t *ObjectKeyValue) GetID() string

type Primary

type Primary struct {
	Literal *Literal `parser:"@@"`
	// IsPointer     *bool       `parser:"[ '&' ]"`
	// FuncCall      *FuncCall   `parser:"( @@"`
	// Bool          string      `parser:" | ( @'true' | @'false' )"`
	// Nil           *bool       `parser:" | @'nil'"`
	// String        string      `parser:" | @String"`
	// Symbol        string      `parser:" | @Ident"`
	// Number        string      `parser:" | @Number"`
	SubExpression *Expression `parser:" | '(' @@ ')'"`
	// contains filtered or unexported fields
}

func (*Primary) GetID

func (t *Primary) GetID() string

func (*Primary) ToCString

func (p *Primary) ToCString(scope *ast.Ast) string

type SizeDef

type SizeDef struct {
	Size string   `parser:"'[' @Number ']'"`
	Type *TypeRef `parser:"@@"`
	// contains filtered or unexported fields
}

func (*SizeDef) GetID

func (t *SizeDef) GetID() string

type Trait

type Trait struct {
	Name   string                 `parser:"'trait' @Ident"`
	Type   *TypeRef               `parser:"'<' @@ '>'"`
	Fields []*ImplementationField `parser:"'{' { @@ } '}'"`
	// contains filtered or unexported fields
}

func (*Trait) GetID

func (t *Trait) GetID() string

type TypeRef

type TypeRef struct {
	Array   *TypeRef `parser:"( '[' @@ ']'"`
	Size    *SizeDef `parser:" | @@"`
	Type    string   `parser:" | @Ident)"`
	Trait   string   `parser:"[ 'is' @Ident ]"`
	Const   bool     `parser:"[ @'!' ]"`
	Pointer bool     `parser:"[ @'*']"`
	// contains filtered or unexported fields
}

func (*TypeRef) Check

func (t *TypeRef) Check(scope *ast.Ast) bool

func (*TypeRef) GetID

func (t *TypeRef) GetID() string

func (*TypeRef) ToCString

func (t *TypeRef) ToCString(scope *ast.Ast) string

type Unary

type Unary struct {
	Op      string   `parser:"  ( @( '!' | '-' | '+' )"`
	Unary   *Unary   `parser:"    @@ )"`
	Primary *Primary `parser:"| @@"`
	// contains filtered or unexported fields
}

func (*Unary) GetID

func (t *Unary) GetID() string

func (*Unary) ToCString

func (u *Unary) ToCString(scope *ast.Ast) string

type Value

type Value struct {
	Variadic bool        `parser:"[ @'...' ]"`
	Name     string      `parser:"@Ident"`
	Type     *TypeRef    `parser:"':' @@"`
	Default  *Expression `parser:"[ '=' @@ ]"`
	// contains filtered or unexported fields
}

func (*Value) GetID

func (t *Value) GetID() string

Jump to

Keyboard shortcuts

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