diff --git a/_includes/cheatsheet-pexprs-plaintext.md b/_includes/cheatsheet-pexprs-plaintext.md index 087efd9..832478c 100644 --- a/_includes/cheatsheet-pexprs-plaintext.md +++ b/_includes/cheatsheet-pexprs-plaintext.md @@ -1,7 +1,7 @@ The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax. ```text -Document := Expr* ws +Document := Expr* Trailer ws Expr := ws (SimpleExpr | Punct) SimpleExpr := Compound | Embedded | Annotated | Atom Compound := Sequence | Record | Block | Group | Set @@ -13,7 +13,7 @@ Block := `{` Expr* Trailer ws `}` Group := `(` Expr* Trailer ws `)` Set := `#{` Expr* Trailer ws `}` -Trailer := Annotation* +Trailer := (ws Annotation)* Embedded := `#!` SimpleExpr Annotated := Annotation SimpleExpr diff --git a/_includes/cheatsheet-pexprs.md b/_includes/cheatsheet-pexprs.md index bc433d1..4a5d4e5 100644 --- a/_includes/cheatsheet-pexprs.md +++ b/_includes/cheatsheet-pexprs.md @@ -1,7 +1,7 @@ The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax. {:.postcard-grammar.textsyntax} -| *Document* | := | *Expr* **ws** +| *Document* | := | *Expr* *Trailer* **ws** | *Expr* | := | **ws** (*SimpleExpr* | *Punct*) | *SimpleExpr* | := | *Compound* | *Embedded* | *Annotated* | *Atom* | *Compound* | := | *Sequence* | *Record* | *Block* | *Group* | *Set* @@ -15,7 +15,7 @@ The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves | *Set* | := | `#{` *Expr* *Trailer* **ws** `}` {:.postcard-grammar.textsyntax} -| *Trailer* | := | *Annotation* +| *Trailer* | := | (**ws** *Annotation*) {:.postcard-grammar.textsyntax} | *Embedded* | := | `#!` *SimpleExpr* diff --git a/preserves-expressions.md b/preserves-expressions.md index f90e110..997f036 100644 --- a/preserves-expressions.md +++ b/preserves-expressions.md @@ -41,9 +41,9 @@ below](#reading-preserves)). ## Grammar Standalone documents containing P-expressions are sequences of -individual `Expr`s, followed by trailing whitespace. +individual `Expr`s, followed by annotations, comments, and/or whitespace. - Document = *Expr ws + Document = *Expr Trailer ws A single P-expression `Expr` can be an `Atom` from the [text syntax][], a compound expression, special punctuation, an `Embedded` expression, or @@ -81,7 +81,7 @@ common in programming notations to allow comments at the end of a file or other sequential construct. The ordinary text syntax forbids comments in these positions, but P-expressions allow them. - Trailer = *Annotation + Trailer = *(ws Annotation) ## Encoding P-expressions as Preserves