Compile#
Compiling#
compile#
def compile(source_text: str, *, file: str = "<input>", search_path: _Paths | None = None, dialect_files: _Paths = ()) -> bytes
Compiles DS source text to .dsc bytes, for load_dsc.
_Paths is an Iterable of str or os.PathLike[str].
Argument |
Holds |
|---|---|
|
the name diagnostics and the artefact give the source |
|
the directories imports resolve in; by default none |
|
dialect definitions registered before compiling, in the order given |
Raises |
Condition |
|---|---|
|
|
|
no |
|
a |
|
|
|
|
|
|
dsc = pyds.compile("use default\n", file="a.ds")
engine.load_dsc(dsc)
(Source: bindings/python/src/pyds/init.py)
compile_file#
def compile_file(path: str | os.PathLike[str], *, search_path: _Paths | None = None, dialect_files: _Paths = ()) -> bytes
Compiles a .ds file to .dsc bytes.
dsc reads the file itself. search_path is by default the file’s own directory, and () searches nowhere. dialect_files is as for compile.
Raises |
Condition |
|---|---|
|
|
|
no |
|
the file cannot be opened; a |
|
|
|
a path holds a NUL |
(Source: bindings/python/src/pyds/init.py)
from_source#
def from_source(source_text: str, *, file: str = "<input>", dialect_files: _Paths = ()) -> Engine
Compiles DS source text with compile, and returns a new Engine with it loaded.
(Source: bindings/python/src/pyds/init.py)
Compiler#
Which dsc runs#
These functions run the first of:
the path in the environment variable
DS_MERCURY_DSC, if set and not empty;the
dscbundled atpyds/bin/dsc, if the file is there;dsconPATH.
(Source: bindings/python/src/pyds/init.py)