entries with values with comments

This commit is contained in:
Trilarion
2020-09-07 15:48:14 +02:00
parent 6b2edf8f56
commit 8a08425e09
17 changed files with 155 additions and 143 deletions

View File

@ -1,13 +1,14 @@
start: _COMMENT _HEADER entry*
entry: "##" name "[" _NUMBER "]" _NL property+
property: "-" _key ":" _values _NL
_key : /(?! ).+?(?=:)(?<! )/ // key: everything until next ":", not beginning or ending with a space
_key : /(?! ).+?(?= *:)/ // key: everything until next ":", not beginning or ending with a space
_values : [_value ("," _value)*]
_value : quoted_value | unquoted_value
quoted_value : /\".+?\"/ // with quotation marks, can contain commas
unquoted_value : /(?![ \"])[^,\n]+(?<![ \"])/ // cannot contain commas, cannot start or end with quotation mark
quoted_value : /\".*?\"/ // with quotation marks, can contain commas
unquoted_value : /(?![ \"]).+?(?= *,| *\n)/
name: /(?! ).+?(?= \[)/ // developer name: everything until " ["
name: /(?! ).+?(?= +\[)/ // developer name: everything until " ["
_NUMBER: /[0-9]+/
@ -15,9 +16,9 @@ CR : /\r/
LF : /\n/
_NL : CR? LF
WS : (" "|/\t/)+
_EL : /^$\n/m
_EL : /^$\n/m // empty new line
_COMMENT : /^\[comment\]: #.*$\n/m // [comment]: # xxx
_HEADER : /^# .+$\n/m
_HEADER : /^# .+$\n/m // line staring with "# "
%ignore WS
%ignore _EL