syster-base 0.4.0-alpha

Core library for SysML v2 and KerML parsing, AST, and semantic analysis
Documentation
//! Keyword definitions extracted from KerML and SysML grammars

/// KerML (foundation) keywords for code completion
pub const KERML_KEYWORDS: &[&str] = &[
    // Type keywords
    "classifier",
    "datatype",
    "class",
    "struct",
    "assoc",
    "type",
    "feature",
    "metaclass",
    "behavior",
    "function",
    "predicate",
    "interaction",
    // Structural keywords
    "package",
    "namespace",
    "library",
    "import",
    "alias",
    "member",
    "abstract",
    "const",
    "derived",
    "composite",
    "portion",
    "ordered",
    "nonunique",
    "public",
    "private",
    "protected",
    "standard",
    // Relationship keywords
    "specializes",
    "specialization",
    "subclassifier",
    "subtype",
    "subsets",
    "subset",
    "redefines",
    "redefinition",
    "conjugates",
    "conjugation",
    "conjugate",
    "typing",
    "typed",
    "chains",
    "inverting",
    "inverse",
    "differs",
    "differences",
    "disjoint",
    "disjoining",
    "intersects",
    "unions",
    "binding",
    "connector",
    "featured",
    "featuring",
    "dependency",
    "succession",
    // Feature keywords
    "in",
    "out",
    "inout",
    "hastype",
    "istype",
    // Control keywords
    "if",
    "then",
    "else",
    "for",
    "and",
    "or",
    "xor",
    "not",
    "implies",
    // Metadata keywords
    "doc",
    "comment",
    "metadata",
    "about",
    "language",
    "locale",
    // Other keywords
    "true",
    "false",
    "null",
    "all",
    "expr",
    "bool",
    "return",
    "filter",
    "first",
    "step",
    "from",
    "by",
    "of",
    "to",
    "as",
    "end",
    "inv",
    "rep",
    "flow",
    "crosses",
    "default",
    "meta",
    "multiplicity",
    "new",
    "var",
    "variation",
];

/// All SysML keywords for code completion
pub const SYSML_KEYWORDS: &[&str] = &[
    // Definition keywords
    "part def",
    "port def",
    "action def",
    "state def",
    "constraint def",
    "requirement def",
    "attribute def",
    "connection def",
    "interface def",
    "allocation def",
    "item def",
    "occurrence def",
    "analysis def",
    "case def",
    "verification def",
    "use case def",
    "view def",
    "viewpoint def",
    "rendering def",
    "metadata def",
    "enum def",
    // Usage keywords
    "part",
    "port",
    "action",
    "state",
    "constraint",
    "requirement",
    "attribute",
    "connection",
    "interface",
    "allocation",
    "item",
    "occurrence",
    "analysis",
    "case",
    "verification",
    "use case",
    "view",
    "ref",
    "individual",
    "variation",
    "snapshot",
    "timeslice",
    // Structural keywords
    "package",
    "library",
    "import",
    "alias",
    "abstract",
    "constant",
    "derived",
    "ordered",
    "nonunique",
    "public",
    "private",
    "protected",
    // Relationship keywords
    "specializes",
    "subsets",
    "redefines",
    "references",
    "conjugate",
    "defined by",
    // Flow keywords
    "in",
    "out",
    "inout",
    "flow",
    "succession",
    "message",
    // Control keywords
    "if",
    "then",
    "else",
    "for",
    "while",
    "loop",
    "decide",
    "merge",
    "fork",
    "join",
    "accept",
    "send",
    "return",
    "bind",
    // Requirement keywords
    "require",
    "assume",
    "satisfy",
    "verify",
    "subject",
    "actor",
    "stakeholder",
    "objective",
    "concern",
    // Metadata keywords
    "doc",
    "comment",
    "metadata",
    "about",
    // Other keywords
    "true",
    "false",
    "null",
    "all",
    "when",
    "at",
    "during",
    "first",
    "after",
    "until",
];

/// Relationship operator keywords
pub const RELATIONSHIP_OPERATORS: &[&str] = &[
    ":",   // Typing
    ":>",  // Specialization
    ":>>", // Redefinition
    "::>", // Subsetting
];

/// Get appropriate keywords based on file extension
pub fn get_keywords_for_file(path: &std::path::Path) -> &'static [&'static str] {
    match path.extension().and_then(|e| e.to_str()) {
        Some("kerml") => KERML_KEYWORDS,
        Some("sysml") => SYSML_KEYWORDS,
        _ => SYSML_KEYWORDS, // Default to SysML
    }
}