3
0
Fork 0
This repository has been archived on 2022-01-17. You can view files and clone it, but cannot push or open issues/pull-requests.
recipes-parser/grammar/spec

41 lines
1.3 KiB
Plaintext

token cr = /\n/;
token eq = /=/;
token tabs = /\t+/;
token hash = /#/;
token at = /[@]/;
token dash = /-/;
token specialcharacters = /[_*+%"'$`|]+/;
token space = / +/;
token point = /[.]/;
token numbers = /[0-9]+/;
token string = /[a-zA-Z]+/;
token colon = /[:]/;
token coma = /,/;
token open_squarebracket = /[[]/;
token closesquarebracket = /[]]/;
token open_curlybracket = /[{]/;
token closecurlybracket = /[}]/;
token open_anglebracket = /[<]/;
token closeanglebracket = /[>]/;
token slash = /\//;
rule S = lines;
rule lines = line cr lines | cr lines | line;
rule line = freetextblock | list | assignment | assignment comment | comment;
rule freetextblock = at multiplealphanum cr freetext;
rule freetext = tabs hashglob cr freetext?;
rule assignment = string colon glob;
rule list = string colon cr listitem;
rule listitem = tabs dash glob cr listitem? | tabs comment cr listitem;
rule multiplealphanum = alphanum multiplealphanum?;
rule comment = hash glob;
rule hashglob = hash hashglob | any hashglob | any | hash;
rule glob = any glob | any;
rule any = alphanum
| space | point | coma | colon | eq | at | slash | dash
| specialcharacters
| open_squarebracket | open_curlybracket | open_anglebracket
| closesquarebracket | closecurlybracket | closeanglebracket;
rule alphanum = string | numbers;