rbxlx

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// DiscardInvalidProperties determines how invalid properties are decoded.
	// If true, when the parser successfully decodes a property, but fails to
	// decode its value or a component, then the entire property is discarded.
	// If false, then as much information as possible is retained; any value or
	// component that fails will be emitted as the zero value for the type.
	DiscardInvalidProperties bool
}

Decoder decodes a stream of bytes into a rbxfile.Root according to the rbxlx format.

func (Decoder) Decode

func (d Decoder) Decode(r io.Reader) (root *rbxfile.Root, warn, err error)

Decode reads data from r and decodes it into root.

type Encoder

type Encoder struct {
	// ExcludeReferent determines whether the "referent" attribute should be
	// excluded from Item tags when encoding.
	ExcludeReferent bool

	// ExcludeExternal determines whether standard <External> tags should be
	// excluded from the root tag when encoding.
	ExcludeExternal bool

	// ExcludeMetadata determines whether <Meta> tags should be excluded while
	// encoding.
	ExcludeMetadata bool

	// Prefix is a string that appears at the start of each line in the
	// document. The prefix is added after each newline. Newlines are added
	// automatically when either Prefix or Indent is not empty.
	Prefix string

	// Indent is a string that indicates one level of indentation. A sequence of
	// indents will appear after the Prefix, an amount equal to the current
	// nesting depth in the markup.
	Indent string

	// NoDefaultIndent sets how Indent is interpreted when Indent is an empty
	// string. If false, an empty Indent will be interpreted as "\t".
	NoDefaultIndent bool

	// Suffix is a string that appears at the very end of the document. This
	// string is appended to the end of the file, after the root tag.
	Suffix string

	// ExcludeRoot determines whether the root tag should be excluded when
	// encoding. This can be combined with Prefix to write documents in-line.
	ExcludeRoot bool
}

Encoder encodes a rbxfile.Root into a stream of bytes according to the rbxlx format.

func (Encoder) Encode

func (e Encoder) Encode(w io.Writer, root *rbxfile.Root) (warn, err error)

Encode formats root, writing the result to w.

Jump to

Keyboard shortcuts

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