Skip to content

Commit 65af648

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

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/parser.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ The GraphQL AST structure is very similar to ESTree structure, but there are a f
1515
Here's a list of changes that the parser performs, in order to make the GraphQL AST compatible with ESTree:
1616

1717
**Problem**: GraphQL uses `kind` field to define the kind of the AST node, while ESTree uses `type`.
18+
1819
**Solution**: The parser adds `type` field on each node, and just copies the value from `kind` field.
1920

2021
**Problem**: Some GraphQL AST nodes are using `type` field (which conflicts with the ESTree kind).
22+
2123
**Solution**: AST nodes that has `type` field are being transformed, and the `type` field changes to `gqlType`.
2224

2325
**Problem**: GraphQL AST structure allows circular JSON links (while ESTree might fail on `Maximum call stack exceeded`).
26+
2427
**Solution**: The parser removes circular JSONs (specifically around GraphQL `Location` and the `Lexer`)
2528

2629
**Problem**: GraphQL uses `location` field to store the AST locations, while ESTree also uses it in a different structure.
30+
2731
**Solution**: The parser creates a new `location` field that is compatible with ESTree, and renames the GraphQL `location` to `gqlLocation`.
2832

2933
### Loading GraphQL Schema

0 commit comments

Comments
 (0)