aboutsummaryrefslogtreecommitdiff
path: root/language/scanning.rst
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-11-02 13:37:32 -0700
committerMelody Horn <melody@boringcactus.com>2020-11-02 13:37:32 -0700
commit8868b5fa2e8b9f40a31035c51519cce40e73f079 (patch)
tree4a91e7d5437f91a7f95358753097a99e2c84cf2e /language/scanning.rst
parent83e23b6b449112f4a85d09c57e5601faa87856ca (diff)
downloadspec-8868b5fa2e8b9f40a31035c51519cce40e73f079.tar.gz
spec-8868b5fa2e8b9f40a31035c51519cce40e73f079.zip
define compile-time vs runtime behavior
Diffstat (limited to 'language/scanning.rst')
-rw-r--r--language/scanning.rst24
1 files changed, 12 insertions, 12 deletions
diff --git a/language/scanning.rst b/language/scanning.rst
index 3ed9bfe..a141b41 100644
--- a/language/scanning.rst
+++ b/language/scanning.rst
@@ -13,18 +13,18 @@ Scanning
keyword
One of the literal words ``bool``, ``break``, ``case``,
``char``, ``const``, ``continue``, ``default``, ``do``, ``double``,
- ``else``, ``enum``, ``extern``, ``float``, ``for``, ``fragile``,
+ ``else``, ``enum``, ``extern``, ``false``, ``float``, ``for``, ``fragile``,
``function``, ``if``, :crowbar:ref:`include <IncludeStatement>`, ``int``, ``long``, ``opaque``, ``return``,
- ``short``, ``signed``, ``sizeof``, ``struct``, ``switch``, ``union``,
+ ``short``, ``signed``, ``sizeof``, ``struct``, ``switch``, ``true``, ``union``,
``unsigned``, ``void``, or ``while``.
-
+
identifier
A nonempty sequence of characters blah blah blah
.. todo::
figure out https://www.unicode.org/reports/tr31/tr31-33.html
-
+
constant
A numeric (or numeric-equivalent) value specified directly within the code.
May be a :term:`decimal constant`, a :term:`binary constant` , an :term:`octal constant`,
@@ -50,12 +50,12 @@ Scanning
floating-point constant
A sequence of characters matching the regular expression ``[0-9_]+\.[0-9_]+([eE][+-]?[0-9_]+)?``.
-
+
.. note::
Unlike in C and many other languages, ``6e3`` in Crowbar is not a valid floating-point constant.
The Crowbar-compatible spelling is ``6.0e3``.
-
+
Denotes the numeric value of the given decimal number, optionally expressed in scientific notation.
That is, ``XeY`` denotes :math:`X * 10^Y`.
@@ -63,12 +63,12 @@ Scanning
A sequence of characters matching the regular expression ``0(fx|FX)[0-9a-fA-F_]+\.[0-9a-fA-F_]+[pP][+-]?[0-9_]+``.
Denotes the numeric value of the given hexadecimal number expressed in binary scientific notation.
That is, ``XpY`` denotes :math:`X * 2^Y`.
-
+
character constant
A pair of single quotes ``'`` surrounding either a single character or an :term:`escape sequence`.
The single character may not be a single quote or a backslash ``\``.
Denotes the Unicode scalar value for either the single surrounded character or the character denoted by the escape sequence.
-
+
escape sequence
One of the following pairs of characters:
@@ -79,7 +79,7 @@ Scanning
* ``\n``, denoting the line feed, or newline (U+000A)
* ``\t``, denoting the (horizontal) tab (U+0009)
* ``\0``, denoting a null character (U+0000)
-
+
Or a sequence of characters matching one of the following regular expressions:
* ``\\x[0-9a-fA-F]{2}``, denoting the numeric value of the given two hexadecimal digits
@@ -101,13 +101,13 @@ Scanning
whitespace
A nonempty sequence of characters that each has a Unicode general category of either Control (``Cc``) or Separator (``Z``).
Separates tokens.
-
+
comment
Text that the compiler should ignore.
May be a :term:`line comment` or a :term:`block comment`.
-
+
line comment
A sequence of characters beginning with the characters ``//`` (outside of a :term:`string literal` or :term:`comment`) and ending with a newline character U+000A.
-
+
block comment
A sequence of characters beginning with the characters ``/*`` (outside of a :term:`string literal` or :term:`comment`) and ending with the characters ``*/``.