Skip to content

Commit a9acc2b

Browse files
committed
Editorial
1 parent cfce61e commit a9acc2b

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

spec/Section 2 -- Language.md

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ CommentChar :: SourceCharacter but not LineTerminator
105105
GraphQL source documents may contain single-line comments, starting with the
106106
{`#`} marker.
107107

108-
A comment can contain any Unicode code point in {SourceCharacter} except
109-
{LineTerminator} so a comment always consists of all code points starting with
110-
the {`#`} character up to but not including the {LineTerminator} (or end of the
111-
source).
108+
A comment can contain any {SourceCharacter} except {LineTerminator} so a comment
109+
always consists of all {SourceCharacter} starting with the {`#`} character up to
110+
but not including the {LineTerminator} (or end of the source).
112111

113112
Comments are {Ignored} like white space and may appear after any token, or
114113
before a {LineTerminator}, and have no significance to the semantic meaning of a
@@ -831,13 +830,10 @@ BlockStringCharacter ::
831830
- SourceCharacter but not `"""` or `\"""`
832831
- `\"""`
833832

834-
{StringValue} is a sequence of characters wrapped in quotation marks (U+0022).
835-
(ex. {`"Hello World"`}). White space and other characters ignored in other parts
836-
of a GraphQL document are significant within a string value.
837-
838-
A {StringValue} is evaluated to a Unicode text value, a sequence of Unicode
839-
scalar values, by interpreting all escape sequences using the static semantics
840-
defined below.
833+
A {StringValue} is evaluated to a _Unicode text value_, a sequence of _Unicode
834+
scalar value_, by interpreting all escape sequences using the static semantics
835+
defined below. White space and other characters ignored in other parts of a
836+
GraphQL document are significant within a string value.
841837

842838
The empty string {`""`} must not be followed by another {`"`} otherwise it would
843839
be interpreted as the beginning of a block string. As an example, the source
@@ -846,29 +842,30 @@ empty strings.
846842

847843
**Escape Sequences**
848844

849-
In a single-quoted {StringValue}, any Unicode scalar value may be expressed
845+
In a single-quoted {StringValue}, any _Unicode scalar value_ may be expressed
850846
using an escape sequence. GraphQL strings allow both C-style escape sequences
851847
(for example `\n`) and two forms of Unicode escape sequences: one with a
852848
fixed-width of 4 hexadecimal digits (for example `\u000A`) and one with a
853849
variable-width most useful for representing a _supplementary character_ such as
854850
an Emoji (for example `\u{1F4A9}`).
855851

856852
The hexadecimal number encoded by a Unicode escape sequence must describe a
857-
Unicode scalar value, otherwise parsing should stop with an early error. For
858-
example both sources `"\uDEAD"` and `"\u{110000}"` should not be considered
859-
valid {StringValue}.
853+
Unicode scalar value, otherwise must result in a parse error. For example both
854+
sources `"\uDEAD"` and `"\u{110000}"` should not be considered valid
855+
{StringValue}.
860856

861857
Escape sequences are only meaningful within a single-quoted string. Within a
862858
block string, they are simply that sequence of characters (for example
863859
`"""\n"""` represents the Unicode text [U+005C, U+006E]). Within a comment an
864860
escape sequence is not a significant sequence of characters. They may not appear
865861
elsewhere in a GraphQL document.
866862

867-
Since {StringCharacter} must not contain some characters, escape sequences must
868-
be used to represent these characters. All other escape sequences are optional
869-
and unescaped non-ASCII Unicode characters are allowed within strings. If using
870-
GraphQL within a system which only supports ASCII, then escape sequences may be
871-
used to represent all Unicode characters outside of the ASCII range.
863+
Since {StringCharacter} must not contain some code points directly (for example,
864+
a {LineTerminator}), escape sequences must be used to represent them. All other
865+
escape sequences are optional and unescaped non-ASCII Unicode characters are
866+
allowed within strings. If using GraphQL within a system which only supports
867+
ASCII, then escape sequences may be used to represent all Unicode characters
868+
outside of the ASCII range.
872869

873870
For legacy reasons, a _supplementary character_ may be escaped by two
874871
fixed-width unicode escape sequences forming a _surrogate pair_. For example the
@@ -880,9 +877,10 @@ such code points.
880877
When producing a {StringValue}, implementations should use escape sequences to
881878
represent non-printable control characters (U+0000 to U+001F and U+007F to
882879
U+009F). Other escape sequences are not necessary, however an implementation may
883-
use escape sequences to represent any other range of code points. If an
884-
implementation chooses to escape a _supplementary character_, it should not use
885-
a fixed-width surrogate pair unicode escape sequence.
880+
use escape sequences to represent any other range of code points (for example,
881+
when producing ASCII-only output). If an implementation chooses to escape a
882+
_supplementary character_, it should only use a variable-width unicode escape
883+
sequence.
886884

887885
**Block Strings**
888886

@@ -940,11 +938,11 @@ string.
940938

941939
**Static Semantics**
942940

943-
A {StringValue} describes a Unicode text value, a sequence of *Unicode scalar
944-
value*s. These semantics describe how to apply the {StringValue} grammar to a
941+
A {StringValue} describes a Unicode text value, a sequence of _Unicode scalar
942+
value_. These semantics describe how to apply the {StringValue} grammar to a
945943
source text to evaluate a Unicode text. Errors encountered during this
946944
evaluation are considered a failure to apply the {StringValue} grammar to a
947-
source and result in a parsing error.
945+
source and must result in a parsing error.
948946

949947
StringValue :: `""`
950948

@@ -965,7 +963,7 @@ StringCharacter :: `\u` EscapedUnicode
965963
within {EscapedUnicode}.
966964
- Assert {value} is a within the _Unicode scalar value_ range (>= 0x0000 and <=
967965
0xD7FF or >= 0xE000 and <= 0x10FFFF).
968-
- Return the code point {value}.
966+
- Return the _Unicode scalar value_ {value}.
969967

970968
StringCharacter :: `\u` HexDigit HexDigit HexDigit HexDigit `\u` HexDigit
971969
HexDigit HexDigit HexDigit
@@ -981,8 +979,8 @@ HexDigit HexDigit HexDigit
981979
- Otherwise:
982980
- Assert {leadingValue} is within the _Unicode scalar value_ range.
983981
- Assert {trailingValue} is within the _Unicode scalar value_ range.
984-
- Return the sequence of the code point {leadingValue} followed by the code
985-
point {trailingValue}.
982+
- Return the sequence of the _Unicode scalar value_ {leadingValue} followed by
983+
the _Unicode scalar value_ {trailingValue}.
986984

987985
Note: If both escape sequences encode a _Unicode scalar value_, then this
988986
semantic is identical to applying the prior semantic on each fixed-width escape
@@ -991,19 +989,19 @@ value_.
991989

992990
StringCharacter :: `\` EscapedCharacter
993991

994-
- Return the code point represented by {EscapedCharacter} according to the table
995-
below.
996-
997-
| Escaped Character | Code Point | Character Name |
998-
| ----------------- | ---------- | ---------------------------- |
999-
| {`"`} | U+0022 | double quote |
1000-
| {`\`} | U+005C | reverse solidus (back slash) |
1001-
| {`/`} | U+002F | solidus (forward slash) |
1002-
| {`b`} | U+0008 | backspace |
1003-
| {`f`} | U+000C | form feed |
1004-
| {`n`} | U+000A | line feed (new line) |
1005-
| {`r`} | U+000D | carriage return |
1006-
| {`t`} | U+0009 | horizontal tab |
992+
- Return the _Unicode scalar value_ represented by {EscapedCharacter} according
993+
to the table below.
994+
995+
| Escaped Character | Scalar Value | Character Name |
996+
| ----------------- | ------------ | ---------------------------- |
997+
| {`"`} | U+0022 | double quote |
998+
| {`\`} | U+005C | reverse solidus (back slash) |
999+
| {`/`} | U+002F | solidus (forward slash) |
1000+
| {`b`} | U+0008 | backspace |
1001+
| {`f`} | U+000C | form feed |
1002+
| {`n`} | U+000A | line feed (new line) |
1003+
| {`r`} | U+000D | carriage return |
1004+
| {`t`} | U+0009 | horizontal tab |
10071005

10081006
StringValue :: `"""` BlockStringCharacter\* `"""`
10091007

0 commit comments

Comments
 (0)