From d6385552391412beb7f825eb3aa91314c1b0809c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 1 Nov 2023 15:30:23 +0100 Subject: [PATCH] Cosmetic rearrangement of cheatsheets --- _includes/cheatsheet-pexprs-plaintext.md | 2 +- _includes/cheatsheet-pexprs.md | 2 +- _includes/cheatsheet-text-plaintext.md | 23 +++++++++--------- _includes/cheatsheet-text.md | 24 ++++++++++--------- .../doc/cheatsheet-text-plaintext.md | 23 +++++++++--------- preserves.css | 2 +- 6 files changed, 40 insertions(+), 36 deletions(-) diff --git a/_includes/cheatsheet-pexprs-plaintext.md b/_includes/cheatsheet-pexprs-plaintext.md index e51b1da..087efd9 100644 --- a/_includes/cheatsheet-pexprs-plaintext.md +++ b/_includes/cheatsheet-pexprs-plaintext.md @@ -3,7 +3,7 @@ The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves ```text Document := Expr* ws Expr := ws (SimpleExpr | Punct) -SimpleExpr := Atom | Compound | Embedded | Annotated +SimpleExpr := Compound | Embedded | Annotated | Atom Compound := Sequence | Record | Block | Group | Set Punct := `,` | `;` | `:`+ diff --git a/_includes/cheatsheet-pexprs.md b/_includes/cheatsheet-pexprs.md index f1e2763..bc433d1 100644 --- a/_includes/cheatsheet-pexprs.md +++ b/_includes/cheatsheet-pexprs.md @@ -3,7 +3,7 @@ The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves {:.postcard-grammar.textsyntax} | *Document* | := | *Expr* **ws** | *Expr* | := | **ws** (*SimpleExpr* | *Punct*) -| *SimpleExpr* | := | *Atom* | *Compound* | *Embedded* | *Annotated* +| *SimpleExpr* | := | *Compound* | *Embedded* | *Annotated* | *Atom* | *Compound* | := | *Sequence* | *Record* | *Block* | *Group* | *Set* | *Punct* | := | `,` | `;` | `:`+ diff --git a/_includes/cheatsheet-text-plaintext.md b/_includes/cheatsheet-text-plaintext.md index d812b69..2b5a504 100644 --- a/_includes/cheatsheet-text-plaintext.md +++ b/_includes/cheatsheet-text-plaintext.md @@ -1,18 +1,19 @@ ```text Document := Value ws -Value := ws (Record | Collection | Atom | Embedded | Annotated) +Value := ws (Record | Collection | Embedded | Annotated | Atom) Collection := Sequence | Dictionary | Set -Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number -ws := (space | tab | cr | lf)* -commas := (ws `,`)* ws -delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` - | `#` | `:` | `"` | `|` | `@` | `;` | `,` Record := `<` Value+ ws `>` Sequence := `[` (commas Value)* commas `]` Set := `#{` (commas Value)* commas `}` Dictionary := `{` (commas Value ws `:` Value)* commas `}` +commas := (ws `,`)* ws +Embedded := `#!` Value +Annotated := Annotation Value +Annotation := `@` Value | `#` ((space | tab) linecomment) (cr | lf) + +Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number Boolean := `#t` | `#f` ByteString := `#"` binchar* `"` | `#x"` (ws hex hex)* ws `"` @@ -25,11 +26,6 @@ Float := flt (`f`|`F`) | `#xf"` (ws hex hex)4 ws `"` Double := flt | `#xd"` (ws hex hex)8 ws `"` SignedInteger := int -Embedded := `#!` Value -Annotated := Annotation Value -Annotation := `@` Value | `#` ((space | tab) linecomment) (cr | lf) -linecomment := «any unicode scalar except cr or lf»* - escaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\u` hex hex hex hex binescaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\x` hex hex binchar := «any scalar ≥32 and ≤126, except `\` or `"`» | binescaped | `\"` @@ -45,4 +41,9 @@ int := (`-`|`+`) (`0`..`9`)+ frac := `.` (`0`..`9`)+ exp := (`e`|`E`) (`-`|`+`) (`0`..`9`)+ hex := `A`..`F` | `a`..`f` | `0`..`9` + +ws := (space | tab | cr | lf)* +delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` + | `#` | `:` | `"` | `|` | `@` | `;` | `,` +linecomment := «any unicode scalar except cr or lf»* ``` diff --git a/_includes/cheatsheet-text.md b/_includes/cheatsheet-text.md index ce1501f..3595804 100644 --- a/_includes/cheatsheet-text.md +++ b/_includes/cheatsheet-text.md @@ -1,19 +1,22 @@ {:.postcard-grammar.textsyntax} | *Document* | := | *Value* **ws** | -| *Value* | := | **ws** (*Record* | *Collection* | *Atom* | *Embedded* | *Annotated*) | +| *Value* | := | **ws** (*Record* | *Collection* | *Embedded* | *Annotated* | *Atom*) | | *Collection* | := | *Sequence* | *Dictionary* | *Set* | -| *Atom* | := | *Boolean* | *ByteString* | *String* | *QuotedSymbol* | *Symbol* | *Number* | -| **ws** | := | (**space** | **tab** | **cr** | **lf**) | -| **commas** | := | (**ws** `,`) **ws** | -| **delimiter** | := | **ws** | `<` | `>` | `[` | `]` | `{` | `}` | `#` | `:` | `"` | `|` | `@` | `;` | `,` | {:.postcard-grammar.textsyntax} | *Record* | := | `<`*Value*+ **ws**`>` | | *Sequence* | := | `[`(**commas** *Value*) **commas**`]` | | *Set* | := | `#{`(**commas** *Value*) **commas**`}` | | *Dictionary* | := | `{` (**commas** *Value* **ws**`:`*Value*) **commas**`}` | +| **commas** | := | (**ws** `,`) **ws** | {:.postcard-grammar.textsyntax} +| *Embedded* | := | `#!`*Value* | +| *Annotated* | := | *Annotation* *Value* | +| *Annotation* | := | `@`*Value* |`#` ((**space** | **tab**) *linecomment*) (**cr** | **lf**) | + +{:.postcard-grammar.textsyntax} +| *Atom* | := | *Boolean* | *ByteString* | *String* | *QuotedSymbol* | *Symbol* | *Number* | | *Boolean* | := | `#t`|`#f` | | *ByteString* | := | `#"`*binchar* `"`|`#x"` (**ws** *hex* *hex*) **ws**`"`|`#[` (**ws** *base64char*) **ws**`]` | | *String* | := | `"` (« any unicode scalar value except `\` or `"` » | *escaped* |`\"`) `"` | @@ -24,12 +27,6 @@ | *Double* | := | *flt* |`#xd"` (**ws** *hex* *hex*)8 **ws**`"` | | *SignedInteger* | := | *int* | -{:.postcard-grammar.textsyntax} -| *Embedded* | := | `#!`*Value* | -| *Annotated* | := | *Annotation* *Value* | -| *Annotation* | := | `@`*Value* |`#` ((**space** | **tab**) *linecomment*) (**cr** | **lf**) | -| *linecomment* | := | « any unicode scalar value except **cr** or **lf** » | - {:.postcard-grammar.textsyntax} | *escaped* | := | `\\`|`\/`|`\b`|`\f`|`\n`|`\r`|`\t`|`\u`*hex* *hex* *hex* *hex* | | *binescaped* | := | `\\`|`\/`|`\b`|`\f`|`\n`|`\r`|`\t`|`\x`*hex* *hex* | @@ -44,3 +41,8 @@ | *frac* | := | `.` (`0`..`9`)+ | | *exp* | := | (`e`|`E`) (`-`|`+`) (`0`..`9`)+ | | *hex* | := | `A`..`F`|`a`..`f`|`0`..`9` | + +{:.postcard-grammar.textsyntax} +| **ws** | := | (**space** | **tab** | **cr** | **lf**) | +| **delimiter** | := | **ws** | `<` | `>` | `[` | `]` | `{` | `}` | `#` | `:` | `"` | `|` | `@` | `;` | `,` | +| *linecomment* | := | « any unicode scalar value except **cr** or **lf** » | diff --git a/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md b/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md index d812b69..2b5a504 100644 --- a/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md +++ b/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md @@ -1,18 +1,19 @@ ```text Document := Value ws -Value := ws (Record | Collection | Atom | Embedded | Annotated) +Value := ws (Record | Collection | Embedded | Annotated | Atom) Collection := Sequence | Dictionary | Set -Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number -ws := (space | tab | cr | lf)* -commas := (ws `,`)* ws -delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` - | `#` | `:` | `"` | `|` | `@` | `;` | `,` Record := `<` Value+ ws `>` Sequence := `[` (commas Value)* commas `]` Set := `#{` (commas Value)* commas `}` Dictionary := `{` (commas Value ws `:` Value)* commas `}` +commas := (ws `,`)* ws +Embedded := `#!` Value +Annotated := Annotation Value +Annotation := `@` Value | `#` ((space | tab) linecomment) (cr | lf) + +Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number Boolean := `#t` | `#f` ByteString := `#"` binchar* `"` | `#x"` (ws hex hex)* ws `"` @@ -25,11 +26,6 @@ Float := flt (`f`|`F`) | `#xf"` (ws hex hex)4 ws `"` Double := flt | `#xd"` (ws hex hex)8 ws `"` SignedInteger := int -Embedded := `#!` Value -Annotated := Annotation Value -Annotation := `@` Value | `#` ((space | tab) linecomment) (cr | lf) -linecomment := «any unicode scalar except cr or lf»* - escaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\u` hex hex hex hex binescaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\x` hex hex binchar := «any scalar ≥32 and ≤126, except `\` or `"`» | binescaped | `\"` @@ -45,4 +41,9 @@ int := (`-`|`+`) (`0`..`9`)+ frac := `.` (`0`..`9`)+ exp := (`e`|`E`) (`-`|`+`) (`0`..`9`)+ hex := `A`..`F` | `a`..`f` | `0`..`9` + +ws := (space | tab | cr | lf)* +delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` + | `#` | `:` | `"` | `|` | `@` | `;` | `,` +linecomment := «any unicode scalar except cr or lf»* ``` diff --git a/preserves.css b/preserves.css index 7322cc7..a705845 100644 --- a/preserves.css +++ b/preserves.css @@ -95,7 +95,7 @@ body > nav ul > li { } } @media print { - @page { size: letter; margin: 4rem 0rem 4.333rem 0rem; } + @page { size: A4; margin: 4rem 0rem 4.333rem 0rem; } body > nav { display: none; } main { margin-left: 4.5rem; margin-right: 4.5rem; } html { font-size: 10.5pt; }