HLDS: change :: to double space and require it

Require double space before tags and price, like in the plain text
accounting format of ledger. This makes it easier to differentiate
between prices mentioned in descriptions and the price for the dish.
This commit is contained in:
Midgard 2021-06-20 22:08:41 +02:00
parent 00cdc587b0
commit 58d270e582
Signed by: midgard
GPG key ID: 511C112F1331BBB4
4 changed files with 14 additions and 15 deletions

View file

@ -29,10 +29,12 @@ location = >location_header items:{ block } ;
attributes = attributes =
name:/[^\n#]*?(?= +-- | +:: | +€ | *\n| *#)/ name:/[^\n#]*?(?= +-- | | *\n| *#)/
[ s '--' ~ s description:/[^\n#]*?(?= +:: | +€ | *\n| *#)/ ] [ s '--' ~ s description:/[^\n#]*?(?= | *\n| *#)/ ]
[ s '::' {s ('{' tags+:identifier '}')} ] [ / {2,}/ ~
[ [ s '::' ~ ] s price:price ] [ {[ s ] ('{' tags+:identifier '}')} / +|$/ ]
[ price:price ]
]
; ;
@ -73,7 +75,7 @@ indent_choice_block =
; ;
s = / +/ ; s = / +/ ;
n = '\n' {{'\t'} '\n'} ; n = '\n' {{'\t'} '\n'} ;
@name @name

View file

@ -1 +1,2 @@
setlocal noexpandtab setlocal noexpandtab
setlocal softtabstop=0

View file

@ -25,8 +25,9 @@ syn keyword hldsChoiceType single_choice multi_choice nextgroup=hldsBlockIdAf
syn match hldsBlockId "^[a-z0-9_-]\+: " syn match hldsBlockId "^[a-z0-9_-]\+: "
syn match hldsBlockIdAftrKywrd "[a-z0-9_-]\+: " contained syn match hldsBlockIdAftrKywrd "[a-z0-9_-]\+: " contained
syn match hldsTag " {[a-z0-9_-]\+}" syn match _doubleSpace " \+" nextgroup=hldsTag,hldsPrice
syn match hldsPrice "€ *[0-9]\+\(\.[0-9]\+\|\)" syn match hldsTag "{[a-z0-9_-]\+}\( \|$\)" contained nextgroup=hldsTag,hldsPrice
syn match hldsPrice "€ *[0-9]\+\(\.[0-9]\+\|\)\( \|$\)" contained
syn match hldsComment "#.*$" contains=hldsTodo,@Spell syn match hldsComment "#.*$" contains=hldsTodo,@Spell
syn keyword hldsTodo FIXME NOTE NOTES TODO XXX contained syn keyword hldsTodo FIXME NOTE NOTES TODO XXX contained

View file

@ -33,13 +33,8 @@
"tags": { "tags": {
"patterns": [ "patterns": [
{ {
"match": "(::)\\s*({[a-zA-Z-_]*}\\s*)*", "match": " +( +{[a-zA-Z-_]*})*",
"name": "markup.italic", "name": "markup.italic"
"captures": {
"1": {
"name": "markup.bold"
}
}
} }
] ]
}, },