Skip to main content

Module preprocess

Module preprocess 

Source
Expand description

The preprocessor. Spec §3.4.

Directives reach here as trivia — the lexer recognises a # line and keeps it, without interpreting it. This module reads them, resolves includes, expands macros, and produces a token stream in which every token knows where it textually came from and which macros produced it.

An include cycle is diagnosed, not followed.

IDL 4.2 §7.3: “IDL shall be preprocessed according to the specification of the preprocessor in ISO/IEC 14882:2003.” That is object-like and function-like macros (§16.3) with # and ## (§16.3.2, §16.3.3), the rescan and its hide sets (§16.3.4), #if over a full integral constant expression (§16.1), #line (§16.4), #error (§16.5), __LINE__ and __FILE__ (§16.8), and lines continued with a backslash (§2.1). __DATE__ and __TIME__ are left to the caller’s defines: a front end that stamps the clock into what it reads gives a different unit on every run.

Modules§

macro_
Macro definitions and their use sites. Spec §3.4.

Structs§

FileId
Which file a piece of text came from.
MemoryLoader
A loader over an in-memory set of files.
Origin
Where one expanded token came from.
Preprocessed
The expanded token stream and where it came from.
Provenance
Where a node of the model was written (Preprocessed::provenance).
ProvenanceMacro
One macro expansion of a Provenance.
SourceFile
A file the preprocessor read.
SourceMap
Where every token of the expanded stream came from.

Traits§

FileLoader
How the preprocessor finds an included file.

Functions§

preprocess
Run the preprocessor over source, named path.
preprocess_with
As preprocess, with macros the caller defined.