Skip to content

Commit dee879d

Browse files
authored
Editorial: StringValue (#854)
This factors out the purely editorial changes from #849 to land them earlier and make that particular PR's changes easier to read.
1 parent 413b689 commit dee879d

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ StringValue ::
9797
- `"""` BlockStringCharacter* `"""`
9898

9999
StringCharacter ::
100-
- SourceCharacter but not `"` or \ or LineTerminator
101-
- \u EscapedUnicode
102-
- \ EscapedCharacter
100+
- SourceCharacter but not `"` or `\` or LineTerminator
101+
- `\u` EscapedUnicode
102+
- `\` EscapedCharacter
103103

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

106-
EscapedCharacter :: one of `"` \ `/` b f n r t
106+
EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t`
107107

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

spec/Section 2 -- Language.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,21 @@ SourceCharacter ::
5353
- "U+0020–U+FFFF"
5454

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

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

6367
### Unicode
6468

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

67-
Non-ASCII Unicode characters may freely appear within {StringValue} and
68-
{Comment} portions of GraphQL.
69-
7071
The "Byte Order Mark" is a special Unicode character which
7172
may appear at the beginning of a file containing Unicode which programs may use
7273
to determine the fact that the text stream is Unicode, what endianness the text
@@ -804,13 +805,13 @@ StringValue ::
804805
- `"""` BlockStringCharacter* `"""`
805806

806807
StringCharacter ::
807-
- SourceCharacter but not `"` or \ or LineTerminator
808-
- \u EscapedUnicode
809-
- \ EscapedCharacter
808+
- SourceCharacter but not `"` or `\` or LineTerminator
809+
- `\u` EscapedUnicode
810+
- `\` EscapedCharacter
810811

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

813-
EscapedCharacter :: one of `"` \ `/` b f n r t
814+
EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t`
814815

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

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

833834
**Block Strings**
@@ -892,32 +893,33 @@ StringValue :: `""`
892893

893894
StringValue :: `"` StringCharacter+ `"`
894895

895-
* Return the Unicode character sequence of all {StringCharacter}
896-
Unicode character values.
896+
* Return the sequence of all {StringCharacter} code points.
897897

898-
StringCharacter :: SourceCharacter but not `"` or \ or LineTerminator
898+
StringCharacter :: SourceCharacter but not `"` or `\` or LineTerminator
899899

900-
* Return the character value of {SourceCharacter}.
900+
* Return the code point {SourceCharacter}.
901901

902-
StringCharacter :: \u EscapedUnicode
902+
StringCharacter :: `\u` EscapedUnicode
903903

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

907-
StringCharacter :: \ EscapedCharacter
908+
StringCharacter :: `\` EscapedCharacter
908909

909-
* Return the character value of {EscapedCharacter} according to the table below.
910+
* Return the code point represented by {EscapedCharacter} according to the
911+
table below.
910912

911-
| Escaped Character | Code Unit Value | Character Name |
912-
| ----------------- | --------------- | ---------------------------- |
913-
| `"` | U+0022 | double quote |
914-
| `\` | U+005C | reverse solidus (back slash) |
915-
| `/` | U+002F | solidus (forward slash) |
916-
| `b` | U+0008 | backspace |
917-
| `f` | U+000C | form feed |
918-
| `n` | U+000A | line feed (new line) |
919-
| `r` | U+000D | carriage return |
920-
| `t` | U+0009 | horizontal tab |
913+
| Escaped Character | Code Point | Character Name |
914+
| ----------------- | ---------- | ---------------------------- |
915+
| {`"`} | U+0022 | double quote |
916+
| {`\`} | U+005C | reverse solidus (back slash) |
917+
| {`/`} | U+002F | solidus (forward slash) |
918+
| {`b`} | U+0008 | backspace |
919+
| {`f`} | U+000C | form feed |
920+
| {`n`} | U+000A | line feed (new line) |
921+
| {`r`} | U+000D | carriage return |
922+
| {`t`} | U+0009 | horizontal tab |
921923

922924
StringValue :: `"""` BlockStringCharacter* `"""`
923925

0 commit comments

Comments
 (0)