Skip to content

Commit 5636d15

Browse files
committed
Fix grammar issues, add Comma production
Replaced "EnumShapeStatement" rule with "EnumStatement" because other shape statements don't include the word "Shape". Renamed "NodeKeywords" to "NodeKeyword" since grammar rules aren't generally plural like this. Added "Comma" production, which is now used in WS and can be optionally used after defining an enum member. Members that support value assignment can now have a trailing comma. Fixed WS loop handling for several productions. Fixed OperationErrors to actually support a list of ShapeId, rather than just a list of Identifier. Identifier implies that you can only use errors in the local namespace which isn't the case.
1 parent 4124b2e commit 5636d15

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

docs/source-1.0/spec/core/idl.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ string support defined in `RFC 5234 <https://www.rfc-editor.org/rfc/rfc7405>`_.
122122
NodeValue :`NodeArray`
123123
:/ `NodeObject`
124124
:/ `Number`
125-
:/ `NodeKeywords`
125+
:/ `NodeKeyword`
126126
:/ `NodeStringValue`
127127
NodeArray :"[" [`WS`]
128128
: [`NodeValue` [`WS`]
@@ -148,7 +148,7 @@ string support defined in `RFC 5234 <https://www.rfc-editor.org/rfc/rfc7405>`_.
148148
Minus :%x2D ; -
149149
Plus :%x2B ; +
150150
Zero :%x30 ; 0
151-
NodeKeywords :%s"true" / %s"false" / %s"null"
151+
NodeKeyword :%s"true" / %s"false" / %s"null"
152152
NodeStringValue :`ShapeId` / `TextBlock` / `QuotedText`
153153
QuotedText :DQUOTE *`QuotedChar` DQUOTE
154154
QuotedChar :%x20-21 ; space - "!"

docs/source-2.0/spec/idl.rst

+13-12
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ string support defined in :rfc:`7405`.
9898
.. rubric:: Whitespace
9999

100100
.. productionlist:: smithy
101-
WS :1*(`SP` / `NL` / `Comment` / ",") ; whitespace
101+
WS :1*(`SP` / `NL` / `Comment` / `Comma`) ; whitespace
102+
Comma:","
102103
SP :1*(%x20 / %x09) ; one or more spaces or tabs
103104
NL :%x0A / %x0D.0A ; Newline: \n and \r\n
104105
NotNL:%x09 / %x20-10FFFF ; Any character except newline
@@ -129,7 +130,7 @@ string support defined in :rfc:`7405`.
129130
NodeValue :`NodeArray`
130131
:/ `NodeObject`
131132
:/ `Number`
132-
:/ `NodeKeywords`
133+
:/ `NodeKeyword`
133134
:/ `NodeStringValue`
134135
NodeArray :"[" [`WS`] *(`NodeValue` [`WS`]) "]"
135136
NodeObject :"{" [`WS`] [`NodeObjectKvp` *(`WS` `NodeObjectKvp`)] [`WS`] "}"
@@ -145,7 +146,7 @@ string support defined in :rfc:`7405`.
145146
Minus :%x2D ; -
146147
Plus :%x2B ; +
147148
Zero :%x30 ; 0
148-
NodeKeywords :%s"true" / %s"false" / %s"null"
149+
NodeKeyword :%s"true" / %s"false" / %s"null"
149150
NodeStringValue :`ShapeId` / `TextBlock` / `QuotedText`
150151
QuotedText :DQUOTE *`QuotedChar` DQUOTE
151152
QuotedChar :%x09 ; tab
@@ -175,7 +176,7 @@ string support defined in :rfc:`7405`.
175176
ShapeOrApplyStatement :`ShapeStatement` / `ApplyStatement`
176177
ShapeStatement :`TraitStatements` `ShapeBody`
177178
ShapeBody :`SimpleShapeStatement`
178-
:/ `EnumShapeStatement`
179+
:/ `EnumStatement`
179180
:/ `ListStatement`
180181
:/ `MapStatement`
181182
:/ `StructureStatement`
@@ -188,11 +189,11 @@ string support defined in :rfc:`7405`.
188189
:/ %s"byte" / %s"short" / %s"integer" / %s"long"
189190
:/ %s"float" / %s"double" / %s"bigInteger"
190191
:/ %s"bigDecimal" / %s"timestamp"
191-
Mixins :[`SP`] %s"with" [`WS`] "[" 1*([`WS`] `ShapeId`) [`WS`] "]"
192-
EnumShapeStatement :`EnumTypeName` `SP` `Identifier` [`Mixins`] [`WS`] `EnumShapeMembers`
192+
Mixins :[`SP`] %s"with" [`WS`] "[" [`WS`] 1*(`ShapeId` [`WS`]) "]"
193+
EnumStatement :`EnumTypeName` `SP` `Identifier` [`Mixins`] [`WS`] `EnumShapeMembers`
193194
EnumTypeName :%s"enum" / %s"intEnum"
194195
EnumShapeMembers :"{" [`WS`] 1*(`TraitStatements` `Identifier` [`ValueAssignment`] [`WS`]) "}"
195-
ValueAssignment :[`SP`] "=" [`SP`] `NodeValue` `BR`
196+
ValueAssignment :[`SP`] "=" [`SP`] `NodeValue` [`SP`] [`Comma`] `BR`
196197
ListStatement :%s"list" `SP` `Identifier` [`Mixins`] [`WS`] `ListMembers`
197198
ListMembers :"{" [`WS`] [`ListMember`] [`WS`] "}"
198199
ListMember :`TraitStatements` (`ElidedListMember` / `ExplicitListMember`)
@@ -223,9 +224,9 @@ string support defined in :rfc:`7405`.
223224
: *(`OperationInput` / `OperationOutput` / `OperationErrors`)
224225
: [`WS`] "}"
225226
: ; only one of each property can be specified.
226-
OperationInput :%s"input" [`WS`] (`InlineStructure` / (":" [`WS`] `ShapeId`)) `WS`
227-
OperationOutput :%s"output" [`WS`] (`InlineStructure` / (":" [`WS`] `ShapeId`)) `WS`
228-
OperationErrors :%s"errors" [`WS`] ":" [`WS`] "[" *([`WS`] `Identifier`) [`WS`] "]" `WS`
227+
OperationInput :%s"input" [`WS`] (`InlineStructure` / (":" [`WS`] `ShapeId`))
228+
OperationOutput :%s"output" [`WS`] (`InlineStructure` / (":" [`WS`] `ShapeId`))
229+
OperationErrors :%s"errors" [`WS`] ":" [`WS`] "[" [`WS`] *(`ShapeId` [`WS`]) "]"
229230
InlineStructure :":=" [`WS`] `TraitStatements` [`StructureResource`]
230231
: [`Mixins`] [`WS`] `StructureMembers`
231232
@@ -784,7 +785,7 @@ The following example defines an ``integer`` shape with a :ref:`range-trait`:
784785
Enum shapes
785786
-----------
786787

787-
The :ref:`enum` shape is defined using an :token:`smithy:EnumShapeStatement`.
788+
The :ref:`enum` shape is defined using an :token:`smithy:EnumStatement`.
788789

789790
The following example defines an :ref:`enum` shape:
790791

@@ -847,7 +848,7 @@ IntEnum shapes
847848
--------------
848849

849850
The :ref:`intEnum` shape is defined using an
850-
:token:`smithy:EnumShapeStatement`.
851+
:token:`smithy:EnumStatement`.
851852

852853
.. note::
853854
The :ref:`enumValue trait <enumValue-trait>` is required on all

0 commit comments

Comments
 (0)