Fix bugs wrt pexpr trailers
This commit is contained in:
parent
d638555239
commit
85b3e513f9
|
@ -1,7 +1,7 @@
|
||||||
The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax.
|
The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Document := Expr* ws
|
Document := Expr* Trailer ws
|
||||||
Expr := ws (SimpleExpr | Punct)
|
Expr := ws (SimpleExpr | Punct)
|
||||||
SimpleExpr := Compound | Embedded | Annotated | Atom
|
SimpleExpr := Compound | Embedded | Annotated | Atom
|
||||||
Compound := Sequence | Record | Block | Group | Set
|
Compound := Sequence | Record | Block | Group | Set
|
||||||
|
@ -13,7 +13,7 @@ Block := `{` Expr* Trailer ws `}`
|
||||||
Group := `(` Expr* Trailer ws `)`
|
Group := `(` Expr* Trailer ws `)`
|
||||||
Set := `#{` Expr* Trailer ws `}`
|
Set := `#{` Expr* Trailer ws `}`
|
||||||
|
|
||||||
Trailer := Annotation*
|
Trailer := (ws Annotation)*
|
||||||
|
|
||||||
Embedded := `#!` SimpleExpr
|
Embedded := `#!` SimpleExpr
|
||||||
Annotated := Annotation SimpleExpr
|
Annotated := Annotation SimpleExpr
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax.
|
The definitions of `Atom`, `ws`, and `linecomment` are as given in the Preserves text syntax.
|
||||||
|
|
||||||
{:.postcard-grammar.textsyntax}
|
{:.postcard-grammar.textsyntax}
|
||||||
| *Document* | := | *Expr*<sup>⋆</sup> **ws**
|
| *Document* | := | *Expr*<sup>⋆</sup> *Trailer* **ws**
|
||||||
| *Expr* | := | **ws** (*SimpleExpr* | *Punct*)
|
| *Expr* | := | **ws** (*SimpleExpr* | *Punct*)
|
||||||
| *SimpleExpr* | := | *Compound* | *Embedded* | *Annotated* | *Atom*
|
| *SimpleExpr* | := | *Compound* | *Embedded* | *Annotated* | *Atom*
|
||||||
| *Compound* | := | *Sequence* | *Record* | *Block* | *Group* | *Set*
|
| *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*<sup>⋆</sup> *Trailer* **ws** `}`
|
| *Set* | := | `#{` *Expr*<sup>⋆</sup> *Trailer* **ws** `}`
|
||||||
|
|
||||||
{:.postcard-grammar.textsyntax}
|
{:.postcard-grammar.textsyntax}
|
||||||
| *Trailer* | := | *Annotation*<sup>⋆</sup>
|
| *Trailer* | := | (**ws** *Annotation*)<sup>⋆</sup>
|
||||||
|
|
||||||
{:.postcard-grammar.textsyntax}
|
{:.postcard-grammar.textsyntax}
|
||||||
| *Embedded* | := | `#!` *SimpleExpr*
|
| *Embedded* | := | `#!` *SimpleExpr*
|
||||||
|
|
|
@ -41,9 +41,9 @@ below](#reading-preserves)).
|
||||||
## Grammar
|
## Grammar
|
||||||
|
|
||||||
Standalone documents containing P-expressions are sequences of
|
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 single P-expression `Expr` can be an `Atom` from the [text syntax][],
|
||||||
a compound expression, special punctuation, an `Embedded` expression, or
|
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
|
or other sequential construct. The ordinary text syntax forbids comments
|
||||||
in these positions, but P-expressions allow them.
|
in these positions, but P-expressions allow them.
|
||||||
|
|
||||||
Trailer = *Annotation
|
Trailer = *(ws Annotation)
|
||||||
|
|
||||||
## <a id="encoding-pexprs"></a>Encoding P-expressions as Preserves
|
## <a id="encoding-pexprs"></a>Encoding P-expressions as Preserves
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue