diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-12 16:24:33 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-12 16:24:33 -0700 |
commit | 5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2 (patch) | |
tree | 4252110425faa4046b4705330ff4c575cf867f70 /03-lexical-syntax.md | |
parent | 32e0943c02a3bdf9e57e87b6e0c0ee55da9194e2 (diff) | |
download | scala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.tar.gz scala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.tar.bz2 scala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.zip |
SI-5086 clean up EBNF
- sequences of block statements were wrong
(btw, note that BlockStat matches the empty sequence of tokens)
- lexical syntax was pretty messy: clarified, removed extraneous backslashes
Diffstat (limited to '03-lexical-syntax.md')
-rw-r--r-- | 03-lexical-syntax.md | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/03-lexical-syntax.md b/03-lexical-syntax.md index 7c2ec30181..7ea15ec9f4 100644 --- a/03-lexical-syntax.md +++ b/03-lexical-syntax.md @@ -408,8 +408,7 @@ members of type `Boolean`. ### Character Literals ``` -characterLiteral ::= ‘'’ printableChar ‘'’ - | ‘'’ charEscapeSeq ‘'’ +characterLiteral ::= ‘'’ (printableChar | charEscapeSeq) ‘'’ ``` A character literal is a single character enclosed in quotes. @@ -432,7 +431,7 @@ the octal escape `'\12'` ([see here](#escape-sequences)). ### String Literals ``` -stringLiteral ::= ‘\"’ {stringElement} ‘\"’ +stringLiteral ::= ‘"’ {stringElement} ‘"’ stringElement ::= printableCharNoDoubleQuote | charEscapeSeq ``` @@ -510,16 +509,16 @@ Because there is a predefined The following escape sequences are recognized in character and string literals. -| | | | | -|-------|----------|-----------------|------| -| `\b` | `\u0008` | backspace | BS | -| `\t` | `\u0009` | horizontal tab | HT | -| `\n` | `\u000a` | linefeed | LF | -| `\f` | `\u000c` | form feed | FF | -| `\r` | `\u000d` | carriage return | CR | -| `\"` | `\u0022` | double quote | " | -| `\'` | `\u0027` | single quote | ' | -| `\\` | `\u005c` | backslash | `\` | +| charEscapeSeq | unicode | name | char | +|---------------|----------|-----------------|--------| +| `‘\‘ ‘b‘` | `\u0008` | backspace | `BS` | +| `‘\‘ ‘t‘` | `\u0009` | horizontal tab | `HT` | +| `‘\‘ ‘n‘` | `\u000a` | linefeed | `LF` | +| `‘\‘ ‘f‘` | `\u000c` | form feed | `FF` | +| `‘\‘ ‘r‘` | `\u000d` | carriage return | `CR` | +| `‘\‘ ‘"‘` | `\u0022` | double quote | `"` | +| `‘\‘ ‘'‘` | `\u0027` | single quote | `'` | +| `‘\‘ ‘\‘` | `\u005c` | backslash | `\` | A character with Unicode between 0 and 255 may also be represented by |