enumDeclaration method

Parser<EnumDeclarationNode> enumDeclaration()
inherited

Implementation

Parser<EnumDeclarationNode> enumDeclaration() =>
    seq8(
      ref0(enumToken),
      ref0(identifier),
      ref0(typeParameters).optionalWith(const <TypeParameterNode>[]),
      (ref0(withToken) & ref0(typeList))
          .map((l) => l[1] as List<TypeNode>)
          .optionalWith(const <TypeNode>[]),
      (ref0(implementsToken) & ref0(typeList))
          .map((l) => l[1] as List<TypeNode>)
          .optionalWith(const <TypeNode>[]),
      ref1(token, '{'),
      ref0(enumBody),
      ref1(token, '}'),
    ).map8(
      (_, name, typeParams, mixins, interfaces, _, body, _) =>
          EnumDeclarationNode(
            name: name,
            typeParameters: typeParams,
            mixins: mixins,
            interfaces: interfaces,
            constants: body.$1,
            members: body.$2,
          ),
    );