parser

package
v0.0.0-...-91d3685 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(input io.Reader, output Sender, config Config) error

Types

type Config

type Config struct {
	IncludeComments bool
	OnlyMetadata    bool
	SendTokens      bool
	NoObjects       bool
	DisableWarnings bool
}

type DiagnosticType

type DiagnosticType int32
const (
	DiagnosticInfo DiagnosticType = iota
	DiagnosticWarning
	DiagnosticError
)

type Object

type Object struct {
	Comment    string
	Type       TokenType
	Name       Token
	Properties []Property
}

func (Object) String

func (o Object) String() string

type ObjectType

type ObjectType string

type ParserError

type ParserError struct {
	Token   Token
	Message string
	// contains filtered or unexported fields
}

func (ParserError) Error

func (p ParserError) Error() string

type Property

type Property struct {
	Comment string
	Name    string
	Type    *PropertyType
}

func (Property) String

func (p Property) String() string

type PropertyType

type PropertyType struct {
	Token   Token
	Generic *PropertyType
}

type Sender

type Sender interface {
	SendMetadata(version string) error
	SendDiagnostic(diagnosticType DiagnosticType, message string, startLine, startColumn, endLine, endColumn int) error
	SendToken(tokenType TokenType, lexeme string, line, column int) error
	SendObject(object Object) error
}

type Token

type Token struct {
	Type   TokenType
	Lexeme string
	Line   int
	Column int
}

type TokenType

type TokenType int
const (
	TTGameName TokenType = iota
	TTCGEVersion

	TTConfig
	TTCommand
	TTEvent
	TTType
	TTEnum

	TTString
	TTBool
	TTInt32
	TTInt64
	TTFloat32
	TTFloat64

	TTMap
	TTList

	TTIdentifier
	TTVersionNumber

	TTOpenCurly
	TTCloseCurly
	TTColon
	TTComma
	TTGreater
	TTLess

	TTComment

	TTError
	TTEOF
)

Jump to

Keyboard shortcuts

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