Skip to content

Commit

Permalink
Fix apply statement parsing and ABNF (#1414)
Browse files Browse the repository at this point in the history
This fixes an issue where `applySomeShape @someTrait` was valid,
without any space between the apply and shape name. The fix makes
it so spacing is required, not line breaks as was the case in
the old ABNF, to be consistent with other shapes grammar
(see [SimpleShapeStatement](https://awslabs.github.io/smithy/2.0/spec/idl.html#grammar-token-smithy-SimpleShapeStatement))
  • Loading branch information
milesziemer authored Sep 20, 2022
1 parent ee0b4ff commit 0827159
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source-1.0/spec/core/idl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ string support defined in `RFC 5234 <https://www.rfc-editor.org/rfc/rfc7405>`_.
: *(`Comma` `TraitStructureKvp` *`WS`)
: `TrailingComma`
TraitStructureKvp :`NodeObjectKey` *`WS` ":" *`WS` `NodeValue`
ApplyStatement :%s"apply" `WS` `ShapeId` `WS` `Trait` `BR`
ApplyStatement :%s"apply" `SP` `ShapeId` `WS` `Trait` `BR`
.. rubric:: Shape ID

Expand Down
2 changes: 1 addition & 1 deletion docs/source-2.0/spec/idl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ string support defined in `RFC 5234 <https://www.rfc-editor.org/rfc/rfc7405>`_.
TraitStructure :`TraitStructureKvp` *(*`WS` `TraitStructureKvp`)
TraitStructureKvp :`NodeObjectKey` *`WS` ":" *`WS` `NodeValue`
ApplyStatement :(`ApplyStatementSingular` / `ApplyStatementBlock`)
ApplyStatementSingular :%s"apply" `WS` `ShapeId` `WS` `Trait` `BR`
ApplyStatementSingular :%s"apply" `SP` `ShapeId` `WS` `Trait` `BR`
ApplyStatementBlock :%s"apply" `SP` `ShapeId` `WS` "{" `TraitStatements` "}" `BR`
.. rubric:: Shape ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ private void parseApplyStatement() {
expect('p');
expect('l');
expect('y');
sp();
rsp();

String name = ParserUtils.parseShapeId(this);
rws();
Expand Down

0 comments on commit 0827159

Please sign in to comment.