import { wrapMinimal } from '../utils.js';
export function parseComRust(codigo) {
    const functions = Array.from(codigo.matchAll(/\bfn\s+([A-Za-z0-9_]+)/g)).map(m => m[1]);
    const structs = Array.from(codigo.matchAll(/\bstruct\s+([A-Za-z0-9_]+)/g)).map(m => m[1]);
    const enums = Array.from(codigo.matchAll(/\benum\s+([A-Za-z0-9_]+)/g)).map(m => m[1]);
    const traits = Array.from(codigo.matchAll(/\btrait\s+([A-Za-z0-9_]+)/g)).map(m => m[1]);
    const impls = Array.from(codigo.matchAll(/\bimpl\s+([A-Za-z0-9_<>]+)/g)).map(m => m[1]);
    const uses = Array.from(codigo.matchAll(/^use\s+([A-Za-z0-9_:*{}]+);/gm)).map(m => m[1]);
    const typeAliases = Array.from(codigo.matchAll(/\btype\s+([A-Za-z0-9_]+)\s*=/g)).map(m => m[1]);
    const consts = Array.from(codigo.matchAll(/\bconst\s+([A-Za-z0-9_]+)\s*:/g)).map(m => m[1]);
    const statics = Array.from(codigo.matchAll(/\bstatic\s+([A-Za-z0-9_]+)\s*:/g)).map(m => m[1]);
    const macros = Array.from(codigo.matchAll(/^([A-Za-z0-9_]+)!\(/gm)).map(m => m[1]);
    const mods = Array.from(codigo.matchAll(/^mod\s+([A-Za-z0-9_]+)/gm)).map(m => m[1]);
    const lifetimes = [...new Set(Array.from(codigo.matchAll(/'([a-z_]+)/g)).map(m => m[1]))];
    const unsafeBlocks = (codigo.match(/\bunsafe\s*\{/g) || []).length;
    const attributes = Array.from(codigo.matchAll(/^#\[([A-Za-z0-9_(), ]+)\]/gm)).map(m => m[1]);
    const implMethods = Array.from(codigo.matchAll(/impl\s+(\w+(?:<[^>]+>)?)\s*\{([^}]*)\}/gs)).map(m => {
        const implFor = m[1];
        const bodyMethods = Array.from(m[2].matchAll(/\bfn\s+([A-Za-z0-9_]+)/g)).map(n => n[1]);
        return { implFor, methods: bodyMethods };
    });
    const generics = [...new Set(Array.from(codigo.matchAll(/<([A-Z][A-Za-z0-9_]*)(?:\s*:\s*[^>]+)?>/g)).map(m => m[1]))];
    return wrapMinimal('rust', {
        functions,
        structs,
        enums,
        traits,
        impls,
        implDetails: implMethods,
        uses,
        typeAliases,
        consts,
        statics,
        macros,
        mods,
        lifetimes,
        generics,
        unsafeBlocks,
        attributes
    });
}
//# sourceMappingURL=rust.js.map