Skip to content

Commit d7f52bd

Browse files
committed
State greediness of GraphQL
Explicitly state that the GraphQL grammar is greedy to clear up possible disambiguity. Closes #539
1 parent 972f2cb commit d7f52bd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/Appendix A -- Notation Conventions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ ListOfLetterA :
4343
- `a`
4444
- ListOfLetterA `a`
4545

46+
The GraphQL grammar is greedy; this means that given a choice between matching an optional token or a subsequent rule, the optional token prevails. For example, given the following grammar:
47+
48+
Example :
49+
- Letters
50+
- Letters Example
51+
52+
Letters :
53+
- `a` LetterB?
54+
- LetterB
55+
56+
LetterB :: `b`
57+
58+
The sequence of tokens `ab` are matched by a single {Letters} production, rather than two productions matching `a` and `b`, respectively.
59+
4660

4761
## Lexical and Syntactical Grammar
4862

0 commit comments

Comments
 (0)