Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Epsilon Extension Language
      . . .
      The EEL Preprocessor
      Lexical Rules
         Identifiers
         Numeric Constants
         Character Constants
         String Constants
      Scope of Variables
      . . .

Previous   Up    Next
Numeric Constants  Epsilon Extension Language   String Constants


Epsilon User's Manual and Reference > Epsilon Extension Language > Lexical Rules >

Character Constants

Text enclosed in single quotes as in 'a' is a character constant. The type of a character constant is int. Its value is the ASCII code for the character. Instead of a single character, an escape sequence can appear between the quotes. Each escape sequence begins with a backslash, followed by a character from the following table. A backslash followed by any other character represents that character.

The special escape sequences are:

 \n  newline character, ^J
 \b  backspace character, ^H
 \t  tab character, ^I
 \r  return character, ^M
 \f  form feed character, ^L
 \yyy  character with ASCII code yyy octal
 \xhh  character with ASCII code hh hexadecimal
 \uhhhh  character with code hhhh hexadecimal
 \u{h}  character with code h hexadecimal
 \u[name]  character with given Unicode name

For example, '\'' represents the ' character, '\\' represents the \ character, '\0' represents the null character, and '\n', '\12', and '\x0A', all represent the newline character (whose ASCII code is 12 in octal notation, base 8, and 0A in hexadecimal, base 16).

The \u sequence is followed by four hex digits, while the \x sequence is followed by only two, and so can only represent low-numbered characters. Enclose the hex digits in curly braces to directly mark the end of the hex number; one to four hex digits can appear within. The square bracket syntax recognizes any standard Unicode character name, such as Greek Capital Letter Alpha. These sequences are all equivalent: \u[Greek Capital Letter Alpha], \u0391, \u{391}.

Anywhere a numeric constant is permitted, so is a character constant, and vice versa.



Previous   Up    Next
Numeric Constants  Epsilon Extension Language   String Constants


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.