GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GraphViz2::Parse::Yapp(3) User Contributed Perl Documentation GraphViz2::Parse::Yapp(3)

GraphViz2::Parse::Yapp - Visualize a yapp grammar as a graph

    use GraphViz2::Parse::Yapp;
    # no objects - quicker
    my $gd = GraphViz2::Parse::Yapp::to_graph('t/calc.output');

    # populate a GraphViz2 object with a Graph::Directed of a parser
    my $gv = GraphViz2->from_graph(GraphViz2::Parse::Yapp::graphvizify($gd));

    # OO interface, using lazy-built attributes
    my $gvp = GraphViz2::Parse::Yapp->new(file_name => $file_name);
    my $gd = $gvp->as_graph; # Graph::Directed object
    # or supply a suitable Graph::Directed object
    my $gvp = GraphViz2::Parse::Yapp->new(as_graph => $gd);
    # then get the GraphViz2 object
    my $gv = $gvp->graph;

    # DEPRECATED ways to get $gvp with populated $gv
    my $gvp = GraphViz2::Parse::Yapp->new;
    $gvp->create(file_name => 't/calc.output');
    my $gv = $gvp->graph;
    # or give it a pre-set-up GraphViz2 object
    my $gv = GraphViz2->new(...);
    my $gvp = GraphViz2::Parse::Yapp->new(graph => $gv);
    # call ->create as above

    # produce a visualisation
    my $format = shift || 'svg';
    my $output_file = shift || "output.$format";
    $gv->run(format => $format, output_file => $output_file);

See t/gen.parse.yapp.pl.

Takes a yapp grammar and converts it into a Graph::Directed object, or directly into a GraphViz2 object.

This is the recommended interface.

    my $gd = GraphViz2::Parse::Yapp::to_graph('t/calc.output');

Given a yapp grammar, returns a Graph::Directed object describing the finite state machine for it.

    my $gv = GraphViz2->from_graph(GraphViz2::Parse::Yapp::graphvizify($gd));

Mutates the given graph object to add to it the "graphviz" attributes visualisation "hints" that will make the "from_graph" in GraphViz2 method visualise this regular expression in the most meaningful way, including labels and groupings.

It is idempotent as it simply sets the "graphviz" attribute of the relevant graph entities.

Returns the graph object for convenience.

This is a Moo class, but with a recommended functional interface.

file_name

The name of a yapp output file. See t/calc.output.

This key is optional. You need to provide it by the time you access either the "as_graph" or "graph".

as_graph

The Graph::Directed object to use. If not given, will be lazily built on access, from the "regexp".

graph

The GraphViz2 object to use. This allows you to configure it as desired.

This key is optional. If provided, the "create" method will populate it. If not, it will have these defaults, lazy-built and populated from the "as_graph".

    my $gv = GraphViz2->new(
            edge   => {color => 'grey'},
            global => {directed => 1},
            graph  => {rankdir => 'TB'},
            node   => {color => 'blue', shape => 'oval'},
    );

DEPRECATED. Mutates the object to set the "file_name" attribute, then accesses the "as_graph" attribute (possibly lazy-building it), then "graphvizify"s its "as_graph" attribute with that information, then "from_graph"s its "graph".

Returns $self for method chaining.

Many thanks are due to the people who chose to make Graphviz <http://www.graphviz.org/> Open Source.

And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who wrote GraphViz, and kindly gave me co-maint of the module.

GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.

Home page: <http://savage.net.au/index.html>.

Australian copyright (c) 2011, Ron Savage.

All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Perl License, a copy of which is available at: http://dev.perl.org/licenses/

2020-10-21 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.