# -*- coding: utf-8 -*-

import re

_INDENT = r"(?P<indent>^ *)"
_VARIABLE = r"(?P<variable>.+?):"
_VALUE = r"(?P<value>(?:(?P<q2>['\"]).*?(?P=q2))|[^#]+?)"
_NEWLINE = r"$\n"
_BLANK = r" +"
_INLINE_COMMENT = r"(?: +#.*)?"

_COMMENT = r"^ *#.*" + _NEWLINE
_BLANK_LINE = r"^[ \t]*" + _NEWLINE
_DASHES = r"^---" + _NEWLINE

_SECTION = _INDENT + _VARIABLE + _INLINE_COMMENT + _NEWLINE
_SIMPLE = _INDENT + _VARIABLE + _BLANK + _VALUE + _INLINE_COMMENT + _NEWLINE

_LIST_VALUE = (
    _BLANK + r"-" + _BLANK +
    r"('.*?'|\".*?\"|[^#]+?)" +
    _INLINE_COMMENT + _NEWLINE
)
_LIST_ITEM = _BLANK_LINE + r"|" + _COMMENT + r"|" + _LIST_VALUE

_LIST = _SECTION + r"(?P<items>(?:" + _LIST_ITEM + r")*" + _LIST_VALUE + r")"

_NULL = r"\b(null|Null|NULL)\b|~"
_TRUE = r"\b(true|True|TRUE)\b"
_FALSE = r"\b(false|False|FALSE)\b"
_INT = r"[-+]?[0-9]+"
_FLOAT = r"([-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?)"
_STR = r"(?P<quotes>['\"]?).*(?P=quotes)"

# basic rules that the parser matches against
COMMENT = re.compile(_COMMENT, re.MULTILINE)
BLANK_LINE = re.compile(_BLANK_LINE, re.MULTILINE)
DASHES = re.compile(_DASHES, re.MULTILINE)
LIST = re.compile(_LIST, re.MULTILINE)
SIMPLE = re.compile(_SIMPLE, re.MULTILINE)
SECTION = re.compile(_SECTION, re.MULTILINE)

# list rule to retrieve all the individual matches of a list match
LIST_ITEM = re.compile(_LIST_VALUE, re.MULTILINE)

# tag rules to detect types of variable names and value
NULL = re.compile(_NULL)
TRUE = re.compile(_TRUE)
FALSE = re.compile(_FALSE)
FLOAT = re.compile(_FLOAT)
INT = re.compile(_INT)
STR = re.compile(_STR)

@@ -62,21 +62,16 @@
 *)%22%0A_VAR
-IABLE
  = r%22(?P
@@ -87,16 +87,16 @@
 %3E.+?):%22%0A
+
 _VALUE =
@@ -163,16 +163,39 @@
  r%22$%5Cn%22%0A
+_OPT_NEWLINE = r%22$%5Cn?%22%0A
 _BLANK =
@@ -353,29 +353,24 @@
 NDENT + _VAR
-IABLE
  + _INLINE_C
@@ -415,13 +415,8 @@
 _VAR
-IABLE
  + _
@@ -442,32 +442,36 @@
 NLINE_COMMENT + 
+_OPT
 _NEWLINE%0A%0A_LIST_
@@ -541,16 +541,16 @@
 %5D+?)%22 +%0A
-
     _INL
@@ -555,32 +555,36 @@
 NLINE_COMMENT + 
+_OPT
 _NEWLINE%0A)%0A_LIST

Update list value and simple pattern to allow for no newline