Exemplo n.º 1
0
def pascal_name(name: str) -> str:
    """Transform a method, or class name into a valid one for C#"""
    candidate = pascal_case(name)
    if candidate in ("Main", "Program", "System", "Console", "Array",
                     "String"):
        return candidate + "_"
    return candidate
Exemplo n.º 2
0
def struct_name(name: str) -> str:
    """Transform a struct name into a valid one for Julia"""
    candidate = pascal_case(name)
    if candidate in RESERVED:
        return candidate + "_"
    return candidate
Exemplo n.º 3
0
def class_name(name: str) -> str:
    """Transform a class name into a valid one for Python"""
    candidate = pascal_case(name)
    return candidate + "_" if candidate == "List" else candidate
Exemplo n.º 4
0
def struct_name(name: str) -> str:
    """Transform a struct name into a valid one for C++"""
    return pascal_case(name)
Exemplo n.º 5
0
def struct_name(name: str) -> str:
    """Transform a struct name into a valid one for Go"""
    candidate = pascal_case(name)
    if candidate in KEYWORDS:
        return candidate + "_"
    return candidate
Exemplo n.º 6
0
def class_name(name: str) -> str:
    """Transform a class name into a valid one for Java"""
    candidate = pascal_case(name)
    if candidate in ("Main", "Integer", "String", "System"):
        return candidate + "_"
    return candidate
Exemplo n.º 7
0
def var_name(name: str) -> str:
    """Transform a variable name into a valid one for Pascal"""
    candidate = pascal_case(name)
    if candidate.lower() in KEYWORDS:
        return candidate + "_"
    return candidate
Exemplo n.º 8
0
def var_name(name: str) -> str:
    """Transform a variable name into a valid one for Prolog"""
    return pascal_case(name)
Exemplo n.º 9
0
def struct_name(name: str) -> str:
    """Transform a struct name into a valid one for D"""
    # https://dlang.org/dstyle.html#naming_classes
    candidate = pascal_case(name)
    return candidate