flo-0.1: Generate flow charts from your code base.

Development.Flo

Contents

Description

Generate a flow chart by from annotations from a code base.

The syntax is as follows:

  expr  <- label / next / do / if / task
  label <- "label" name
  task  <- "task" text
  next  <- "next" name / "trigger" name
  do    <- "do" text
  if    <- "if" name "\n" "then" name ("\n" "else" name)?

where name and text are both arbitrary text.

A label is used to label a node in the graph. next is used to link the current node to another node by its label. The text for a node is written by do, which explains what this node does, or by using if which makes this node a conditional which goes to one of two possible nodes.

Example (assuming \/\// to be the declaration prefix):

  /// label main
  /// if Logged in?
  /// then display_overview
  /// else display_login
  /// label display_overview
  /// do Display overview.
  /// next display_event
  /// next display_paper
  // Event list code here.
  event_list();
  /// label display_login
  /// do Display login.
  /// next try_login
  // Login display code here.
  display_login();
  /// label try_login
  /// do Check login.
  /// next main
  /// trigger log_access_time
  // Login attempt code here.
  if(check_login()) log_attempt_success();
  /// label display_event
  /// do Display a single event.
  /// next display_paper
  // Event list code here.
  display_event();
  /// label display_paper
  /// do Display a single paper.
  // Paper display code here.
  display_paper();
  /// label log_access_time
  /// task Log login accesses.
  log_login();

In other words: You have a main page which either displays a login screen or lists the user's events if logged in. From the events page you can get to the event page.

Custom syntax can be used, too. Example:

  {- # bar -}
 SELECT * FROM mysql;

Synopsis

Types

data Node Source

A workflow node.

Constructors

Node 

Instances

data Type Source

Type of the node.

Constructors

Action 
Condition 
Background 

Instances

data Edge Source

A workflow connection.

Constructors

Edge 

Fields

edgeLabel :: String
 
edgeTo :: Name
 

Instances

data Decl Source

A workflow declaration.

Constructors

Label Name

Sets the current node.

Next Name

Links to a next node (an edge).

Do String

Describes this node.

Task String

Run some task (create db entry, delete file, send email etc.).

If String Name (Maybe Name)

Makes this node a conditional.

Instances

data Name Source

A node name.

Instances

Functions

digraph :: String -> StringSource

Wrap a string up in a digraph.

nodesToDot :: [Node] -> StringSource

Convert a list of nodes to a Graphviz dot document.

declsToNodes :: [Decl] -> [Node]Source

Converts a list of declarations to a list of nodes.

parseFile :: FilePath -> String -> Maybe String -> IO (Either ParseError [Decl])Source

Parse a source file containing commented declarations.