示例#1
0
    if they're absent.
    """
    return Opt(*rules).error()


def end_liblevel_block():
    return recover("end", Opt(A.static_name))


def end_named_block():
    return recover("end", Opt(A.identifier))


A.add_rules(
    parent_list=List(A.static_name, sep="and", list_cls=ParentList),
    protected_type_decl=ProtectedTypeDecl(L.Identifier(match_text="protected"),
                                          "type", A.identifier,
                                          Opt(A.discriminant_part),
                                          A.aspect_spec, "is",
                                          Opt("new", A.parent_list,
                                              "with"), A.protected_def, sc()),
    protected_op=Or(A.subp_decl, A.entry_decl, A.aspect_clause, A.pragma),
    protected_el=Or(A.protected_op, A.component_decl),
    protected_def=ProtectedDef(
        PublicPart(List(A.protected_op, empty_valid=True, list_cls=DeclList)),
        Opt(
            "private",
            PrivatePart(
                List(A.protected_el, empty_valid=True, list_cls=DeclList))),
        end_named_block()),
    protected_decl=SingleProtectedDecl(L.Identifier(match_text="protected"),
示例#2
0
def res(text):
    """
    Shortcut for reserved words.
    """
    return L.Identifier(match_text=text)
示例#3
0
        # Attributes, needed because of 'Class: A'Class'(...)
        AttributeRef(
            A.qual_name_internal, "'", A.identifier, Null(AdaNode)
        ),
        A.direct_name
    ),

    name=Or(
        CallExpr(A.name, "(", cut(), A.call_suffix, ")"),
        ExplicitDeref(A.name, ".", "all"),
        DottedName(A.name, ".", cut(), A.direct_name),

        # Special case for 'Update
        UpdateAttributeRef(
            A.name, "'",
            Identifier(L.Identifier(match_text="Update")),
            A.update_attr_aggregate
        ),

        # General Attributes
        AttributeRef(A.name, "'",
                     Predicate(A.identifier, T.Identifier.is_attr_with_args),
                     Opt("(", A.call_suffix, ")")),

        # Class attribute
        AttributeRef(A.name, "'", A.identifier, Null(A.call_suffix)),

        QualExpr(A.name, "'", Or(A.paren_expr, A.regular_aggregate)),

        A.direct_name_or_target_name,
    ),
示例#4
0
        # Attributes, needed because of 'Class: A'Class'(...)
        AttributeRef(
            A.qual_name_internal, "'", A.identifier, Null(AdaNode)
        ),
        A.direct_name
    ),

    name=Or(
        CallExpr(A.name, "(", cut(), A.call_suffix, ")"),
        ExplicitDeref(A.name, ".", "all"),
        DottedName(A.name, ".", cut(), A.direct_name),

        # Special case for 'Update
        UpdateAttributeRef(
            A.name, "'",
            Identifier(L.Identifier(match_text="Update")),
            A.update_attr_aggregate
        ),

        # General Attributes
        AttributeRef(A.name, "'",
                     Predicate(A.identifier, T.Identifier.is_not_class_id),
                     Opt("(", A.call_suffix, ")")),

        AttributeRef(A.name, "'", Identifier(L.Identifier(match_text='Class')),
                     Null(A.call_suffix)),

        QualExpr(A.name, "'", Or(A.paren_expr, A.aggregate)),

        A.direct_name_or_target_name,
    ),
示例#5
0
    return Opt(*rules).error()


def end_liblevel_block():
    return recover("end", Opt(A.static_name))


def end_named_block():
    return recover("end", Opt(A.identifier))


A.add_rules(
    parent_list=List(A.static_name, sep="and", list_cls=ParentList),

    protected_type_decl=ProtectedTypeDecl(
        L.Identifier(match_text="protected"),
        "type", A.identifier, Opt(A.discriminant_part),
        A.aspect_spec,
        "is", Opt("new", A.parent_list, "with"),
        A.protected_def, sc()
    ),

    protected_op=Or(A.subp_decl, A.entry_decl, A.aspect_clause, A.pragma),
    protected_el=Or(A.protected_op, A.component_decl),

    protected_def=ProtectedDef(
        PublicPart(List(A.protected_op,
                        empty_valid=True, list_cls=DeclList)),
        Opt("private",
            PrivatePart(List(A.protected_el,
                             empty_valid=True, list_cls=DeclList))),