@@ -57,7 +57,7 @@ InlineExpression ::= StringLiteral
57
57
| inline_placeable
58
58
59
59
/* Literals */
60
- StringLiteral ::= " \"" quoted_text_char * " \""
60
+ StringLiteral ::= " \"" quoted_char * " \""
61
61
NumberLiteral ::= " -" ? digit + (" ." digit + )?
62
62
63
63
/* Inline Expressions */
@@ -88,23 +88,26 @@ identifier ::= [a-zA-Z] [a-zA-Z0-9_-]*
88
88
89
89
/* Characters */
90
90
/* Any Unicode character excluding C0 control characters (but including tab),
91
- * space, surrogate blocks and non-characters (U+FFFE, U+FFFF).
91
+ * surrogate blocks and non-characters (U+FFFE, U+FFFF).
92
92
* Cf. https://www.w3.org/TR/REC-xml/#NT-Char */
93
- regular_char ::= [\\u {9}\\u {21 }- \\u {D7FF }\\u {E000 }- \\u {FFFD }]
93
+ regular_char ::= [\\u {9}\\u {20 }- \\u {D7FF }\\u {E000 }- \\u {FFFD }]
94
94
| [\\u {10000}- \\u {10FFFF}]
95
95
/* The opening brace in text starts a placeable. */
96
- text_char ::= (regular_char - " {" )
97
- | " \u0020"
96
+ special_text_char ::= " {"
97
+ /* Double quote and backslash need to be escaped in string literals. */
98
+ special_quoted_char ::= " \""
99
+ | " \\"
100
+ text_char ::= regular_char - special_text_char
98
101
/* Indented text may not start with characters which mark its end. */
99
102
indented_char ::= text_char - " }" - " [" - " *" - " ."
100
- /* Backslash can be used to escape the double quote and the backslash itself.
101
- * The literal opening brace { is allowed because StringLiterals may not have
102
- * placeables. \uXXXX Unicode escape sequences are recognized, too. */
103
- quoted_text_char ::= ( text_char - " \" " - " \\ " )
104
- | /\\ u [0 - 9a - fA - F]{4}/
105
- | " { "
106
- | " \\\\ "
107
- | " \\\" "
103
+ literal_escape ::= " \\ " special_quoted_char
104
+ unicode_escape ::= " \\u " /[0 - 9a - fA - F]{4}/
105
+ /* The literal opening brace { is allowed in string literals because they may
106
+ * not have placeables. */
107
+ quoted_char ::= ( text_char - special_quoted_char )
108
+ | special_text_char
109
+ | literal_escape
110
+ | unicode_escape
108
111
digit ::= [0- 9]
109
112
110
113
/* Whitespace */
0 commit comments