TomlParseEvent Struct
Represents a semantic parse event produced by TomlParser.
public readonly struct TomlParseEventProperties
| Name | Description |
|---|---|
| Column | Gets the 1-based column number associated with this event, or 0 when unknown. |
| Data | Gets the raw scalar payload for numeric and boolean scalars. When TomlParseEvent.Kind is TomlParseEventKind.String, this contains the underlying TokenKind for the string literal. When TomlParseEvent.Kind is TomlParseEventKind.PropertyName, this contains an internal packed payload that includes the TokenKind of the key literal (in the low 8 bits) as well as a case-sensitive hash of the decoded property name (in the remaining high bits). When TomlParseEvent.Kind is TomlParseEventKind.StartTable or TomlParseEventKind.StartArray, this is 1 for an inline table or array, and 0 for a table or an array of tables opened by a header or a dotted key. |
| Kind | Gets the event kind. |
| Line | Gets the 1-based line number associated with this event, or 0 when unknown. |
| PropertyName | Gets the property name when TomlParseEvent.Kind is TomlParseEventKind.PropertyName. This value is only populated when the parser was configured to decode scalars eagerly; otherwise use TomlParser.GetPropertyName to decode it from the original input. |
| Span | Gets the source span associated with this event, when available. |
| StringValue | Gets the string scalar value when TomlParseEvent.Kind is TomlParseEventKind.String or TomlParseEventKind.DateTime. For TomlParseEventKind.String, this value is only populated when the parser was configured to decode scalars eagerly; otherwise use TomlParser.GetString. When TomlParserOptions.EagerStringValues is enabled, this value may also be populated for simple basic strings (single-line, no escape sequences) even when TomlParserOptions.DecodeScalars is false. For TomlParseEventKind.DateTime, this value contains the raw literal text so that consumers can parse it without requiring TomlParserOptions.DecodeScalars. |
Column
TomlParseEvent.csGets the raw scalar payload for numeric and boolean scalars. When TomlParseEvent.Kind is TomlParseEventKind.String, this contains the underlying TokenKind for the string literal. When TomlParseEvent.Kind is TomlParseEventKind.PropertyName, this contains an internal packed payload that includes the TokenKind of the key literal (in the low 8 bits) as well as a case-sensitive hash of the decoded property name (in the remaining high bits). When TomlParseEvent.Kind is TomlParseEventKind.StartTable or TomlParseEventKind.StartArray, this is 1 for an inline table or array, and 0 for a table or an array of tables opened by a header or a dotted key.
public ulong Data { get; }Property value
PropertyName
TomlParseEvent.csGets the property name when TomlParseEvent.Kind is TomlParseEventKind.PropertyName. This value is only populated when the parser was configured to decode scalars eagerly; otherwise use TomlParser.GetPropertyName to decode it from the original input.
public string? PropertyName { get; }Property value
Gets the source span associated with this event, when available.
public TomlSourceSpan? Span { get; }Property value
StringValue
TomlParseEvent.csGets the string scalar value when TomlParseEvent.Kind is TomlParseEventKind.String or TomlParseEventKind.DateTime. For TomlParseEventKind.String, this value is only populated when the parser was configured to decode scalars eagerly; otherwise use TomlParser.GetString. When TomlParserOptions.EagerStringValues is enabled, this value may also be populated for simple basic strings (single-line, no escape sequences) even when TomlParserOptions.DecodeScalars is false. For TomlParseEventKind.DateTime, this value contains the raw literal text so that consumers can parse it without requiring TomlParserOptions.DecodeScalars.
public string? StringValue { get; }Property value
Methods
| Name | Description |
|---|---|
| GetBoolean() | Gets the current scalar value as a boolean. |
| GetDouble() | Gets the current scalar value as a double-precision number. |
| GetInt64() | Gets the current scalar value as a 64-bit integer. |
| GetString() | Gets the current scalar value as a string. |
| GetTomlDateTime() | Gets the current scalar value as a TomlDateTime. |
GetBoolean()
TomlParseEvent.csGets the current scalar value as a boolean.
public bool GetBoolean()GetDouble()
TomlParseEvent.csGets the current scalar value as a double-precision number.
public double GetDouble()GetInt64()
TomlParseEvent.csGets the current scalar value as a 64-bit integer.
public long GetInt64()GetString()
TomlParseEvent.csGets the current scalar value as a string.
public string GetString()GetTomlDateTime()
TomlParseEvent.csGets the current scalar value as a TomlDateTime.
public TomlDateTime GetTomlDateTime()