class

Analyzer::Rust::Rwf

Inherits Analyzer::Rust::RustEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

RWF analyzer (tree-sitter port). RWF registers routes in a handful of shapes, all handled here:

route!("/path" => Controller) single route; the controller's Controller impl handle body enumerates verbs + params. crud!("/path" => Controller) six RESTful routes (the rest!("/path" => Controller) RestController/ModelController convention). Controller.route("/path") the same three as method calls Controller::new().rest("/p") (no macro), plus controller.wildcard("/path") a catch-all mount.

Registrations almost always sit inside Server::new(vec![ ... ]) / Engine::new(vec![ ... ]). tree-sitter leaves a vec! body as a flat token_tree with no macro_invocation / call_expression nodes, so we re-parse each route-bearing macro body as an expression fragment and scan it too, mapping line numbers back onto the file.

Constants

HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"] of ::String
REST_ROUTES = [{"", "GET"}, {"", "POST"}, {"/:id", "GET"}, {"/:id", "PUT"}, {"/:id", "PATCH"}, {"/:id", "DELETE"}]

crud! / rest! register the standard REST surface. :id is the resource identifier param RWF uses for the member routes.

ROUTE_MACRO_EVIDENCE_RE = Regex.union("route", "crud", "rest", "wildcard")

Precompiled union for collect_route_macro_fragments' per-macro evidence gate, so it costs a single PCRE2 match instead of four naive substring scans.

Class methods

tech_name
Source

Instance methods

analyze_file(path : String) : Array(Endpoint)
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types