Compiler

vader/tools/dap

2 files vader/tools/dap/main.vader, vader/tools/dap/protocol.vader 5 exports

Types

DapProgram :: struct

A compiled launch target. state == null marks a front-end failure: the server then reports error as stderr output and terminates without running.

Fields

state: VmState | null

Prepared VM state, or null when the target failed to compile.

entry_index: i32

Entry fn index for exec_entry (the named file's main).

error: string

Human-readable diagnostics rendered on a compile failure ; "" on success.

Functions

run_dap_server :: fn(compile: fn(string) -> DapProgram) -> i32

Run the DAP server loop on stdio until disconnect (or EOF).

compile is injected by cli::cmd_dap so vader/tools/dap doesn't import vader/tools/cli (which would close an import cycle): it maps a launch-target path to its compiled DapProgram.

Parameters

compilefn(string) -> DapProgram compiles a launch-target path to a DapProgram.

Returns

i32 0 on a clean shutdown, 1 on a transport error.
encode_response :: fn(seq: i32, request_seq: i32, command: string, success: bool, body: JsonValue) -> string

Encode a DAP response frame body : { seq, type: "response", request_seq, success, command, body }.

Parameters

seqi32 this message's monotonic sequence number.
request_seqi32 the seq of the request being answered.
commandstring the request's command (echoed back).
successbool whether the request succeeded.
bodyJsonValue command-specific result payload (use empty_body() when the command carries none).

Returns

string the serialized JSON, ready for write_frame.
encode_event :: fn(seq: i32, event: string, body: JsonValue) -> string

Encode a DAP event frame body : { seq, type: "event", event, body }.

Parameters

seqi32 this message's monotonic sequence number.
eventstring the event name (initialized, output, terminated, …).
bodyJsonValue event-specific payload (empty_body() when none).

Returns

string the serialized JSON, ready for write_frame.
empty_body :: fn() -> JsonValue

An empty JSON object: the body for commands / events that carry none.

Returns

JsonValue
Written by vader doc. Icons: Codicons, CC BY 4.0. Fonts: Atkinson Hyperlegible, JetBrains Mono, OFL.