preserves/_includes/cheatsheet-text.md

46 lines
3.1 KiB
Markdown
Raw Normal View History

2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:31:10 +00:00
| *Document* | := | *Value* **ws** |
| *Value* | := | **ws** (*Record* | *Collection* | *Atom* | *Embedded* | *Annotated*) |
| *Collection* | := | *Sequence* | *Dictionary* | *Set* |
2023-10-16 22:49:56 +00:00
| *Atom* | := | *Boolean* | *ByteString* | *String* | *QuotedSymbol* | *Symbol* | *Number* |
2023-10-16 22:31:10 +00:00
| **ws** | := | (**space** &#124; **tab** &#124; **cr** &#124; **lf** &#124;`,`)<sup></sup> |
2023-10-29 21:11:43 +00:00
| **delimiter** | := | **ws** &#124; `<` &#124; `>` &#124; `[` &#124; `]` &#124; `{` &#124; `}` &#124; `#` &#124; `:` &#124; `"` &#124; `|` &#124; `@` &#124; `;` |
2023-10-16 22:31:10 +00:00
2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:31:10 +00:00
| *Record* | := | `<`*Value*<sup>+</sup> **ws**`>` |
| *Sequence* | := | `[`*Value*<sup></sup> **ws**`]` |
| *Dictionary* | := | `{` (*Value* **ws**`:`*Value*)<sup></sup> **ws**`}` |
| *Set* | := | `#{`*Value*<sup></sup> **ws**`}` |
2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:31:10 +00:00
| *Boolean* | := | `#t`&#124;`#f` |
2023-10-17 00:24:14 +00:00
| *ByteString* | := | `#"`*binchar*<sup></sup> `"`&#124;`#x"` (**ws** *hex* *hex*)<sup></sup> **ws**`"`&#124;`#[` (**ws** *base64char*)<sup></sup> **ws**`]` |
2023-10-16 22:49:56 +00:00
| *String* | := | `"` (« any unicode scalar value except `\` or `"` » &#124; *escaped* &#124;`\"`)<sup>⋆</sup> `"` |
| *QuotedSymbol* | := | `|` (« any unicode scalar value except `\` or `|` » &#124; *escaped* &#124;`\|`)<sup>⋆</sup> `|` |
2023-10-16 22:31:10 +00:00
| *Symbol* | := | (`A`..`Z`&#124;`a`..`z`&#124;`0`..`9`&#124; *sympunct* &#124; *symuchar*)<sup>+</sup> |
| *Number* | := | *Float* &#124; *Double* &#124; *SignedInteger* |
| *Float* | := | *flt* (`f`&#124;`F`) &#124;`#xf"` (**ws** *hex* *hex*)<sup>4</sup> **ws**`"` |
| *Double* | := | *flt* &#124;`#xd"` (**ws** *hex* *hex*)<sup>8</sup> **ws**`"` |
| *SignedInteger* | := | *int* |
2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:31:10 +00:00
| *Embedded* | := | `#!`*Value* |
| *Annotated* | := | *Annotation* *Value* |
2023-10-31 21:17:24 +00:00
| *Annotation* | := | `@`*Value* &#124;`#` ((**space** &#124; **tab**) *linecomment*) (**cr** &#124; **lf**) |
| *linecomment* | := | « any unicode scalar value except **cr** or **lf** »<sup></sup> |
2023-10-16 22:31:10 +00:00
2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:49:56 +00:00
| *escaped* | := | `\\`&#124;`\/`&#124;`\b`&#124;`\f`&#124;`\n`&#124;`\r`&#124;`\t`&#124;`\u`*hex* *hex* *hex* *hex* |
2023-10-17 00:18:52 +00:00
| *binescaped* | := | `\\`&#124;`\/`&#124;`\b`&#124;`\f`&#124;`\n`&#124;`\r`&#124;`\t`&#124;`\x`*hex* *hex* |
2023-10-17 00:21:15 +00:00
| *binchar* | := | « any unicode scalar value ≥32 and ≤126, except `\` or `"` » &#124; *binescaped* &#124;`\"` |
2023-10-16 22:31:10 +00:00
| *base64char* | := | `A`..`Z`&#124;`a`..`z`&#124;`0`..`9`&#124;`+`&#124;`/`&#124;`-`&#124;`_`&#124;`=` |
| *sympunct* | := | `~`&#124;`!`&#124;`$`&#124;`%`&#124;`^`&#124;`&`&#124;`*`&#124;`?`&#124;`_`&#124;`=`&#124;`+`&#124;`-`&#124;`/`&#124;`.` |
2023-10-16 23:00:54 +00:00
| *symuchar* | := | « any scalar value ≥128 whose Unicode category is Lu, Ll, Lt, Lm, Lo, Mn, Mc, Me, Nd, Nl, No, Pc, Pd, Po, Sc, Sm, Sk, So, or Co » |
2023-10-16 22:31:10 +00:00
2023-10-17 00:01:23 +00:00
{:.postcard-grammar.textsyntax}
2023-10-16 22:31:10 +00:00
| *flt* | := | *int* ( *frac* *exp* &#124; *frac* &#124; *exp* ) |
| *int* | := | (`-`&#124;`+`) (`0`..`9`)<sup>+</sup> |
| *frac* | := | `.` (`0`..`9`)<sup>+</sup> |
| *exp* | := | (`e`&#124;`E`) (`-`&#124;`+`) (`0`..`9`)<sup>+</sup> |
| *hex* | := | `A`..`F`&#124;`a`..`f`&#124;`0`..`9` |