Struct DocumentReader
Definition
Namespace: StardewUI.Framework.Grammar
Assembly: StardewUI.dll
Reads elements and associated attributes from a StarML document (content string).
Inheritance
Object ⇦ ValueType ⇦ 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).
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.
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.
Property Value
Attribute
The attribute that was just read, if the previous NextMember() returned Attribute; otherwise, an empty attribute.
Property Value
Eof
Whether the end of the document has been reached.
Property Value
Event
The event that was just read, if the previous NextMember() returned Event; otherwise, an empty event.
Property Value
Position
The current position in the document content.
Property Value
Tag
The tag that was just read, if the previous NextTag() returned true
; otherwise, an empty tag.
Property Value
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.
Returns
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
.
Returns
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.
Returns
true
if an attribute was read; false
if the end of the document was reached.