Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-mcp

Model Context Protocol server for Pudu language documentation and compiler tools

0.1.1Apache-2.01

InstallClose

Uri.md

Markdown61 lines1.3 KB

GitHub ↗

Uri


type: module path: "@root/src/PuduLangMcp/Utils/Uri.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.35 depth_status: SHALLOW coupling: 0 interface_stability: 0.9 tags: [module, shallow] aliases: [Uri]


Purpose

Convert between absolute file paths and the file:// URIs a language server speaks, and between pudu:// resource URIs and their parts.

Interface

Signatures

export fn fileUri(path: Str) -> Str
export fn pathOfFileUri(uri: Str) -> Option[Str]
export fn resourcePath(uri: Str, scheme: Str) -> Option[Str]   // "pudu://docs/x", "pudu://" → "docs/x"

Linkage

  • Requires: Std.Text.
  • Consumed by: [[src/PuduLangMcp/Domain/Lsp/Conversation]], [[src/PuduLangMcp/Domain/Lsp/Render]], [[src/PuduLangMcp/App/Resources]].

Algorithm

fileUri percent-encodes space, %, #, and ? and prefixes file://. pathOfFileUri reverses exactly those escapes. resourcePath strips the scheme prefix when present.

Negative Logic (Prohibited Paths)

  • No general URL parser: only the characters the compiler's paths can contain are handled.

Edge Cases

  • pathOfFileUri("http://x") is None.

Depth

DEPTH 0.35.

Grill Log

  • Q: Full RFC 3986 encoding? A: No; the language server compares URIs it was given, so round-tripping our own encoding is what matters.

Referenced by

[[src/PuduLangMcp/Utils/_MOC]]