IniParseOptions Class
Configures how IniSyntaxTree parses text.
public sealed class IniParseOptions : IEquatable<IniParseOptions>Remarks
INI has no specification, so these options select between the behaviors of the common dialects.
- Implements
Constructors
| Name | Description |
|---|---|
| IniParseOptions() |
IniParseOptions()
IniParseOptions.cspublic IniParseOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| AllowEscapes | Gets a value indicating whether a backslash escapes the character after it in a value, quoted or not: \\, \', \", \;, \#, \=, \:, \0, \a, \b, \t, \r, and \n. |
| AllowKeysWithoutValue | Gets a value indicating whether a line holding only a key, such as skip-networking in a MySQL option file, is a property. When it is not allowed, the line is still read as a property, and INI0004 is reported. |
| AllowMultilineValues | Gets a value indicating whether a value continues on the lines that follow it when they are indented more than its key, as Python's configparser reads them. |
| AllowQuotedValues | Gets a value indicating whether a value wholly in double or single quotes, such as "a;b", is read without them, so that ; and # inside them never start a comment. Defaults to true. |
| Default | Gets the options used when none are given. |
| Dialect | Gets the family of syntax the document is read with. Defaults to IniDialect.Generic. |
| Git | Gets the options that read git configuration files, such as .gitconfig or .git/config. |
| InlineComments | Gets where ; and # start a comment other than at the beginning of a line. |
| NameComparer | Gets how section names and keys are compared to find duplicates. Defaults to StringComparer.OrdinalIgnoreCase, or, with IniDialect.Git, to a comparer that ignores the case of section names and keys but not of subsections, as git does: Remote.origin is remote.origin, not remote.Origin. |
| ReportDuplicates | Gets a value indicating whether a section name used twice (INI0006) and a key used twice in the same section (INI0007) are reported as warnings. Names are compared with IniParseOptions.NameComparer. |
AllowEscapes
IniParseOptions.csGets a value indicating whether a backslash escapes the character after it in a value, quoted or not: \\, \', \", \;, \#, \=, \:, \0, \a, \b, \t, \r, and \n.
public bool AllowEscapes { get; init; }Property value
Remarks
An escaped ; or # never starts a comment, and an escaped quote never closes a quoted value. A backslash in front of any other character, or at the end of the line, is an ordinary character. Keys and section names are not escaped. An edit writes a value with line breaks as \r and \n on one line, so that it reads back exactly as it was, even when IniParseOptions.AllowMultilineValues is set.
AllowKeysWithoutValue
IniParseOptions.csAllowMultilineValues
IniParseOptions.csGets a value indicating whether a value continues on the lines that follow it when they are indented more than its key, as Python's configparser reads them.
public bool AllowMultilineValues { get; init; }Property value
Remarks
As in configparser, a comment line between the lines of a value is skipped, and a blank line between them is an empty line of the value. Each line is read like a one-line value, so its quotes and its comment are not part of it.
AllowQuotedValues
IniParseOptions.csGets a value indicating whether a value wholly in double or single quotes, such as "a;b", is read without them, so that ; and # inside them never start a comment. Defaults to true.
public bool AllowQuotedValues { get; init; }Property value
Remarks
Set it to false for dialects where quotes are ordinary characters, such as Python's configparser: the value of key="a" is then "a", quotes included, and an edit never adds quotes to a value.
Default
IniParseOptions.csGets the options used when none are given.
public static IniParseOptions Default { get; }Property value
Dialect
IniParseOptions.csGets the family of syntax the document is read with. Defaults to IniDialect.Generic.
public IniDialect Dialect { get; init; }Property value
Exceptions
ArgumentOutOfRangeException- The value is not one of
IniDialect.
Remarks
IniDialect.Git reads comments, quotes, escapes, and keys without a value as git does, whatever IniParseOptions.InlineComments, IniParseOptions.AllowQuotedValues, IniParseOptions.AllowEscapes, IniParseOptions.AllowMultilineValues, and IniParseOptions.AllowKeysWithoutValue say.
Gets the options that read git configuration files, such as .gitconfig or .git/config.
public static IniParseOptions Git { get; }InlineComments
IniParseOptions.csGets where ; and # start a comment other than at the beginning of a line.
public IniInlineCommentMode InlineComments { get; init; }Property value
Exceptions
ArgumentOutOfRangeException- The value is not one of
IniInlineCommentMode.
Remarks
A value in quotes, such as "a;b", never contains a comment, whatever this says.
NameComparer
IniParseOptions.csGets how section names and keys are compared to find duplicates. Defaults to StringComparer.OrdinalIgnoreCase, or, with IniDialect.Git, to a comparer that ignores the case of section names and keys but not of subsections, as git does: Remote.origin is remote.origin, not remote.Origin.
public StringComparer NameComparer { get; init; }ReportDuplicates
IniParseOptions.csGets a value indicating whether a section name used twice (INI0006) and a key used twice in the same section (INI0007) are reported as warnings. Names are compared with IniParseOptions.NameComparer.
public bool ReportDuplicates { get; init; }Property value
Methods
| Name | Description |
|---|---|
| Equals(IniParseOptions?) | |
| Equals(object?) | |
| GetHashCode() | |
| ToString() |
Equals overloads
Equals(IniParseOptions?)
public bool Equals(IniParseOptions? other)No documentation is available.
Equals(object?)
GetHashCode()
ToString()
Operators
| Name | Description |
|---|---|
| operator ==(IniParseOptions?, IniParseOptions?) | |
| operator !=(IniParseOptions?, IniParseOptions?) |
operator ==(IniParseOptions?, IniParseOptions?)
public static bool operator ==(IniParseOptions? left, IniParseOptions? right)No documentation is available.
operator !=(IniParseOptions?, IniParseOptions?)
public static bool operator !=(IniParseOptions? left, IniParseOptions? right)No documentation is available.