import { If, Joinpoint, Statement, Switch } from "@specs-feup/clava/api/Joinpoints.js"; type NodeID = string; /** * Specifies whether a MISRA rule is applied to a single translation unit * or requires analysis of the entire program. */ export declare enum AnalysisType { SINGLE_TRANSLATION_UNIT = "single", SYSTEM = "system" } /** * Types of transformations a rule can apply to a AST node. */ export declare enum MISRATransformationType { NoChange = 0, DescendantChange = 1, Replacement = 2, Removal = 3 } export type MISRATransformationResults = Map; /** * Represents a MISRA-C rule violation. */ export declare class MISRAError { /** * Represents the specific MISRA-C rule that was violated */ readonly ruleID: string; /** * The joinpoint where the error was detected */ readonly joinpoint: Joinpoint; /** * Explanation of the violation */ readonly message: string; /** * * @param ruleID Identifier of the violated rule * @param $jp Joinpoint where the error was detected * @param message Description of the error */ constructor(ruleID: string, $jp: Joinpoint, message: string); /** * Checks if two instances of MISRAError are equal based on all properties * @param other * @returns Returns `true` if the errors are the same, `false` otherwise */ equals(other: MISRAError): boolean; /** * Checks if the associated joinpoint is still present in program's AST */ isActiveError(): boolean; } /** * A report of a MISRA transformation, including the transformation type and an optional new joinpoint node. * * If the transformation type is `Replacement`, the `newNode` must be provided to indicate the new joinpoint. */ export declare class MISRATransformationReport { /** * The type of the MISRA transformation */ readonly type: MISRATransformationType; /** * An optional new joinpoint node, provided if the transformation involves a replacement */ readonly newNode?: Joinpoint; /** * * @param type The type of the MISRA transformation * @param newNode The new joinpoint node resulting from the transformation. Required if the transformation type is `Replacement`. */ constructor(type: MISRATransformationType, newNode?: Joinpoint); } /** * Converts a switch statement into either consecutive statements or if statements * - If the switch has only one clause and a default case, it is converted to consecutive statements * - Otherwise, it is converted to if statements */ export declare class MISRASwitchConverter { /** * Converts a switch statement to consecutive statements or if statements * * @param switchStmt - The switch statement to convert * @returns The converted statements or `undefined` if no statements remain */ static convert(switchStmt: Switch): Statement | undefined; /** * Converts a switch with only one clause and a default case into consecutive statements * * @param switchStmt - The switch statement to convert * @returns The first statement or `undefined` if no statements remain */ static convertToConsecutiveStmts(switchStmt: Switch): Statement | undefined; /** * Converts a switch statement into a series of if statements * * @param switchStmt - The switch statement to convert * @returns The first if statement created */ static convertToIfStatements(switchStmt: Switch): If; /** * Creates an if statement for the given consecutive cases * * @param condition - The switch condition * @param cases - A list of consecutive cases * @param index - The index of the current case group * @param lastIfStmt - The last if statement, used to chain else * @returns The new if statement */ private static createIfStatement; /** * Creates the equivalent condition for an if statement based on the case values * * @param condition - The switch condition * @param cases - A list of case` statements * @returns The combined condition */ private static equivalentCondition; /** * Removes all break statements from the given scope * @param scope - The scope from which the break statements will be removed */ private static removeBreakStmts; /** * Removes all case statements from the given scope * @param scope - The scope from which the case statements will be removed */ private static removeCases; /** * Groups case statements into consecutive blocks, ensuring the block with the default case is last * * @param switchStmt - The switch statement * @returns The grouped case statements */ private static consecutiveCases; /** * Organizes case groups such that the group with default case is placed last. * * @param caseGroups - The groups of case statements * @returns The organized case groups */ private static organizeCaseGroups; } export {}; //# sourceMappingURL=MISRA.d.ts.map