Skip to content

Commit

Permalink
Better Punctator
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Apr 16, 2021
1 parent 1fcbbe5 commit 4666032
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion spec/Appendix B -- Grammar Summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ Token ::
- FloatValue
- StringValue

Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } . [lookahead != {`.`, Digit}]
Punctuator ::
- DotPunctuator
- OtherPunctuator

DotPunctuator :: `.` [lookahead != {`.`, Digit}]

OtherPunctuator :: one of ! $ & ( ) ... : = @ [ ] { | }

Name ::
- NameStart NameContinue* [lookahead != NameContinue]
Expand Down
14 changes: 13 additions & 1 deletion spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,24 @@ characters are permitted between the characters defining a {FloatValue}.

### Punctuators

Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } . [lookahead != {`.`, Digit}]
Punctuator ::
- DotPunctuator
- OtherPunctuator

DotPunctuator :: `.` [lookahead != {`.`, Digit}]

OtherPunctuator :: one of ! $ & ( ) ... : = @ [ ] { | }

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

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


### Names

Expand Down

0 comments on commit 4666032

Please sign in to comment.