Skip to content

Struct DocumentReader

Definition

Namespace: StardewUI.Framework.Grammar
Assembly: StardewUI.dll

Reads elements and associated attributes from a StarML document (content string).

[System.Obsolete]
public ref struct DocumentReader

Inheritance
ObjectValueType ⇦ DocumentReader

Members

Constructors

Name Description
DocumentReader(Lexer) Reads elements and associated attributes from a StarML document (content string).
DocumentReader(ReadOnlySpan<Char>) Initializes a new DocumentReader from the specified text, creating an implicit lexer.

Properties

Name Description
Argument The argument that was just read, if the previous NextArgument() returned true; otherwise, an empty argument.
Attribute The attribute that was just read, if the previous NextMember() returned Attribute; otherwise, an empty attribute.
Eof Whether the end of the document has been reached.
Event The event that was just read, if the previous NextMember() returned Event; otherwise, an empty event.
Position The current position in the document content.
Tag The tag that was just read, if the previous NextTag() returned true; otherwise, an empty tag.

Methods

Name Description
Equals(Object) (Inherited from ValueType)
GetHashCode() (Inherited from ValueType)
NextArgument() Reads the next Argument, if the current scope is within an argument list.
NextMember() Reads the next Attribute. Only valid in a tag scope, i.e. after a call to NextTag() returns true.
NextTag() Reads the next Tag, discarding any remaining attributes for the current tag.
ToString() (Inherited from ValueType)

Details

Constructors

DocumentReader(Lexer)

Reads elements and associated attributes from a StarML document (content string).

public DocumentReader(StardewUI.Framework.Grammar.Lexer lexer);
Parameters

lexer   Lexer
The lexer that reads syntax tokens from the document.


DocumentReader(ReadOnlySpan<Char>)

Initializes a new DocumentReader from the specified text, creating an implicit lexer.

public DocumentReader(ReadOnlySpan<System.Char> text);
Parameters

text   ReadOnlySpan<Char>
The markup text.


Properties

Argument

The argument that was just read, if the previous NextArgument() returned true; otherwise, an empty argument.

public StardewUI.Framework.Grammar.Argument Argument { get; private set; }
Property Value

Argument


Attribute

The attribute that was just read, if the previous NextMember() returned Attribute; otherwise, an empty attribute.

public StardewUI.Framework.Grammar.Attribute Attribute { get; private set; }
Property Value

Attribute


Eof

Whether the end of the document has been reached.

public bool Eof { get; }
Property Value

Boolean


Event

The event that was just read, if the previous NextMember() returned Event; otherwise, an empty event.

public StardewUI.Framework.Grammar.Event Event { get; private set; }
Property Value

Event


Position

The current position in the document content.

public int Position { get; }
Property Value

Int32


Tag

The tag that was just read, if the previous NextTag() returned true; otherwise, an empty tag.

public StardewUI.Framework.Grammar.TagInfo Tag { get; private set; }
Property Value

TagInfo

Remarks

The tag remains valid as attributes are read; i.e. ReadNextAttribute(AttributeType, ReadOnlySpan<Char>, Boolean) will never change this value.


Methods

NextArgument()

Reads the next Argument, if the current scope is within an argument list.

public bool NextArgument();
Returns

Boolean

true if an argument was read; false if there are no more arguments in the list or if the current position was not within an argument list.


NextMember()

Reads the next Attribute. Only valid in a tag scope, i.e. after a call to NextTag() returns true.

public StardewUI.Framework.Grammar.TagMember NextMember();
Returns

TagMember

true if an attribute was read; false if there are no more attributes to read for the current element.


NextTag()

Reads the next Tag, discarding any remaining attributes for the current tag.

public bool NextTag();
Returns

Boolean

true if an attribute was read; false if the end of the document was reached.