diff options
Diffstat (limited to 'spec/syntax.abnf')
| -rw-r--r-- | spec/syntax.abnf | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/spec/syntax.abnf b/spec/syntax.abnf index 6ee024d..a083eda 100644 --- a/spec/syntax.abnf +++ b/spec/syntax.abnf @@ -1,23 +1,39 @@ -Unit = *Blank Datum [ Blank ] +;This file follows strict ABNF rules and can be used with abnfgen. +File = [Unit] *( Blank Unit ) *Blank [Trail] + + +Unit = *Blank Datum + Blank = HTAB / LF / %x0b / %x0c / CR / Comment -Datum = OneDatum *( [JoinChar] OneDatum ) +Trail = SkipLine / SkipUnit + + +Comment = SkipLine LF / SkipUnit Blank + +SkipLine = ';' [ SkipLStart *AnyButLF ] -JoinChar = '.' / ':' +SkipUnit = ';' '~' Unit -Comment = ';' ( SkipUnit / SkipLine [LF] ) +SkipLStart = %x00-09 / %x0b-7d / %x7f-ff + ; any but LF or '~' -SkipUnit = '~' Unit +AnyButLF = %x00-09 / %x0b-ff -SkipLine = *( %x00-09 / %x0b-ff ) ; any but LF +Datum = SingleDatum + / JoinedDatum *( [ '.' / ':' ] JoinedDatum ) -OneDatum = BareString / CladDatum -BareString = 1*BareChar +SingleDatum = BareString / CladDatum / DottedString + +JoinedDatum = BareString / CladDatum + + +BareString = BareChar *( BareChar / Numeric ) CladDatum = '|' *( PipeStrChar / '\' StringEsc ) '|' / '"' *( QuotStrChar / '\' StringEsc ) '"' @@ -25,28 +41,37 @@ CladDatum = '|' *( PipeStrChar / '\' StringEsc ) '|' / '(' List ')' / '[' List ']' / '{' List '}' / "'" Datum / '`' Datum / ',' Datum +DottedString = ( '.' / Numeric ) *( '.' / Numeric / BareChar ) -BareChar = ALPHA / DIGIT - / '!' / '$' / '%' / '*' / '+' / '-' / '.' / '/' - / '<' / '=' / '>' / '?' / '@' / '^' / '_' / '~' +BareChar = '!' / '$' / '%' / '*' / '/' / '<' / '=' / '>' + / '?' / '@' / '^' / '_' / '~' / ALPHA -PipeStrChar = %x00-5b / %x5d-7b / %x7d-ff ; any but | or \ +Numeric = '+' / '-' / DIGIT -QuotStrChar = %x00-21 / %x23-5b / %x5d-ff ; any but " or \ + +PipeStrChar = %x00-5b / %x5d-7b / %x7d-ff + ; any but '|' or '\' + +QuotStrChar = %x00-21 / %x23-5b / %x5d-ff + ; any but '"' or '\' HashExpr = Rune [ '\' BareString / CladDatum ] / '\' BareString / '%' Label ( '%' / '=' Datum ) / CladDatum -List = *Unit [ '&' Unit ] *Blank +List = [Unit] *( Blank Unit ) *Blank [Tail] [SkipUnit] + +Tail = '&' Unit *Blank StringEsc = '\' / '|' / '"' / *( HTAB / SP ) LF *( HTAB / SP ) / 'a' / 'b' / 't' / 'n' / 'v' / 'f' / 'r' / 'e' - / 'x' 1*( 2*HEXDIG ) ';' - / 'u' 1*6( HEXDIG ) ';' + / 'x' 1*( 2HEXDIG ) ';' + / 'u' 1*5HEXDIG ';' + / 'u' '0' 1*5HEXDIG ';' + / 'u' '1' '0' 1*4HEXDIG ';' Rune = ALPHA *5( ALPHA / DIGIT ) |
