Skip to content

Commit 8f0bc6f

Browse files
authored
Update parser.md
1 parent 65af648 commit 8f0bc6f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/parser.md

+8
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,26 @@ The GraphQL AST structure is very similar to ESTree structure, but there are a f
1414

1515
Here's a list of changes that the parser performs, in order to make the GraphQL AST compatible with ESTree:
1616

17+
---
18+
1719
**Problem**: GraphQL uses `kind` field to define the kind of the AST node, while ESTree uses `type`.
1820

1921
**Solution**: The parser adds `type` field on each node, and just copies the value from `kind` field.
2022

23+
---
24+
2125
**Problem**: Some GraphQL AST nodes are using `type` field (which conflicts with the ESTree kind).
2226

2327
**Solution**: AST nodes that has `type` field are being transformed, and the `type` field changes to `gqlType`.
2428

29+
---
30+
2531
**Problem**: GraphQL AST structure allows circular JSON links (while ESTree might fail on `Maximum call stack exceeded`).
2632

2733
**Solution**: The parser removes circular JSONs (specifically around GraphQL `Location` and the `Lexer`)
2834

35+
---
36+
2937
**Problem**: GraphQL uses `location` field to store the AST locations, while ESTree also uses it in a different structure.
3038

3139
**Solution**: The parser creates a new `location` field that is compatible with ESTree, and renames the GraphQL `location` to `gqlLocation`.

0 commit comments

Comments
 (0)