10.2. Tokens

There are several types of tokens: identifiers, keywords, literals and special symbols, such as operators and punctuation. Blanks, horizontal and vertical tabs, new-lines, form-feeds and comments (as described below), collectively called whitespace, serve to separate tokens and are ignored otherwise.

10.2.1. Comments

As in the C++, the characters /* start a comment that terminates with the characters */ and the characters // start a comment that terminates at the end of the line on which they occur. /* */ comments do not nest. The characters //, /* and */ do not have any special meaning within a // comment, and the characters // and /* have no special meaning within a /* */ comment.

10.2.2. Identifiers

An identifier is a sequence of alphanumeric and underscore characters. The first character must be alphabetic or underscore. All characters are significant. Identifiers are case-sensitive.

There is only one namespace for IDL identifiers in each scope. Using the same identifier for a class and an enumaration type in the same scope, for example, is an error.

10.2.3. Keywords

IDL keywords are identifiers that have a special meaning within given scope. Keywords are not globally reserved, the following IDL is legal:

#import "core.idl"

enum property { }

class method : Massiv::Core::Object
    {
    property uint32 property;
    property bool class;
    property bool weak_pointer;
    method method();
    }

However, if C++ reserved words are used as identifiers, corresponding C++ definitions will be illegal and the generated sources won't compile.

10.2.4. Literals

This section describes the following literals: integers, floating-point numbers, characters and strings.

10.2.4.1. Integer Literals

Integer literals can be specified in on of the following forms:

  • decimal (base 10): Sequence of digits that does not begin with 0 (digit zero).

  • hexadecimal (base 16): 0x followed by a sequence of digits and a to f or A to F characters representing number ten to fifteen.

  • binary (base 2): 0b followed by a sequence of 0 and 1 (digits zero and one).

  • octal (base 8): 0 followed by a sequence of 0 to 7 (digits zero to seven).

10.2.4.2. Floating-point Literals

A floating-point literal consists of an integer part, a decimal point, a fraction part, an e or E, and an optionally signed integer exponent. The integer and fraction parts both consist of a sequence of decimal digits. Either the integer part or the fraction part (but not both) may be missing. Either the decimal point or the exponent (including the e or E character), but not both, may be missing. If both the decimal point and the exponent are missing, the literal is interpreted as a integer literal.

10.2.4.3. Character Literals

Single character enclosed in single quote (') characters is a character literal. No escape sequences are supported in the character literals. While the parser recognizes character literals, they are not used in the IDL at all.

10.2.4.4. String Literals

String literal is a sequence of characters enclosed in double quote (") characters. Escape sequences inside the double quotes are recognized, but not interpreted by the parser. For example token "foo\"bar" will be parsed as a single string, but the \ character will be retained in the string.