Compiler module

add_build_string

procedure2 overloadsSource

Adds the source text data to workspace w. Pass code to compile it in the scope that code was written in, so it can see that scope's names.

Example↗
#run {
    w := compiler_create_workspace("strings");
    options := get_build_options(w);
    options.output_type = .NO_OUTPUT;
    set_build_options(options, w);
    add_build_string("answer :: 42; main :: () {}", w);
}

main :: () {}
add_build_string :: (
    data: string,
    w: Workspace,
    code := #code,null,
    loc := #caller_location
)

Parameters

data: string
w: Workspace
code := #code,null
loc := #caller_location
add_build_string :: (
    data: string,
    w: Workspace,
    message: *Message,
    loc := #caller_location
)

Adds the source text data to workspace w, in the scope of the code that message is about, so the new code can see the names around it.

Parameters

data: string
w: Workspace
message: *Message
loc := #caller_location

See also