ast

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayLiteral

type ArrayLiteral struct {
	StartToken lexer.Token
	Elements   []Expression
}

func (ArrayLiteral) Range

func (a ArrayLiteral) Range() SourceRange

type ArrayType

type ArrayType struct {
	Token   lexer.Token
	Element TypeReference
}

func (ArrayType) Range

func (a ArrayType) Range() SourceRange

type BooleanLiteral

type BooleanLiteral struct {
	Token lexer.Token
	Value bool
}

func (BooleanLiteral) Range

func (b BooleanLiteral) Range() SourceRange

type ChoiceType

type ChoiceType struct {
	Token   lexer.Token
	Members []Expression
}

func (ChoiceType) Range

func (c ChoiceType) Range() SourceRange

type ConditionalExpression

type ConditionalExpression struct {
	Condition Expression
	Then      Expression
	Else      Expression
}

func (ConditionalExpression) Range

type Declaration

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

type DocDeclaration

type DocDeclaration struct {
	Kind          DocumentationKind
	KeywordToken  lexer.Token
	TargetToken   lexer.Token
	Target        string
	Documentation Documentation
}

func (DocDeclaration) Range

func (d DocDeclaration) Range() SourceRange

type Documentation

type Documentation struct {
	Summary     *StringLiteral
	Description *StringLiteral
	Props       map[string]StringLiteral
}

type DocumentationKind

type DocumentationKind int
const (
	DocumentationKindGeneral DocumentationKind = iota
	DocumentationKindSchema
)

type Expression

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

type File

type File struct {
	Imports []ImportDeclaration
	Script  *ScriptBlock
	Output  OutputBlock
}

type FloatLiteral

type FloatLiteral struct {
	Token  lexer.Token
	Lexeme string
}

func (FloatLiteral) Range

func (f FloatLiteral) Range() SourceRange

type GroupedExpression

type GroupedExpression struct {
	StartToken lexer.Token
	Expression Expression
}

func (GroupedExpression) Range

func (g GroupedExpression) Range() SourceRange

type HexFloatLiteral

type HexFloatLiteral struct {
	Token  lexer.Token
	Lexeme string
}

func (HexFloatLiteral) Range

func (h HexFloatLiteral) Range() SourceRange

type HexIntLiteral

type HexIntLiteral struct {
	Token  lexer.Token
	Lexeme string
}

func (HexIntLiteral) Range

func (h HexIntLiteral) Range() SourceRange

type Identifier

type Identifier struct {
	Token lexer.Token
	Name  string
}

func (Identifier) Range

func (i Identifier) Range() SourceRange

type ImportDeclaration

type ImportDeclaration struct {
	Path        StringLiteral
	Identifiers []ImportedIdentifier
	Binding     *ImportedIdentifier
}

type ImportedIdentifier

type ImportedIdentifier struct {
	Name  string // exported name (the name in the source file)
	Alias string // local alias (empty if no alias)
}

func (ImportedIdentifier) LocalName

func (i ImportedIdentifier) LocalName() string

type InfixExpression

type InfixExpression struct {
	Left          Expression
	OperatorToken lexer.Token
	Operator      lexer.TokenType
	Right         Expression
}

func (InfixExpression) Range

func (i InfixExpression) Range() SourceRange

type IntLiteral

type IntLiteral struct {
	Token  lexer.Token
	Lexeme string
}

func (IntLiteral) Range

func (i IntLiteral) Range() SourceRange

type MatchArm

type MatchArm struct {
	Pattern MatchPattern
	Value   Expression
}

type MatchExpression

type MatchExpression struct {
	MatchToken lexer.Token
	Value      Expression
	Arms       []MatchArm
	EndToken   lexer.Token
}

func (MatchExpression) Range

func (m MatchExpression) Range() SourceRange

type MatchPattern

type MatchPattern struct {
	Type    TypeReference
	Literal Expression
}

func (MatchPattern) Range

func (m MatchPattern) Range() SourceRange

type MemberAccess

type MemberAccess struct {
	Target        Expression
	OperatorToken lexer.Token
	NameToken     lexer.Token
	Name          string
	Optional      bool
}

func (MemberAccess) Range

func (m MemberAccess) Range() SourceRange

type NamedType

type NamedType struct {
	Token lexer.Token
	Name  string
}

func (NamedType) Range

func (n NamedType) Range() SourceRange

type Node

type Node interface {
	Range() SourceRange
}

type NullLiteral

type NullLiteral struct {
	Token lexer.Token
}

func (NullLiteral) Range

func (n NullLiteral) Range() SourceRange

type OutputBlock

type OutputBlock struct {
	Directives   []OutputDirective
	Mode         OutputMode
	DataFields   []OutputField
	SchemaFields []OutputSchemaField
}

type OutputDirective

type OutputDirective struct {
	Kind        OutputDirectiveKind
	Value       string
	Description Expression
}

type OutputDirectiveKind

type OutputDirectiveKind int
const (
	OutputDirectiveOutput OutputDirectiveKind = iota
	OutputDirectiveSchemaFile
	OutputDirectiveSchema
	OutputDirectiveParse
	OutputDirectiveParseFile
	OutputDirectiveDescription
)

type OutputField

type OutputField struct {
	NameToken   lexer.Token
	Name        string
	Optional    bool
	Shorthand   bool
	Value       Expression
	Description string
}

func (OutputField) Range

func (o OutputField) Range() SourceRange

type OutputMode

type OutputMode int
const (
	OutputModeData OutputMode = iota
	OutputModeSchema
)

type OutputSchemaField

type OutputSchemaField struct {
	NameToken   lexer.Token
	Name        string
	Optional    bool
	Type        TypeReference
	Description string
}

func (OutputSchemaField) Range

func (o OutputSchemaField) Range() SourceRange

type PrefixExpression

type PrefixExpression struct {
	OperatorToken lexer.Token
	Operator      lexer.TokenType
	Right         Expression
}

func (PrefixExpression) Range

func (p PrefixExpression) Range() SourceRange

type PrimitiveType

type PrimitiveType struct {
	Token lexer.Token
	Name  string
}

func (PrimitiveType) Range

func (p PrimitiveType) Range() SourceRange

type RecordField

type RecordField struct {
	NameToken lexer.Token
	Name      string
	Optional  bool
	Shorthand bool
	Value     Expression
}

func (RecordField) Range

func (r RecordField) Range() SourceRange

type RecordLiteral

type RecordLiteral struct {
	StartToken lexer.Token
	Fields     []RecordField
}

func (RecordLiteral) Range

func (r RecordLiteral) Range() SourceRange

type RecordMapType

type RecordMapType struct {
	Token lexer.Token
	Value TypeReference
}

func (RecordMapType) Range

func (r RecordMapType) Range() SourceRange

type RecordType

type RecordType struct {
	StartToken lexer.Token
	Fields     []SchemaField
}

func (RecordType) Range

func (r RecordType) Range() SourceRange

type SchemaDeclaration

type SchemaDeclaration struct {
	NameToken lexer.Token
	Name      string
	Type      RecordType
}

func (SchemaDeclaration) Range

func (s SchemaDeclaration) Range() SourceRange

type SchemaField

type SchemaField struct {
	NameToken   lexer.Token
	Name        string
	Optional    bool
	Type        TypeReference
	Description string
}

func (SchemaField) Range

func (s SchemaField) Range() SourceRange

type ScriptBlock

type ScriptBlock struct {
	Imports []ImportDeclaration
	Items   []Declaration
}

type SelfReference

type SelfReference struct {
	Token      lexer.Token
	PathTokens []lexer.Token
	Path       []string
}

func (SelfReference) Range

func (s SelfReference) Range() SourceRange

type SourcePosition

type SourcePosition struct {
	Line   int
	Column int
}

type SourceRange

type SourceRange struct {
	Start SourcePosition
	End   SourcePosition
}

func TokenRange

func TokenRange(token lexer.Token) SourceRange

type StringLiteral

type StringLiteral struct {
	Token  lexer.Token
	Lexeme string
}

func (StringLiteral) Range

func (s StringLiteral) Range() SourceRange

type TypeDeclaration

type TypeDeclaration struct {
	NameToken   lexer.Token
	Name        string
	Type        TypeReference
	Description string
}

func (TypeDeclaration) Range

func (t TypeDeclaration) Range() SourceRange

type TypeReference

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

type UnionType

type UnionType struct {
	Token   lexer.Token
	Members []TypeReference
}

func (UnionType) Range

func (u UnionType) Range() SourceRange

type VariableDeclaration

type VariableDeclaration struct {
	HasValue    bool
	Type        TypeReference
	NameToken   lexer.Token
	Name        string
	Value       Expression
	Description string
}

func (VariableDeclaration) Range

func (v VariableDeclaration) Range() SourceRange

type VariantType

type VariantType struct {
	Token   lexer.Token
	Members []TypeReference
}

func (VariantType) Range

func (v VariantType) Range() SourceRange

Jump to

Keyboard shortcuts

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