From e2e81a67c39e50702ac48380fc46f776d81c86a6 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 29 Oct 2023 22:11:43 +0100 Subject: [PATCH] Fix up cheat sheets --- _includes/cheatsheet-text-plaintext.md | 2 ++ _includes/cheatsheet-text.md | 1 + git-hooks/pre-commit | 12 +++++++++++- .../rust/preserves/doc/cheatsheet-text-plaintext.md | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/_includes/cheatsheet-text-plaintext.md b/_includes/cheatsheet-text-plaintext.md index 6c3a1ff..93493ad 100644 --- a/_includes/cheatsheet-text-plaintext.md +++ b/_includes/cheatsheet-text-plaintext.md @@ -4,6 +4,8 @@ Value := ws (Record | Collection | Atom | Embedded | Annotated) Collection := Sequence | Dictionary | Set Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number ws := (space | tab | cr | lf | `,`)* +delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` + | `#` | `:` | `"` | `|` | `@` | `;` Record := `<` Value+ ws `>` Sequence := `[` Value* ws `]` diff --git a/_includes/cheatsheet-text.md b/_includes/cheatsheet-text.md index 83ab211..d995ab5 100644 --- a/_includes/cheatsheet-text.md +++ b/_includes/cheatsheet-text.md @@ -4,6 +4,7 @@ | *Collection* | := | *Sequence* | *Dictionary* | *Set* | | *Atom* | := | *Boolean* | *ByteString* | *String* | *QuotedSymbol* | *Symbol* | *Number* | | **ws** | := | (**space** | **tab** | **cr** | **lf** |`,`) | +| **delimiter** | := | **ws** | `<` | `>` | `[` | `]` | `{` | `}` | `#` | `:` | `"` | `|` | `@` | `;` | {:.postcard-grammar.textsyntax} | *Record* | := | `<`*Value*+ **ws**`>` | diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index f6b14ef..1da8323 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -3,7 +3,15 @@ set -e exec 1>&2 -COMMAND=cmp +failed= +cmp_and_fail() { + if ! cmp "$1" "$2" + then + failed=failed + fi +} + +COMMAND=cmp_and_fail if [ "$1" = "--fix" ]; then COMMAND=cp @@ -38,3 +46,5 @@ ${COMMAND} _includes/cheatsheet-text-plaintext.md implementations/rust/preserves ${COMMAND} _includes/value-grammar.md implementations/rust/preserves/doc/value-grammar.md ${COMMAND} _includes/what-is-preserves-schema.md implementations/rust/preserves-schema/doc/what-is-preserves-schema.md + +[ -z "$failed" ] diff --git a/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md b/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md index 6c3a1ff..93493ad 100644 --- a/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md +++ b/implementations/rust/preserves/doc/cheatsheet-text-plaintext.md @@ -4,6 +4,8 @@ Value := ws (Record | Collection | Atom | Embedded | Annotated) Collection := Sequence | Dictionary | Set Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number ws := (space | tab | cr | lf | `,`)* +delimiter := ws | `<` | `>` | `[` | `]` | `{` | `}` + | `#` | `:` | `"` | `|` | `@` | `;` Record := `<` Value+ ws `>` Sequence := `[` Value* ws `]`