5.1.1.4 line Directive

The assembler program parser supports the ‘line’ directive and uses information changed by it when printing error, warning, and note messages. You can put that directive in an assembler program explicitly, or the assembler preprocessor (see Using the Assembler Preprocessor) may generate it. The ‘line’ directive can change the current line number in the source file, the name of that source file, the stack of include locations, and the stack of macro expansion locations tracked by the assembler program parser.

The directive must be on a single line after at least one whitespace character at the beginning of the line and should have one of the following formats:

        line    line_number
        line    line_number, file_name
        line    line_number, file_name, push_file
        line    line_number, file_name, pop_file
        line    line_number, file_name, push_macro, macro_name
        line    line_number, file_name, pop_macro, macro_name

Below there are descriptions of the formats.

line line_number

This directive changes tracked number of the next line in the current source file to line_number.

Example:

        line    10

This example sets the number of the next line in the current source file to 10. By default, subsequent lines will have numbers 11, 12, and so on.

line line_number, file_name

This directive changes tracked number of the next line to line_number and changes tracked name of the current source file to file_name. The argument file_name must be a (quoted) string literal. If file_name is an empty string (""), the current source file is the outermost source file processed by the assembler program parser.

Example:

        line    10, "grammar.rg"

This example sets the number of the next line in the current source file to 10 and the name of the current source file to ‘grammar.rg’.

line line_number, file_name, push_file

This directive changes tracked number of the next line to line_number, changes tracked name of the current source file to file_name, and notifies about the beginning of processing that file as an include file. The argument file_name must be a (quoted) string literal.

Example:

        line    1, "incl.asm", push_file

This example notifies about the beginning of processing the include file ‘incl.asm’. The next line after this directive will be line 1 of that include file.

line line_number, file_name, pop_file

This directive changes tracked number of the next line to line_number, changes tracked name of the current source file to file_name, and notifies about the end of processing an include file. The argument file_name must be a (quoted) string literal and must be equal to the name of a file containing the include file. If file_name is an empty string (""), the containing file is the outermost source file processed by the assembler program parser.

Example:

        line    3, "", pop_file

This example notifies about the end of processing an include file and continuing processing the outermost source file at line 3.

line line_number, file_name, push_macro, macro_name

This directive changes tracked number of the next line to line_number, changes tracked name of the current source file to file_name, and notifies about the beginning of processing an expansion of a macro macro_name. The arguments file_name and macro_name must be quoted string literals. If file_name is an empty string (""), the current source file is the outermost source file processed by the assembler program parser.

Example:

       line    15, "", push_macro, "m1"

This example notifies about the beginning of processing an expansion of ‘m1’ macro defined in the outermost source file. The first line of the expansion is file line 15 located in the macro definition.

line line_number, file_name, pop_macro, macro_name

This directive changes tracked number of the next line to line_number, changes tracked name of the current source file to file_name, and notifies about the end of expanding a macro called from a macro macro_name. The arguments file_name and macro_name must be quoted string literals. The argument file_name must be equal to the name of a source file containing the definition of a macro macro_name. If file_name is an empty string (""), the current source file is the outermost source file processed by the assembler program parser. If macro_name is an empty string (""), the containing macro is the outermost assembler program.

Example:

        line   25, "", pop_macro, "m0"

This example notifies about the end of expanding a macro from the macro ‘m0’ defined in the outermost source file. The next line after the macro expansion in ‘m0’ is line 25.