Skip to content

Commit c16a28b

Browse files
leebyronmagicmark
authored andcommitted
Better Punctator
1 parent b65eb31 commit c16a28b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ Token ::
4343
- FloatValue
4444
- StringValue
4545

46-
Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } . [lookahead != {`.`, Digit}]
46+
Punctuator ::
47+
- DotPunctuator
48+
- OtherPunctuator
49+
50+
DotPunctuator :: `.` [lookahead != {`.`, Digit}]
51+
52+
OtherPunctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
4753

4854
Name ::
4955

spec/Section 2 -- Language.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,25 @@ and is {Ignored}.
176176

177177
### Punctuators
178178

179-
Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } . [lookahead != {`.`, Digit}]
179+
Punctuator ::
180+
181+
- DotPunctuator
182+
- OtherPunctuator
183+
184+
DotPunctuator :: `.` [lookahead != {`.`, Digit}]
185+
186+
OtherPunctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
180187

181188
GraphQL documents include punctuation in order to describe structure. GraphQL is
182189
a data description language and not a programming language, therefore GraphQL
183190
lacks the punctuation often used to describe mathematical expressions.
184191

192+
The {`.`} punctuator must not be followed by a {`.`} or {Digit}. This
193+
ensures that the source {"..."} can only be interpreted as a single {`...`} and
194+
not three {`.`}. It also avoids any potential ambiguity with {FloatValue}. As
195+
an example the source {".123"} has no valid lexical representation (without this
196+
restriction it would have been interpreted as {`.`} followed by {IntValue}).
197+
185198
### Names
186199

187200
Name ::

0 commit comments

Comments
 (0)