Skip to main content

Module lang

Module lang 

Source
Expand description

Language abstraction (ADR 0015).

The tool must eventually support every language. This module is the seam: a Language plugin can override how line content is normalised for shape classification. Everything defaults to the generic behaviour, so with no plugins registered the engine behaves exactly like the validated milestone-1 normaliser (the parity test enforces this).

Normalisation only. Symbol extraction used to hang off this trait too. It is a different use case with different consumers, so it has its own port (artefact::symbols) — one trait serving two unrelated needs is the merged supertrait CLAUDE.md rule 4 forbids.

Languages never see enumeration: which files and hunks exist is decided before this module is consulted (ADR 0005/0012). They only influence classification.

Modules§

generic
The generic line normaliser — deliberately identical to the validated prototype (same regexes, same order), so shape-class populations stay byte-comparable with its recorded outputs. Do not “improve” this in place: behaviour changes belong in a language plugin with its own id (ADR 0015).

Structs§

Generic
The generic fallback: claims every file, uses the default normaliser.
LanguageRegistry
Ordered set of language plugins with a guaranteed generic fallback.

Traits§

Language
A language plugin. Every method has a working generic default, so a new language implements only what it improves on.