RAD Studio |  |

Whitespace
See Also
Collapse All

Whitespace is the collective name given to spaces (blanks), horizontal and vertical tabs, newline characters, and comments. Whitespace can serve to indicate where tokens start and end, but beyond this function, any surplus whitespace is discarded. For example, the two sequences

Copy Code

    int i; float f;

and

Copy Code

    int i;
       float f;

are lexically equivalent and parse identically to give the six tokens:

- int
- i
- ;
- float
- f
- ;

The ASCII characters representing whitespace can occur within literal strings, in which case they are protected from the normal parsing process (they remain as part of the string). For example,
Copy Code

    char name[] = "CodeGear Corporation";

parses to seven tokens, including the single literal-string token "CodeGear Corporation"

Line splicing with \

A special case occurs if the final newline character encountered is preceded by a backslash (\). The backslash and new line are both discarded, allowing two physical lines of text to be treated as one unit.

Copy Code

    "CodeGear \
    Corporation"

is parsed as "CodeGear Corporationl" (see String constants for more information).

See Also

Lexical Elements

Tokens

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!