TypeGraph
NAME
Doc::TypeGraph - Parse a class description file, return a type graph.
SYNOPSIS
use Doc::TypeGraph;
# create and initialize it
my $tg = Doc::TypeGraph.new-from-file("./resources/type-graph.txt");
# and use it!
say $tg.sorted;
DESCRIPTION
Doc::TypeGraph creates a graph of all types in a file. It gives you info about what classes a type inherits from and the roles it does. In addition, it also computes the inversion of this relations, which let you know what types inherit a given type and the types implementing a specific role.
FILE SYNTAX
[ Category ]
# only one-line comments are supported
packagetype typename[role-signature]
packagetype typename[role-signature] is typename[role-signature] # inheritance
packagetype typename[role-signature] does typename[role-signature] # roles
[ Another cateogory ]
Supported categories:
Metamodel
,Domain-specific
,Basic
,Composite
,Exceptions
andCore
.Supported packagetypes:
class
,module
,role
andenum
.Supported typenames: whatever string following the syntax
class1::class2::class3 ...
.[role-signature]
is not processed, but you can add it anyway.If your type inherits from more than one type or implements several roles, you can add more
is
anddoes
statements (separated by spaces).
Example:
[Metamodel]
# Metamodel
class Metamodel::Archetypes
role Metamodel::AttributeContainer
class Metamodel::GenericHOW does Metamodel::Naming
class Metamodel::MethodDispatcher is Metamodel::BaseDispatcher is Another::Something
enum Bool is Int
module Test
AUTHOR
Moritz <@moritz> Antonio Gámiz <@antoniogamiz>
COPYRIGHT AND LICENSE
This module has been spun off from the Official Doc repo, if you want to see past changes go to the official doc.
Copyright 2019-21 Raku Team This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.