module Noir::TreeSitterHelidonSeExtractor

Overview

Tree-sitter-backed walker for Helidon SE's functional routing DSL.

Helidon SE has two route-registration shapes that both have to be covered:

  1. Inline verb calls directly on a HttpRouting.Builder / HttpRules receiver: routing.get("/x", (req, res) -> ...), chained or nested inside a lambda passed to .routing(...).
  2. Modular services: a class implements HttpService overrides routing(HttpRules rules) with its own verb calls, and is mounted elsewhere via someBuilder.register("/prefix", new MyService()). The quickstart/example apps published by the Helidon project overwhelmingly use this shape — Main composes routing by registering one HttpService per resource, in a totally separate class (often a separate file).

Shape 2 is genuinely cross-class (and often cross-file), so this extractor does not try to resolve the full prefix here. Instead it reports, per file:

The analyzer aggregates routes/edges across every Helidon file in a project root and resolves the prefix graph there (classes are matched by simple name, project-root scoped — the same approximation TreeSitterMicronautExtractor's interface-route index and TreeSitterJvmLambdaDslExtractor's method-reference index already make).

Extended Modules

Defined in:

miniparsers/helidon_se_extractor_ts.cr

Constant Summary

COOKIE_ACCESSORS = Set {"get", "first", "all", "getAll", "contains"}
EMPTY_CONSTANTS = {} of String => String
HEADER_ACCESSORS = Set {"get", "first", "value", "contains"}
QUERY_ACCESSORS = Set {"get", "first", "all", "contains"}
VERB_METHODS = {"get" => "GET", "post" => "POST", "put" => "PUT", "delete" => "DELETE", "head" => "HEAD", "options" => "OPTIONS", "patch" => "PATCH", "trace" => "TRACE", "any" => "ANY"}

Helidon's fluent verb API: HttpRules/HttpRouting.Builder both expose the same method names. any matches every HTTP method — kept as the literal "ANY" verb, same convention as Ring/Compojure/ Pedestal/Wisp/Cowboy in this codebase rather than exploding it into one endpoint per concrete verb.

Instance Method Summary

Instance Method Detail

def extract(source : String, *, include_callees : Bool = false) : FileResult #

[View source]
def normalize_path(path : String) : String #

Helidon path-parameter syntax: {name}, {name:regex} (typed / regex-constrained segment) and {+name} (matches multiple path segments). All three name the same logical parameter — normalize down to the plain {name} the rest of noir (and the shared path-parameter optimizer pass) expects.


[View source]