Lookahead

Symbol attributes are established in either definition mode or lookahead mode.

Definition mode occurs whenever a previously undefined symbol is encountered in the name field of a statement, or in the operand field of an EXTRN or WXTRN statement during open code processing. Symbols within a macro definition are defined when the macro is expanded.

Lookahead mode is entered:

Lookahead is a sequential, statement-by-statement, forward scan over the source text.

If the attribute reference is made in a macro, forward scan begins with the first source statement following the outermost macro instruction. During lookahead the assembler:

Lookahead mode ends when the desired symbol or sequence symbol is found, or when the END statement or end of file is reached. All statements read by lookahead are saved on an internal file, and are fully processed when the lookahead scan ends.

If a COPY instruction is encountered during lookahead, it is fully processed at that time, the assembler copies the statements from the library, scans them, and saves them on the lookahead file. When lookahead mode has ended any COPY instructions saved to the lookahead file are ignored, as the statements from the copy member have already been read and saved to the lookahead file.

If a variable symbol is used for the member name of a COPY that is expanded during lookahead, the value of the variable symbol at the time the COPY is expanded is used.

For purposes of attribute definition, a symbol is considered partially defined if it depends in any way upon a symbol not yet defined. For example, if the symbol is defined by a forward EQU that is not yet resolved, that symbol is assigned a type attribute of U.

In this case it is possible that, by the end of the assembly, the type attribute has changed to some other value.