Character literal expressions

Sather - Language Specification
Prev | Chapter 6. Literal Expressions | Next

# 6.2. Character literal expressions

Example 6-3. Examples:

    'a'
    '\n'
    '\016'

    char_literal_expression ==>
            ' (ISO_character | \ escape_seq) '

    escape_seq ==>
            a | b | f | n | r | t | v | \ | ' | " | octal_digit {octal_digit}

CHAR objects represent characters (See Type). Character literal expressions begin and end with single quote marks. These may enclose either any single ISO-Latin-1 printing character except single quote or backslash or an escape code starting with a backslash.

The escape codes are interpreted as follows: '\a' is an alert such as a bell, '\b' is the backspace character, '\f' is the form feed character, '\n' is the newline character, '\r' is the carriage return character, '\t' is the horizontal tab character, '\v' is the vertical tab character, '\\' is the backslash character, '\'' is the single quote character, and '\"' is the double quote character. A backslash followed by one or more octal digits represents the character whose octal representation is given. A backslash followed by any other character is that character. The mapping of escape codes to other characters is defined by the Sather implementation.

Prev | Home | Next
Literal Expressions | Up | String literal expressions