ast

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDENTIFIER ExpressionType = "identifier"
	PREFIX     ExpressionType = "prefix"
	INFLIX     ExpressionType = "inflix"

	AND Operator = "and"
	OR  Operator = "or"

	ACTION   RelationalReferenceType = "action"
	RELATION RelationalReferenceType = "relation"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionStatement

type ActionStatement struct {
	Token               token.Token // token.ACTION
	Name                token.Token // token.IDENT
	ExpressionStatement Statement
}

ActionStatement -

func (*ActionStatement) String

func (ls *ActionStatement) String() string

String -

func (*ActionStatement) TokenLiteral

func (ls *ActionStatement) TokenLiteral() string

TokenLiteral -

type EntityStatement

type EntityStatement struct {
	Token              token.Token // token.ENTITY
	Name               token.Token // token.IDENT
	RelationStatements []Statement
	ActionStatements   []Statement
	Option             token.Token // token.OPTION
}

EntityStatement -

func (*EntityStatement) String

func (ls *EntityStatement) String() string

String -

func (*EntityStatement) TokenLiteral

func (ls *EntityStatement) TokenLiteral() string

TokenLiteral -

type Expression

type Expression interface {
	Node

	IsInfix() bool
	GetType() ExpressionType
	GetValue() string
	// contains filtered or unexported methods
}

Expression -

type ExpressionStatement

type ExpressionStatement struct {
	Expression Expression
}

ExpressionStatement struct

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

TokenLiteral function on ExpressionStatement

type ExpressionType

type ExpressionType string

type Identifier

type Identifier struct {
	Token token.Token // token.IDENT
	Value string
}

Identifier -

func (*Identifier) GetType

func (ls *Identifier) GetType() ExpressionType

GetType -

func (*Identifier) GetValue

func (ls *Identifier) GetValue() string

GetValue -

func (*Identifier) IsInfix

func (ls *Identifier) IsInfix() bool

IsInfix -

func (*Identifier) String

func (ls *Identifier) String() string

String -

func (*Identifier) TokenLiteral

func (ls *Identifier) TokenLiteral() string

TokenLiteral -

type InfixExpression

type InfixExpression struct {
	Token    token.Token // The operator token, e.g. and, or
	Left     Expression
	Operator Operator
	Right    Expression
}

InfixExpression -

func (*InfixExpression) GetType

func (ie *InfixExpression) GetType() ExpressionType

GetType -

func (*InfixExpression) GetValue

func (ie *InfixExpression) GetValue() string

GetValue -

func (*InfixExpression) IsInfix

func (ie *InfixExpression) IsInfix() bool

IsInfix -

func (*InfixExpression) String

func (ie *InfixExpression) String() string

String -

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

TokenLiteral -

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

Node -

type Operator

type Operator string

func (Operator) String

func (o Operator) String() string

String -

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token // not
	Operator string
	Value    string
}

PrefixExpression -

func (*PrefixExpression) GetType

func (pe *PrefixExpression) GetType() ExpressionType

GetType -

func (*PrefixExpression) GetValue

func (pe *PrefixExpression) GetValue() string

GetValue -

func (*PrefixExpression) IsInfix

func (pe *PrefixExpression) IsInfix() bool

IsInfix -

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

String -

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

TokenLiteral -

type RelationStatement

type RelationStatement struct {
	Token         token.Token // token.RELATION
	Name          token.Token // token.IDENT
	RelationTypes []Statement
	Option        token.Token // token.OPTION
}

RelationStatement -

func (*RelationStatement) String

func (ls *RelationStatement) String() string

String -

func (*RelationStatement) TokenLiteral

func (ls *RelationStatement) TokenLiteral() string

TokenLiteral -

type RelationTypeStatement

type RelationTypeStatement struct {
	Sign  token.Token // token.SIGN
	Token token.Token // token.IDENT
}

RelationTypeStatement -

func (*RelationTypeStatement) IsEntityReference

func (ls *RelationTypeStatement) IsEntityReference() bool

IsEntityReference -

func (*RelationTypeStatement) String

func (ls *RelationTypeStatement) String() string

String -

func (*RelationTypeStatement) TokenLiteral

func (ls *RelationTypeStatement) TokenLiteral() string

TokenLiteral -

type RelationTypeStatements

type RelationTypeStatements []RelationTypeStatement

RelationTypeStatements -

func (RelationTypeStatements) GetEntityReference

func (st RelationTypeStatements) GetEntityReference() string

GetEntityReference -

type RelationalReferenceType

type RelationalReferenceType string

type Schema

type Schema struct {
	Statements []Statement
	// contains filtered or unexported fields
}

Schema -

func (*Schema) GetRelationReferenceIfExist

func (sch *Schema) GetRelationReferenceIfExist(name string) ([]RelationTypeStatement, bool)

GetRelationReferenceIfExist -

func (*Schema) GetRelationalReferenceTypeIfExist

func (sch *Schema) GetRelationalReferenceTypeIfExist(r string) (RelationalReferenceType, bool)

GetRelationalReferenceTypeIfExist -

func (*Schema) IsEntityReferenceExist

func (sch *Schema) IsEntityReferenceExist(name string) bool

IsEntityReferenceExist -

func (*Schema) IsRelationReferenceExist

func (sch *Schema) IsRelationReferenceExist(name string) bool

IsRelationReferenceExist -

func (*Schema) SetActionReferences

func (sch *Schema) SetActionReferences(r map[string]struct{})

SetActionReferences -

func (*Schema) SetEntityReferences

func (sch *Schema) SetEntityReferences(r map[string]struct{})

SetEntityReferences -

func (*Schema) SetRelationReferences

func (sch *Schema) SetRelationReferences(r map[string][]RelationTypeStatement)

SetRelationReferences -

func (*Schema) SetRelationalReferences

func (sch *Schema) SetRelationalReferences(r map[string]RelationalReferenceType)

SetRelationalReferences it contains action and relation references

func (*Schema) ValidateReferences

func (sch *Schema) ValidateReferences() error

ValidateReferences -

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

Statement -

Jump to

Keyboard shortcuts

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