Sourcetype parse_state =
  1. | Expect_slash
  2. | Accumulate_literal of {
    1. start_pos : int;
    2. len : int;
    }
  3. | Accumulate_template of {
    1. start_pos : int;
    2. len : int;
    }
Sourceexception Path_syntax of {
  1. msg : string;
  2. path : string;
}
Sourceval raise_syntax : path:string -> string -> 'a
Sourcetype t = [
  1. | `FieldPattern of string
  2. | `Literal of string
]
Sourceval pp : Restapis_o.Open__.Format.formatter -> t -> unit
Sourceval show : t -> string
Sourceval compare : t -> t -> int
Sourceval create : string -> [> `FieldPattern of string | `Literal of string ] list
Sourceval prio : [< `FieldPattern of 'a | `Literal of 'b ] list -> int

Get the priority.

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#paths-object > When matching URLs, concrete (non-templated) paths would be matched > before their templated counterparts.

Less priority numbers are on the top of the priority queue. So priority number = # of template segments in path.

Routes.(s "foo" / int / s "add" / bool) ==> foo/:int/add/:bool which is two template segments (int and bool).

include DkCoder_Std.SCRIPT
Sourceval __init : DkCoder_Std.Context.t -> unit

__init context is the entry point for running a script module. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __init does nothing, while the bottom __init calls the prior __init.

That means:

  1. calling the __init function guarantees that the script module is initialized; that is, all of the script module's side-effects (ex. let () = Format.printf "Hello world@.") are executed before the __init returns to the caller.
  2. you can override the __init function by simply defining the __init idempotently. That will shadow the top __init and when the bottom __init is executed your __init will be called instead of the do-nothing top __init.

Future versions of DkCoder will call __init in dependency order for all `You script modules. Your __init function may be called several times.

Sourceval __repl : DkCoder_Std.Context.t -> unit

__repl context is the entry point for debugging a script module in a REPL. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __repl does nothing, while the bottom __repl calls the prior __repl.

That means:

  1. you can override the __repl function by simply defining the __repl idempotently. That will shadow the top __repl and when the bottom __repl is executed your __repl will be called instead of the do-nothing top __repl.
Sourceval __module_info : unit -> DkCoder_Std.ModuleInfo.t

The run-time module information for the script module.