Expand description
Cooklang parser
Grammar:
recipe = Newline* (line line_end)* line? Eof
line = metadata | section | step
line_end = soft_break | Newline+
soft_break = Newline !Newline
metadata = MetadataStart meta_key Colon meta_val
meta_key = (!(Colon | Newline) ANY)*
meta_value = (!Newline ANY)*
section = Eq+ (section_name Eq*)
sect_name = (!Eq ANY)*
step = TextStep? (component | ANY)*
component = c_kind modifiers? c_body note?
c_kind = At | Hash | Tilde
c_body = c_close | c_long | Word
c_long = c_l_name c_alias? c_close
c_l_name = (!(Newline | OpenBrace | Or) ANY)*
c_alias = Or c_l_name
c_close = OpenBrace Whitespace? Quantity? Whitespace? CloseBrace
modifiers = modifier+
modifier = (At (OpenParen Eq? Tilde? Int CloseParen)?) | And | Plus | Minus | Question
note = OpenParen (!CloseParen ANY)* CloseParen
quantity = num_val Whitespace !(unit_sep | auto_scale | val_sep) unit
| val (val_sep val)* auto_scale? (unit_sep unit)?
unit = (!CloseBrace ANY)*
val_sep = Whitespace Or Whitespace
auto_scale = Whitespace Star Whitespace
unit_sep = Whitespace Percent Whitespace
val = num_val | text_val
text_val = (Word | Whitespace)*
num_val = mixed_num | frac | range | num
mixed_num = Int Whitespace frac
frac = Int Whitespace Slash Whitespace Int
range = num Whitespace Minus Whitespace Num
num = Float | Int
ANY = { Any token }
This is more of a guideline, there may be edge cases that this grammar does not cover but the pareser does.
Structs
- Cooklang pull parser
Enums
- Events generated by
PullParser - Errors generated by the
PullParser - Warnings generated by the
PullParser