IniDialect

Feature set to be understood by the parser.

enum myDialect = (IniDialect.defaults | IniDialect.inlineComments);

Values

ValueMeaning
lite0

Minimum feature set.

No comments, no extras, no nothing. Only sections, keys and values. Everything fits into these categories from a certain point of view.

lineComments0b_0000_0000_0000_0001

Parse line comments (starting with ;).

; This is a line comment.
;This one too.

key = value ;But this isn't one.
inlineComments0b_0000_0000_0000_0011

Parse inline comments (starting with ;).

key1 = value2 ; Inline comment.
key2 = value2 ;Inline comment.
key3 = value3; Inline comment.
;Not a true inline comment (but technically equivalent).
hashLineComments0b_0000_0000_0000_0100

Parse line comments starting with #.

# This is a comment.
#Too.
key = value # Not a line comment.
hashInlineComments0b_0000_0000_0000_1100

Parse inline comments starting with #.

key1 = value2 # Inline comment.
key2 = value2 #Inline comment.
key3 = value3# Inline comment.
#Not a true inline comment (but technically equivalent).
quotedStrings0b_0000_0000_0001_0000

Parse quoted strings.

key1 = non-quoted value
key2 = "quoted value"

"quoted key" = value
non-quoted key = value

"another key" = "another value"

multi line = "line 1
line 2"
singleQuoteQuotedStrings0b_0000_0000_0010_0000

Parse quoted strings using single-quotes.

key1 = non-quoted value
key2 = 'quoted value'

'quoted key' = value
non-quoted key = value

'another key' = 'another value'

multi line = 'line 1
line 2'
colonKeys0b_0000_0000_0100_0000

Parse key/value pairs separated with a colon (:).

key: value
key= value
concatSubstrings0b_0000_0001_0000_0000

Concats substrings and emits them as a single token.

  • For a mutable char[] input, this will rewrite the data in the input array.
  • For a non-mutable immutable(char)[] (=string) or const(char)[] input, this will allocate a new array with the GC.
key = "Value1" "Value2"
; → Value1Value2
escapeSequences0b_0000_0010_0000_0000

Evaluates escape sequences in the input string.

  • For a mutable char[] input, this will rewrite the data in the input array.
  • For a non-mutable immutable(char)[] (=string) or const(char)[] input, this will allocate a new array with the GC.
Special escape sequences
\\Backslash
\0Null character
\nLine feed
\rCarriage return
\tTabulator
key1 = Line 1\nLine 2
; → Line 1
;   Line 2

key2 = One \\ and one \;
; → One \ and one ;
lineFolding0b_0000_0100_0000_0000

Folds lines on escaped linebreaks.

  • For a mutable char[] input, this will rewrite the data in the input array.
  • For a non-mutable immutable(char)[] (=string) or const(char)[] input, this will allocate a new array with the GC.
key1 = word1\
word2
; → word1word2

key2 = foo \
bar
; → foo bar
presetPhp(lineComments | inlineComments | hashLineComments | hashInlineComments | quotedStrings | singleQuoteQuotedStrings | concatSubstrings)

Imitates the behavior of the INI parser implementation found in PHP.

This preset may be adjusted without further notice in the future in cases where it increases alignment with PHP’s implementation.
presetDefaults(lineComments | quotedStrings | singleQuoteQuotedStrings)
defaultspresetDefaults

Meta