PreviousUpNext

10.2.2  String Constants

Mythryl supports C-flavored string constants enclosed in double quotes:

    "this" "that" "the other"

Special escapes supported are:

    "\a"            # Ascii  7 (BEL)
    "\b"            # Ascii  8 (BS)  Backspace
    "\f"            # Ascii 12 (FF)  Formfeed
    "\n"            # Ascii 10 (LF)  Newline
    "\r"            # Ascii 13 (CR)  Carriage-return
    "\t"            # Ascii  9 (TAB) Horizontal tab
    "\v"            # Ascii 11 (TAB) Vertical   tab
    "\\"            # Backslash
    "\""            # Double quote
    "^@" - "^_"     # Control characters starting from NUL (Ascii 0).
    "\000" - "\255" # Character by decimal ascii equivalent.

Nonprinting characters are not permitted within string constants; use one of the provided escapes instead, with the exception that newline is allowed as part of a special construct for multi-line indented string constants:

                 "He wrapped himself in quotations -- as a beggar \
                 \would enfold himself in the purple of Emperors."

The above is equivalent to

                 "He wrapped himself in quotations -- as a beggar would enfold himself in the purple of Emperors."

String constants are of type String.

Strings may also be quoted using the constructs .’foo’, ./foo/, .|foo|, .<foo> and .#foo#. In all cases the only escape supported in these constructs is doubling of the terminator character to include it within the quoted string. These constructs expand into calls to (respectively) dot__quotes, dot__slashets, dot__barets, dot__brokets, and dot__hashets. Each of these is by default defined as the identity function which simply returns its argument; they may be redefined to create values of any desired type from their string argument.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext