Scanner contains functions that processes source files, extracts tokens and processes compiler directives.

Processing Source Line Characters

The NextNonCommentCharacter function reads and processes characters from the source line buffer. It returns pointer to the next non-comment character.

Processing Comments and Compiler Directives

This procedure processes compiler directives and skips comment. Here also conditional compilation directives (with support for nested directives) are processed.

Conditional Defines

Turbo Pascal contains few procedures and functions that create and check conditional defines.

Extracting Tokens

Parser operates only with tokens - basic elements of the language. Tokens like identifiers and constants have also additional data structures where actual data is stored.

Processing Integer Constants

These two functions check and process decimal and hexadecimal integer constants. The value is stored in the IntegerNumericConstant variable.

Processing String Constants

This function checks and processes string constants. It processes characters enclosed with single quotes, control characters and characters defined with the ASCII code (#code).

Checking For Special Words

Turbo Pascal uses few special words as directives for special functions: ABSOLUTE, ASSEMBLER, EXTERNAL, FAR, FORWARD, INTERRUPT, NEAR, PRIVATE, PUBLIC, VIRTUAL and System as unit name.

Comparing Identifiers

This function case insensitive compares two identifiers and returns false if they are not equal. Otherwise returns true and Id2 points to byte after its end.

© 2021 Turbo Pascal | Privacy Policy