4.7 noline statement - disabling #line directives

By default, Propane emits #line directives into the generated output around user code blocks. These directives instruct the compiler to report any warnings or errors in the user code using the file name and line number of the original grammar file, rather than the generated output file. This makes it easier to locate the source of a compiler diagnostic in the grammar file.

The noline statement disables the emission of these #line directives.

noline;

When the noline statement is present, user code blocks are copied to the generated output without any surrounding #line directives. This can be useful when debugging the generated parser itself, or when the #line directives interfere with other tooling.

Rust has no #line directive equivalent. For a Rust target, Propane instead emits a comment before and after each section of user code naming the grammar file and the line number the code was taken from:

/* Begin user code from myparser.propane line 42. */
  let mut v: i64 = 0;
/* End user code from myparser.propane line 42. */

A compiler diagnostic that points into the generated Rust module can be traced back to the grammar by reading up to the nearest such comment. The noline statement suppresses these comments for a Rust target, in the same way that it suppresses #line directives for the other targets.