$IMPORT common.msg
The imported file is parsed with the same state: settings it changes stay changed after the $IMPORT, and its messages are part of the module. Its $MODULE, $NAMESPACE or $EXPORT would change the module too — keep those in the main file.
Search order
For a relative name:
- the folder of the importing file,
- the working folder,
- the
mstring -Ifolders, in order.
An absolute name is used as it is. A missing file is an error:
main.msg:2:9: error: import file 'common.msg' does not exist
Rules
- The
$IMPORTline closes the message above it; an imported file starts with no open message. - A file that (directly or indirectly) imports itself is an error:
error: recursive $IMPORT of 'a.msg'. - An error in an imported file is reported at its own position, followed by
error in imported file '…'at the$IMPORTline. - With
mstring_generate(), list imported files underDEPENDSso that editing them regenerates the module.

