Exemplo n.º 1
0
                                       "=>", A.expr),
 contract_cases_expr=ContractCases("(", List(A.contract_case_assoc,
                                             sep=","), ")"),
 abstract_state_decl=Or(
     AbstractStateDecl(A.defining_name, A.aspect_spec),
     ParenAbstractStateDecl("(", A.abstract_state_decl, ")")),
 multi_abstract_state_decl=Or(
     A.abstract_state_decl,
     MultiAbstractStateDecl(
         "(",
         List(A.abstract_state_decl,
              sep=",",
              list_cls=AbstractStateDeclList), ")")),
 aspect_assoc=Or(
     AspectAssoc(
         Identifier(L.Identifier(match_text="Abstract_State")),
         Opt(
             "=>",
             Or(A.null_literal,
                AbstractStateDeclExpr(A.multi_abstract_state_decl)))),
     AspectAssoc(A.name, Opt("=>", Or(A.expr, A.contract_cases_expr)))),
 aspect_spec=Opt(AspectSpec("with", cut(), List(A.aspect_assoc, sep=","))),
 single_task_decl=SingleTaskDecl(
     "task", cut(),
     SingleTaskTypeDecl(A.defining_id, Null(A.discriminant_part),
                        A.aspect_spec, Opt(A.task_def)), sc()),
 overriding_indicator=Or(
     Overriding.alt_overriding(res("overriding")),
     Overriding.alt_not_overriding("not", res("overriding")),
     Overriding.alt_unspecified()),
 entry_decl=EntryDecl(
Exemplo n.º 2
0
def res(text):
    """
    Shortcut for reserved words.
    """
    return L.Identifier(match_text=text)
Exemplo n.º 3
0
    # parsers, so that we can use A.subtype_indication | A.name in allocator.
    qualified_name=QualExpr(A.qual_name_internal, "'",
                            Or(A.paren_expr, A.regular_aggregate)),
    qual_name_internal=Or(
        DottedName(A.qual_name_internal, ".", A.direct_name),
        # 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,
    ),
    defining_name=DefiningName(A.static_name),
    direct_name_or_target_name=Or(A.direct_name, A.target_name),
    target_name=TargetName("@"),