Class TomlParser
The parser for TOML translation files.
Assembly: Tlumach.Base.dll
Syntax
public class TomlParser : BaseKeyValueParser
Properties
Declaration
protected override char LineCommentChar { get; }
Property Value
Overrides
TextProcessingMode
Gets or sets the text processing mode to use when decoding potentially escaped strings and when recognizing template strings in translation entries.
Declaration
public static TextFormat TextProcessingMode { get; set; }
Property Value
Methods
AcceptUnquotedEmptyValues()
Declaration
protected override bool AcceptUnquotedEmptyValues()
Returns
Overrides
CanHandleExtension(string)
Checks whether this parser can handle a translation file with the given extension.
This method is not used for configuration files.
Declaration
public override bool CanHandleExtension(string fileExtension)
Parameters
| Type |
Name |
Description |
| string |
fileExtension |
The extension to check.
|
Returns
| Type |
Description |
| bool |
true if the extension is supported and false otherwise.
|
Overrides
GetTextProcessingMode()
Declaration
protected override TextFormat GetTextProcessingMode()
Returns
Overrides
IsEndOfKey(string, int, out int)
Declaration
protected override bool? IsEndOfKey(string content, int offset, out int newPosition)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
| int |
newPosition |
|
Returns
Overrides
IsEndOfValue(string, int, out int)
Detects if the end of a value has been reached.
Declaration
protected override bool? IsEndOfValue(string content, int offset, out int newPosition)
Parameters
| Type |
Name |
Description |
| string |
content |
content to check.
|
| int |
offset |
current position within the content.
|
| int |
newPosition |
upon return is set to a position next to the end-of-value marker (indicates to which value the pointer must be set).
|
Returns
| Type |
Description |
| bool? |
true if the end of the value has been reached, false if the end has not been reached, and null if the end of line was encountered and a single-line value was not closed.
|
Overrides
Exceptions
IsEscapedEOLInValue(string, int)
Declaration
protected override bool IsEscapedEOLInValue(string content, int offset)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
Returns
Overrides
IsSeparatorChar(char)
Declaration
protected override bool IsSeparatorChar(char candidate)
Parameters
| Type |
Name |
Description |
| char |
candidate |
|
Returns
Overrides
IsStartOfKey(string, int)
Declaration
protected override bool IsStartOfKey(string content, int offset)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
Returns
Overrides
IsStartOfValue(string, int, out int)
Declaration
protected override bool IsStartOfValue(string content, int offset, out int posAfterStart)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
| int |
posAfterStart |
|
Returns
Overrides
IsValidKeyChar(string, int)
Declaration
protected override bool IsValidKeyChar(string content, int offset)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
Returns
Overrides
IsValidSectionNameChar(string, int)
Declaration
protected override bool IsValidSectionNameChar(string content, int offset)
Parameters
| Type |
Name |
Description |
| string |
content |
|
| int |
offset |
|
Returns
Overrides
UnwrapKey(string)
Strips format-specific markers that denote the beginning and the end of a value.
Declaration
protected override string UnwrapKey(string value)
Parameters
| Type |
Name |
Description |
| string |
value |
The value to strip.
|
Returns
| Type |
Description |
| string |
The text inside the markers.
|
Overrides
UnwrapValue(string)
Strips format-specific markers that denote the beginning and the end of a value.
Declaration
protected override (string? escaped, string unescaped) UnwrapValue(string value)
Parameters
| Type |
Name |
Description |
| string |
value |
The value to strip.
|
Returns
Overrides
Use()
Initializes the parser class, making it available for use.
Declaration