Skip to content

Editorial: StringValue #854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/Appendix B -- Grammar Summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ StringValue ::
- `"""` BlockStringCharacter* `"""`

StringCharacter ::
- SourceCharacter but not `"` or \ or LineTerminator
- \u EscapedUnicode
- \ EscapedCharacter
- SourceCharacter but not `"` or `\` or LineTerminator
- `\u` EscapedUnicode
- `\` EscapedCharacter

EscapedUnicode :: /[0-9A-Fa-f]{4}/

EscapedCharacter :: one of `"` \ `/` b f n r t
EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t`

BlockStringCharacter ::
- SourceCharacter but not `"""` or `\"""`
Expand Down
62 changes: 32 additions & 30 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,21 @@ SourceCharacter ::
- "U+0020–U+FFFF"

GraphQL documents are expressed as a sequence of
[Unicode](https://unicode.org/standard/standard.html) characters. However, with
[Unicode](https://unicode.org/standard/standard.html) code points (informally
referred to as *"characters"* through most of this specification). However, with
few exceptions, most of GraphQL is expressed only in the original non-control
ASCII range so as to be as widely compatible with as many existing tools,
languages, and serialization formats as possible and avoid display issues in
text editors and source control.

Note: Non-ASCII Unicode characters may appear freely within {StringValue} and
{Comment} portions of GraphQL.


### Unicode

UnicodeBOM :: "Byte Order Mark (U+FEFF)"

Non-ASCII Unicode characters may freely appear within {StringValue} and
{Comment} portions of GraphQL.

The "Byte Order Mark" is a special Unicode character which
may appear at the beginning of a file containing Unicode which programs may use
to determine the fact that the text stream is Unicode, what endianness the text
Expand Down Expand Up @@ -804,13 +805,13 @@ StringValue ::
- `"""` BlockStringCharacter* `"""`

StringCharacter ::
- SourceCharacter but not `"` or \ or LineTerminator
- \u EscapedUnicode
- \ EscapedCharacter
- SourceCharacter but not `"` or `\` or LineTerminator
- `\u` EscapedUnicode
- `\` EscapedCharacter

EscapedUnicode :: /[0-9A-Fa-f]{4}/

EscapedCharacter :: one of `"` \ `/` b f n r t
EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t`

BlockStringCharacter ::
- SourceCharacter but not `"""` or `\"""`
Expand All @@ -825,9 +826,9 @@ be interpreted as the beginning of a block string. As an example, the source
{`""""""`} can only be interpreted as a single empty block string and not three
empty strings.

Non-ASCII Unicode characters are allowed within single-quoted strings.
Since {SourceCharacter} must not contain some ASCII control characters, escape
sequences must be used to represent these characters. The {`\`}, {`"`}
Non-ASCII Unicode characters are allowed within single-quoted strings.
Since {SourceCharacter} must not contain some ASCII control characters, escape
sequences must be used to represent these characters. The {`\`}, {`"`}
characters also must be escaped. All other escape sequences are optional.

**Block Strings**
Expand Down Expand Up @@ -892,32 +893,33 @@ StringValue :: `""`

StringValue :: `"` StringCharacter+ `"`

* Return the Unicode character sequence of all {StringCharacter}
Unicode character values.
* Return the sequence of all {StringCharacter} code points.

StringCharacter :: SourceCharacter but not `"` or \ or LineTerminator
StringCharacter :: SourceCharacter but not `"` or `\` or LineTerminator

* Return the character value of {SourceCharacter}.
* Return the code point {SourceCharacter}.

StringCharacter :: \u EscapedUnicode
StringCharacter :: `\u` EscapedUnicode

* Return the character whose code unit value in the Unicode Basic Multilingual
Plane is the 16-bit hexadecimal value {EscapedUnicode}.
* Let {value} be the 16-bit hexadecimal value represented by the sequence of
{HexDigit} within {EscapedUnicode}.
* Return the code point {value}.

StringCharacter :: \ EscapedCharacter
StringCharacter :: `\` EscapedCharacter

* Return the character value of {EscapedCharacter} according to the table below.
* Return the code point represented by {EscapedCharacter} according to the
table below.

| Escaped Character | Code Unit Value | Character Name |
| ----------------- | --------------- | ---------------------------- |
| `"` | U+0022 | double quote |
| `\` | U+005C | reverse solidus (back slash) |
| `/` | U+002F | solidus (forward slash) |
| `b` | U+0008 | backspace |
| `f` | U+000C | form feed |
| `n` | U+000A | line feed (new line) |
| `r` | U+000D | carriage return |
| `t` | U+0009 | horizontal tab |
| Escaped Character | Code Point | Character Name |
| ----------------- | ---------- | ---------------------------- |
| {`"`} | U+0022 | double quote |
| {`\`} | U+005C | reverse solidus (back slash) |
| {`/`} | U+002F | solidus (forward slash) |
| {`b`} | U+0008 | backspace |
| {`f`} | U+000C | form feed |
| {`n`} | U+000A | line feed (new line) |
| {`r`} | U+000D | carriage return |
| {`t`} | U+0009 | horizontal tab |

StringValue :: `"""` BlockStringCharacter* `"""`

Expand Down