graphql / graphql/graphql-spec

BlockStringCharacter production doesn't quite work

Open
#901 1 comment 0 reactions 0 assignees View on GitHub
🤷‍♀️ Ambiguity
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The definition of BlockStringCharacter is:

```
BlockStringCharacter ::
- SourceCharacter but not `"""` or `\"""`
- `\"""`
```

But if I understand correctly, SourceCharacter is always a single character. So the concept of `but not`-ing a multi-character sequence out of SourceCharacter doesn't really make sense.

I think this should be something more like

```
BlockStringCharacter ::
- SourceCharacter but not `"` or `\`
- `"` [lookahead != `"`]
- `""` [lookahead != `"`]
- `\` [lookahead != `"`]
- `\"` [lookahead != `"`]
- `\""` [lookahead != `"`]
- `\"""`
```

I'm also not super clear after reading the spec if, eg,

```
"""

\""""

"""
```

is legit. After all you could interpret the spec as saying "three double quotes cannot be in the block string unless there's a backslash immediately before them" which is not the case here. (My version would make that allowed and parsed as `\"""` followed by `"`. graphql-js certainly treats it this way.)

Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.