summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-01-06 20:41:42 +0100
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-01-15 22:23:22 +0100
commit7aa263bebf946339a71cb7d153ea98d3c8302839 (patch)
tree222dbc863a783c361a6ae6a9dce7b5defcd94a9b /doc
parent077b8327ecefb201f0937263fc21e4a9f28c16a8 (diff)
downloadNim-7aa263bebf946339a71cb7d153ea98d3c8302839.tar.gz
Duplicates string literal table for character literals.
Hopefully the index spamming will lead more people here.
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.txt31
1 files changed, 27 insertions, 4 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index 88a7f3815..d9849f044 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -312,13 +312,36 @@ Character literals
 ------------------
 
 Character literals are enclosed in single quotes ``''`` and can contain the
-same escape sequences as strings - with one exception: ``\n`` is not allowed
-as it may be wider than one character (often it is the pair CR/LF for example).
+same escape sequences as strings - with one exception: `newline`:idx: (``\n``)
+is not allowed as it may be wider than one character (often it is the pair
+CR/LF for example).  Here are the valid `escape sequences`:idx: for character
+literals:
+
+==================         ===================================================
+  Escape sequence          Meaning
+==================         ===================================================
+  ``\r``, ``\c``           `carriage return`:idx:
+  ``\l``                   `line feed`:idx:
+  ``\f``                   `form feed`:idx:
+  ``\t``                   `tabulator`:idx:
+  ``\v``                   `vertical tabulator`:idx:
+  ``\\``                   `backslash`:idx:
+  ``\"``                   `quotation mark`:idx:
+  ``\'``                   `apostrophe`:idx:
+  ``\`` '0'..'9'+          `character with decimal value d`:idx:;
+                           all decimal digits directly
+                           following are used for the character
+  ``\a``                   `alert`:idx:
+  ``\b``                   `backspace`:idx:
+  ``\e``                   `escape`:idx: `[ESC]`:idx:
+  ``\x`` HH                `character with hex value HH`:idx:;
+                           exactly two hex digits are allowed
+==================         ===================================================
+
 A character is not an Unicode character but a single byte. The reason for this
 is efficiency: for the overwhelming majority of use-cases, the resulting
 programs will still handle UTF-8 properly as UTF-8 was specially designed for
-this.
-Another reason is that Nimrod can thus support ``array[char, int]`` or
+this. Another reason is that Nimrod can thus support ``array[char, int]`` or
 ``set[char]`` efficiently as many algorithms rely on this feature.