"""Cython and C keyword sets for identifier escaping.

Cython keywords that conflict with C/C++ identifiers must be escaped
with a trailing underscore (e.g., ``class`` -> ``class_``). C keywords
are excluded from escaping because they are either valid type identifiers
or would have been rejected by the C preprocessor before reaching us.
"""

from __future__ import annotations

# Cython keywords obtained from cython/Cython/Parser/Grammar
cython_keywords: list[str] = [
    "DEF",
    "ELIF",
    "ELSE",
    "False",
    "IF",
    "None",
    "True",
    "and",
    "api",
    "as",
    "assert",
    "async",
    "await",
    "break",
    "by",
    "cdef",
    "char",
    "cimport",
    "class",
    "complex",
    "const",
    "continue",
    "cpdef",
    "cppclass",
    "ctypedef",
    "def",
    "del",
    "double",
    "elif",
    "else",
    "enum",
    "except",
    "exec",
    "extern",
    "finally",
    "for",
    "from",
    "fused",
    "gil",
    "global",
    "if",
    "import",
    "in",
    "int",
    "is",
    "lambda",
    "long",
    "namespace",
    "new",
    "nogil",
    "nonlocal",
    "not",
    "or",
    "pass",
    "print",
    "public",
    "raise",
    "readonly",
    "return",
    "short",
    "signed",
    "sizeof",
    "struct",
    "try",
    "typeid",
    "union",
    "unsigned",
    "while",
    "with",
    "yield",
]

C_keywords: list[str] = [
    "auto",
    "break",
    "case",
    "char",
    "const",
    "continue",
    "default",
    "do",
    "double",
    "else",
    "enum",
    "extern",
    "float",
    "for",
    "goto",
    "if",
    "int",
    "long",
    "register",
    "return",
    "short",
    "signed",
    "sizeof",
    "static",
    "struct",
    "switch",
    "typedef",
    "union",
    "unsigned",
    "void",
    "volatile",
    "while",
]

# Cython-only keywords (C keywords excluded since they are valid type
# identifiers or would already be rejected by the C preprocessor).
keywords: set[str] = set(cython_keywords) - set(C_keywords)
