Documentation ¶
Overview ¶
Package parser implements a participle parser for the TSCN file format
Index ¶
Constants ¶
View Source
const ( ResourceTypeExtResource = "ext_resource" ResourceTypeSubResource = "sub_resource" ResourceTypeEditable = "editable" ResourceTypeConnection = "connection" ResourceTypeNode = "node" ResourceTypeResource = "resource" )
Supported resource types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GdField ¶
type GdField struct { Key string `parser:"@Ident '='"` Value *GdValue `parser:" @@"` Pos lexer.Position }
GdField represents a field with a value
type GdMapField ¶
type GdMapField struct { Key string `parser:"@String ':'"` Value *GdValue `parser:" @@"` Pos lexer.Position }
GdMapField represents a field with a value within a map
func (*GdMapField) ToString ¶
func (kv *GdMapField) ToString() string
ToString returns a string representation of a GdMapField
type GdResource ¶
type GdResource struct { ResourceType string `parser:"'[' @Ident "` Attributes []*GdField `parser:"@@* ']'"` Fields []*GdField `parser:"@@*"` Pos lexer.Position }
GdResource represents a resource within a TSCN file
func (*GdResource) GetAttribute ¶
func (res *GdResource) GetAttribute(name string) (*GdValue, error)
GetAttribute finds an attribute by name, returns error if not found
type GdType ¶
type GdType struct { Key string `parser:" @Ident ('('"` Parameters []*GdValue `parser:"(@@ ( ',' @@ )* )? ')')?"` Pos lexer.Position }
GdType represents a type with values
type GdValue ¶
type GdValue struct { IsEmptyMap *bool `parser:" (@'{' '}')"` Map []*GdMapField `parser:"| '{' ( @@ ( ',' @@ )* )? '}'"` KeyValuePair *GdMapField `parser:"| @@"` IsEmptyArray *bool `parser:"| (@'[' ']')"` Array []*GdValue `parser:"| '[' ( @@ ( ',' @@ )* )? (',')? ']'"` String *string `parser:"| @String"` Integer *int64 `parser:"| @Int"` Float *float64 `parser:"| @Float"` Bool *bool `parser:"| (@'true' | 'false')"` Null *bool `parser:"| (@'null')"` Type *GdType `parser:"| @@"` Pos lexer.Position }
GdValue represents a value
type TscnFile ¶
type TscnFile struct { Key string `parser:"('[' @Ident"` Attributes []*GdField `parser:"@@* ']')?"` Fields []*GdField `parser:"@@*"` Sections []*GdResource `parser:"@@*"` Pos lexer.Position }
TscnFile represents a .tscn file
Click to show internal directories.
Click to hide internal directories.