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 a1a68a3fd6
commit d0699b3716
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 =
name:/[^\n#]*?(?= +-- | +:: | +€ | *\n| *#)/
[ s '--' ~ s description:/[^\n#]*?(?= +:: | +€ | *\n| *#)/ ]
[ s '::' {s ('{' tags+:identifier '}')} ]
[ [ s '::' ~ ] s price:price ]
name:/[^\n#]*?(?= +-- | | *\n| *#)/
[ s '--' ~ s description:/[^\n#]*?(?= | *\n| *#)/ ]
[ / {2,}/ ~
[ {[ s ] ('{' tags+:identifier '}')} / +|$/ ]
[ price:price ]
]
;
@ -73,7 +75,7 @@ indent_choice_block =
;
s = / +/ ;
s = / +/ ;
n = '\n' {{'\t'} '\n'} ;
@name

View file

@ -1 +1,2 @@
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 hldsBlockIdAftrKywrd "[a-z0-9_-]\+: " contained
syn match hldsTag " {[a-z0-9_-]\+}"
syn match hldsPrice "€ *[0-9]\+\(\.[0-9]\+\|\)"
syn match _doubleSpace " \+" nextgroup=hldsTag,hldsPrice
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 keyword hldsTodo FIXME NOTE NOTES TODO XXX contained

View file

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