parser

package
v0.0.0-...-4349ab3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewProgramContext   = pcontext.NewProgramContext
	NewUnitContext      = pcontext.NewUnitContext
	NewStackableContext = pcontext.NewStackableContext
)
View Source
var AddOpPredicator = token.Some(
	token.Symbol('+'),
	token.Symbol('-'),
	token.ReservedWord.HasKeyword("OR"),
	token.ReservedWord.HasKeyword("XOR"),
)
View Source
var MulOpPredicator = token.Some(
	token.Symbol('*'),
	token.Symbol('/'),
	token.ReservedWord.HasKeyword("DIV"),
	token.ReservedWord.HasKeyword("MOD"),
	token.ReservedWord.HasKeyword("AND"),
	token.ReservedWord.HasKeyword("SHL"),
	token.ReservedWord.HasKeyword("SHR"),
)
View Source
var QuitUntil = &QuitUntilType{}
View Source
var RelOpPredicator = token.Some(
	token.Symbol('>'),
	token.Symbol('<'),
	token.SpecialSymbol.HasText("<="),
	token.SpecialSymbol.HasText(">="),
	token.Symbol('='),
	token.SpecialSymbol.HasText("<>"),
	token.ReservedWord.HasKeyword("IN"),
	token.ReservedWord.HasKeyword("IS"),
)
View Source
var UnaryOpPredicator = token.Some(
	token.Symbol('+'),
	token.Symbol('-'),
)

Functions

This section is empty.

Types

type Context

type Context = pcontext.Context

func NewContext

func NewContext(args ...interface{}) Context

type Parser

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

func NewParser

func NewParser(ctx Context) *Parser

func (*Parser) AddPostSection

func (p *Parser) AddPostSection(fn func())

func (*Parser) ClassMethodDirectiveList

func (p *Parser) ClassMethodDirectiveList() (ast.ClassMethodDirectiveList, error)

func (*Parser) Current

func (p *Parser) Current(pred token.Predicator) (*token.Token, error)

func (*Parser) CurrentToken

func (p *Parser) CurrentToken() *token.Token

func (*Parser) IsNamespaceIdentifier

func (p *Parser) IsNamespaceIdentifier(t *token.Token) bool

func (*Parser) IsUnitIdentifier

func (p *Parser) IsUnitIdentifier(t *token.Token) bool

func (*Parser) Logf

func (p *Parser) Logf(format string, args ...interface{})

func (*Parser) NewIdent

func (p *Parser) NewIdent(t *token.Token) *ast.Ident

func (*Parser) NewIdentRef

func (p *Parser) NewIdentRef(t *token.Token) *ast.IdentRef

func (*Parser) Next

func (p *Parser) Next(pred token.Predicator) (*token.Token, error)

func (*Parser) NextToken

func (p *Parser) NextToken() *token.Token

func (*Parser) ParseArrayType

func (p *Parser) ParseArrayType() (*ast.ArrayType, error)

func (*Parser) ParseAssemblerStatement

func (p *Parser) ParseAssemblerStatement() (*ast.AssemblerStatement, error)

func (*Parser) ParseBlock

func (p *Parser) ParseBlock() (*ast.Block, error)

func (*Parser) ParseCaseLabel

func (p *Parser) ParseCaseLabel() (*ast.CaseLabel, error)

func (*Parser) ParseCaseLabels

func (p *Parser) ParseCaseLabels() (ast.CaseLabels, error)

func (*Parser) ParseCaseSelector

func (p *Parser) ParseCaseSelector() (*ast.CaseSelector, error)

func (*Parser) ParseCaseSelectors

func (p *Parser) ParseCaseSelectors() (ast.CaseSelectors, error)

func (*Parser) ParseCaseStmt

func (p *Parser) ParseCaseStmt() (*ast.CaseStmt, error)

func (*Parser) ParseClassField

func (p *Parser) ParseClassField() (*ast.ClassField, error)

func (*Parser) ParseClassFieldList

func (p *Parser) ParseClassFieldList() (ast.ClassFieldList, error)

func (*Parser) ParseClassHeritage

func (p *Parser) ParseClassHeritage() (ast.ClassHeritage, error)

func (*Parser) ParseClassMemberSection

func (p *Parser) ParseClassMemberSection(classType *ast.CustomClassType) (*ast.ClassMemberSection, error)

func (*Parser) ParseClassMemberSections

func (p *Parser) ParseClassMemberSections(classType *ast.CustomClassType) (ast.ClassMemberSections, error)

func (*Parser) ParseClassMethod

func (p *Parser) ParseClassMethod() (*ast.ClassMethod, error)

func (*Parser) ParseClassMethodList

func (p *Parser) ParseClassMethodList() (ast.ClassMethodList, error)

func (*Parser) ParseClassProperty

func (p *Parser) ParseClassProperty(classType *ast.CustomClassType) (*ast.ClassProperty, error)

func (*Parser) ParseClassPropertyList

func (p *Parser) ParseClassPropertyList(classType *ast.CustomClassType) (ast.ClassPropertyList, error)

func (*Parser) ParseClassType

func (p *Parser) ParseClassType() (ast.ClassType, error)

func (*Parser) ParseClassTypeOrClassRefType

func (p *Parser) ParseClassTypeOrClassRefType() (ast.Type, error)

func (*Parser) ParseCompoundStmt

func (p *Parser) ParseCompoundStmt(required bool) (*ast.CompoundStmt, error)

func (*Parser) ParseConstExpr

func (p *Parser) ParseConstExpr() (*ast.ConstExpr, error)

func (*Parser) ParseConstSection

func (p *Parser) ParseConstSection(required bool) (ast.ConstSection, error)

func (*Parser) ParseConstSubrageType

func (p *Parser) ParseConstSubrageType() (*ast.SubrangeType, error)

func (*Parser) ParseConstantDecl

func (p *Parser) ParseConstantDecl() (*ast.ConstantDecl, error)

func (*Parser) ParseConstructorHeading

func (p *Parser) ParseConstructorHeading() (*ast.ConstructorHeading, error)

func (*Parser) ParseCustomPointerType

func (p *Parser) ParseCustomPointerType() (*ast.CustomPointerType, error)

func (*Parser) ParseDeclSection

func (p *Parser) ParseDeclSection() (ast.DeclSection, error)

func (*Parser) ParseDeclSections

func (p *Parser) ParseDeclSections() (ast.DeclSections, error)

func (*Parser) ParseDesignator

func (p *Parser) ParseDesignator() (*ast.Designator, error)

func (*Parser) ParseDesignatorStatement

func (p *Parser) ParseDesignatorStatement() (ast.DesignatorStatement, error)

func (*Parser) ParseDestructorHeading

func (p *Parser) ParseDestructorHeading() (*ast.DestructorHeading, error)

func (*Parser) ParseEnumeratedType

func (p *Parser) ParseEnumeratedType() (ast.EnumeratedType, error)

func (*Parser) ParseEnumeratedTypeElement

func (p *Parser) ParseEnumeratedTypeElement() (*ast.EnumeratedTypeElement, error)

func (*Parser) ParseExceptionBlock

func (p *Parser) ParseExceptionBlock() (*ast.ExceptionBlock, error)

func (*Parser) ParseExceptionBlockHandler

func (p *Parser) ParseExceptionBlockHandler() (*ast.ExceptionBlockHandler, error)

func (*Parser) ParseExceptionBlockHandlers

func (p *Parser) ParseExceptionBlockHandlers() (ast.ExceptionBlockHandlers, error)

func (*Parser) ParseExportedHeading

func (p *Parser) ParseExportedHeading() (*ast.ExportedHeading, error)

func (*Parser) ParseExportsStmt

func (p *Parser) ParseExportsStmt(required bool) (*ast.ExportsStmt, error)

func (*Parser) ParseExportsStmts

func (p *Parser) ParseExportsStmts() (ast.ExportsStmts, error)

func (*Parser) ParseExprList

func (p *Parser) ParseExprList(terminator token.Predicator) (ast.ExprList, error)

func (*Parser) ParseExpression

func (p *Parser) ParseExpression() (*ast.Expression, error)

func (*Parser) ParseExternalOptions

func (p *Parser) ParseExternalOptions() (*ast.ExternalOptions, error)

func (*Parser) ParseFactor

func (p *Parser) ParseFactor() (ast.Factor, error)

func (*Parser) ParseFieldDecl

func (p *Parser) ParseFieldDecl(terminator token.Predicator) (*ast.FieldDecl, error)

func (*Parser) ParseFieldList

func (p *Parser) ParseFieldList(terminator token.Predicator) (*ast.FieldList, error)

func (*Parser) ParseFileType

func (p *Parser) ParseFileType() (*ast.FileType, error)

func (*Parser) ParseForStmt

func (p *Parser) ParseForStmt() (*ast.ForStmt, error)

func (*Parser) ParseFormalParameters

func (p *Parser) ParseFormalParameters(startRune, endRune rune) (ast.FormalParameters, error)

func (*Parser) ParseFormalParm

func (p *Parser) ParseFormalParm(endRune rune) (*ast.FormalParm, error)

func (*Parser) ParseFunctionDirectives

func (p *Parser) ParseFunctionDirectives() ([]ast.Directive, *ast.ExternalOptions, error)

func (*Parser) ParseFunctionHeading

func (p *Parser) ParseFunctionHeading() (*ast.FunctionHeading, error)

func (*Parser) ParseGotoStatement

func (p *Parser) ParseGotoStatement() (*ast.GotoStatement, error)

func (*Parser) ParseIdentList

func (p *Parser) ParseIdentList(terminator rune) (*ast.IdentList, error)

func (*Parser) ParseIdentListBy

func (p *Parser) ParseIdentListBy(terminatorPredicate token.Predicator) (*ast.IdentList, error)

func (*Parser) ParseIfStmt

func (p *Parser) ParseIfStmt() (*ast.IfStmt, error)

func (*Parser) ParseInheritedStmt

func (p *Parser) ParseInheritedStmt() (*ast.InheritedStatement, error)

func (*Parser) ParseLabelDeclSection

func (p *Parser) ParseLabelDeclSection() (*ast.LabelDeclSection, error)

func (*Parser) ParseManifestConstant

func (p *Parser) ParseManifestConstant(t *token.Token, skipTypeCheck bool) (*ast.ValueFactor, error)

func (*Parser) ParseNumberFactor

func (p *Parser) ParseNumberFactor(t *token.Token, skipTypeCheck bool) (*ast.NumberFactor, error)

func (*Parser) ParseOrdIdent

func (p *Parser) ParseOrdIdent(required bool) (ast.OrdIdent, error)

func (*Parser) ParseParameter

func (p *Parser) ParseParameter(endRune rune) (*ast.Parameter, error)

func (*Parser) ParseProcedureDeclSection

func (p *Parser) ParseProcedureDeclSection() (*ast.FunctionDecl, error)

func (*Parser) ParseProcedureType

func (p *Parser) ParseProcedureType() (*ast.ProcedureType, error)

func (*Parser) ParsePropertyInterface

func (p *Parser) ParsePropertyInterface() (*ast.PropertyInterface, error)

func (*Parser) ParseQualId

func (p *Parser) ParseQualId() (*ast.QualId, error)

func (*Parser) ParseQualIds

func (p *Parser) ParseQualIds() (ast.QualIds, error)

func (*Parser) ParseRaiseStmt

func (p *Parser) ParseRaiseStmt() (*ast.RaiseStmt, error)

func (*Parser) ParseRealType

func (p *Parser) ParseRealType(required bool) (ast.RealType, error)

func (*Parser) ParseRecType

func (p *Parser) ParseRecType() (*ast.RecType, error)

func (*Parser) ParseRecVariant

func (p *Parser) ParseRecVariant() (*ast.RecVariant, error)

func (*Parser) ParseRepeatStmt

func (p *Parser) ParseRepeatStmt() (*ast.RepeatStmt, error)

func (*Parser) ParseSetConstructor

func (p *Parser) ParseSetConstructor() (*ast.SetConstructor, error)

func (*Parser) ParseSetElement

func (p *Parser) ParseSetElement() (*ast.SetElement, error)

func (*Parser) ParseSetType

func (p *Parser) ParseSetType() (*ast.SetType, error)

func (*Parser) ParseSimpleExpression

func (p *Parser) ParseSimpleExpression() (*ast.SimpleExpression, error)

func (*Parser) ParseStatement

func (p *Parser) ParseStatement() (*ast.Statement, error)

func (*Parser) ParseStmtList

func (p *Parser) ParseStmtList(terminator token.Predicator) (ast.StmtList, error)

func (*Parser) ParseStringFactor

func (p *Parser) ParseStringFactor(t *token.Token, skipTypeCheck bool) (*ast.StringFactor, error)

func (*Parser) ParseStringOfStringType

func (p *Parser) ParseStringOfStringType() (ast.StringType, error)

This method parses just STRING not ANSISTRING nor WIDESTRING

func (*Parser) ParseStringType

func (p *Parser) ParseStringType(required bool) (ast.StringType, error)

func (*Parser) ParseStrucType

func (p *Parser) ParseStrucType() (ast.StrucType, error)

func (*Parser) ParseTerm

func (p *Parser) ParseTerm() (*ast.Term, error)

func (*Parser) ParseThreadVarDecl

func (p *Parser) ParseThreadVarDecl() (*ast.ThreadVarDecl, error)

func (*Parser) ParseThreadVarSection

func (p *Parser) ParseThreadVarSection(required bool) (ast.ThreadVarSection, error)

func (*Parser) ParseTryStmt

func (p *Parser) ParseTryStmt() (ast.TryStmt, error)

func (*Parser) ParseType

func (p *Parser) ParseType() (ast.Type, error)

func (*Parser) ParseTypeAsOrdinalType

func (p *Parser) ParseTypeAsOrdinalType() (ast.OrdinalType, error)

func (*Parser) ParseTypeDecl

func (p *Parser) ParseTypeDecl() (*ast.TypeDecl, error)

func (*Parser) ParseTypeForIdentifier

func (p *Parser) ParseTypeForIdentifier() (ast.Type, error)

func (*Parser) ParseTypeId

func (p *Parser) ParseTypeId() (*ast.TypeId, error)

func (*Parser) ParseTypeSection

func (p *Parser) ParseTypeSection(required bool) (ast.TypeSection, error)

func (*Parser) ParseUsesClause

func (p *Parser) ParseUsesClause() (ast.UsesClause, error)

func (*Parser) ParseVarDecl

func (p *Parser) ParseVarDecl() (*ast.VarDecl, error)

func (*Parser) ParseVarSection

func (p *Parser) ParseVarSection(required bool) (ast.VarSection, error)

func (*Parser) ParseVariantSection

func (p *Parser) ParseVariantSection() (*ast.VariantSection, error)

func (*Parser) ParseVariantType

func (p *Parser) ParseVariantType(required bool) (ast.VariantType, error)

func (*Parser) ParseWhileStmt

func (p *Parser) ParseWhileStmt() (*ast.WhileStmt, error)

func (*Parser) ParseWithStmt

func (p *Parser) ParseWithStmt() (*ast.WithStmt, error)

func (*Parser) PlaceString

func (p *Parser) PlaceString(t *token.Token) string

func (*Parser) RollbackPoint

func (p *Parser) RollbackPoint() func()

func (*Parser) RunPostSectionFuncs

func (p *Parser) RunPostSectionFuncs()

func (*Parser) SetText

func (p *Parser) SetText(text *[]rune)

func (*Parser) SetupPostSectionFuncs

func (p *Parser) SetupPostSectionFuncs() func()

func (*Parser) TokenErrorf

func (p *Parser) TokenErrorf(format string, t *token.Token, args ...interface{}) error

func (*Parser) TraceMethod

func (p *Parser) TraceMethod(name string) func()

func (*Parser) Until

func (p *Parser) Until(terminator token.Predicator, separator token.Predicator, fn func() error) error

func (*Parser) Validate

func (p *Parser) Validate(t *token.Token, predicates ...token.Predicator) error

type Program

type Program struct {
	*ast.Program
	Units ast.Units
}

func ParseProgram

func ParseProgram(path string) (*Program, error)

type ProgramContext

type ProgramContext = pcontext.ProgramContext

type ProgramParser

type ProgramParser struct {
	*Parser
	Program *ast.Program
	// contains filtered or unexported fields
}

func NewProgramParser

func NewProgramParser(ctx *ProgramContext) *ProgramParser

func (*ProgramParser) LoadUnits

func (p *ProgramParser) LoadUnits(uses ast.UsesClause) error

func (*ProgramParser) ParseProgram

func (p *ProgramParser) ParseProgram() (*ast.Program, error)

func (*ProgramParser) ParseProgramBlock

func (p *ProgramParser) ParseProgramBlock() (*ast.ProgramBlock, error)

type QuitUntilType

type QuitUntilType struct{}

func (*QuitUntilType) Error

func (*QuitUntilType) Error() string

type StackableContext

type StackableContext = pcontext.StackableContext

type UnitContext

type UnitContext = pcontext.UnitContext

type UnitParser

type UnitParser struct {
	*Parser

	Unit *ast.Unit
	// contains filtered or unexported fields
}

func NewUnitParser

func NewUnitParser(ctx *UnitContext) *UnitParser

func (*UnitParser) LoadFile

func (p *UnitParser) LoadFile() error

func (*UnitParser) ParseImplBody

func (p *UnitParser) ParseImplBody() error

func (*UnitParser) ParseImplUses

func (p *UnitParser) ParseImplUses() error

func (*UnitParser) ParseInitSection

func (p *UnitParser) ParseInitSection() (*ast.InitSection, error)

func (*UnitParser) ParseInterfaceSectionDecls

func (p *UnitParser) ParseInterfaceSectionDecls() error

func (*UnitParser) ParseInterfaceSectionUses

func (p *UnitParser) ParseInterfaceSectionUses() (*ast.InterfaceSection, error)

func (*UnitParser) ParseUnit

func (p *UnitParser) ParseUnit() (*ast.Unit, error)

ParseUnit method is not deleted for tests. Don't use this method not for test.

func (*UnitParser) ParseUnitEnd

func (p *UnitParser) ParseUnitEnd() error

func (*UnitParser) ParseUnitIdent

func (p *UnitParser) ParseUnitIdent() (*ast.Unit, error)

func (*UnitParser) ParseUnitIdentAndIntfUses

func (p *UnitParser) ParseUnitIdentAndIntfUses() (*ast.Unit, error)

func (*UnitParser) ParseUnitIntfBody

func (p *UnitParser) ParseUnitIntfBody() error

func (*UnitParser) ParseUnitIntfUses

func (p *UnitParser) ParseUnitIntfUses() error

func (*UnitParser) ProcessIdentAndIntfUses

func (p *UnitParser) ProcessIdentAndIntfUses() error

func (*UnitParser) ProcessImplAndInit

func (m *UnitParser) ProcessImplAndInit() error

func (*UnitParser) ProcessIntfBody

func (m *UnitParser) ProcessIntfBody() error

type UnitParsers

type UnitParsers []*UnitParser

func (UnitParsers) DeclMaps

func (m UnitParsers) DeclMaps() astcore.DeclMaps

func (UnitParsers) Graph

func (m UnitParsers) Graph() *toposort.Graph

func (UnitParsers) Map

func (m UnitParsers) Map() map[string]*UnitParser

func (UnitParsers) Sort

func (m UnitParsers) Sort() (UnitParsers, error)

func (UnitParsers) UnitNames

func (m UnitParsers) UnitNames() ext.StringSet

func (UnitParsers) Units

func (m UnitParsers) Units() ast.Units

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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