GraphViz2::Marpa::Renderer::GraphViz2 - A renderer for lexed and parsed Graphviz dot files
See "Synopsis" in GraphViz2::Marpa.
GraphViz2::Marpa::Renderer provides a renderer for Graphviz (dot) graph definitions lexed by GraphViz2::Marpa::Lexer and parsed by GraphViz2::Marpa::Parser.
It outputs a string to the output file, which (ideally) exactly matches the graph definition input to the lexer, although there might be small differences in the line-by-line formatting.
This module is the default rendering engine for GraphViz2::Marpa.
Demo lexer/parser output: http://savage.net.au/Perl-modules/html/graphviz2.marpa/index.html.
State Transition Table: http://savage.net.au/Perl-modules/html/graphviz2.marpa/default.stt.html.
Command line options and object attributes: http://savage.net.au/Perl-modules/html/graphviz2.marpa/code.attributes.html.
My article on this set of modules: http://www.perl.com/pub/2012/10/an-overview-of-lexing-and-parsing.html.
The Marpa grammar as an image: http://savage.net.au/Ron/html/graphviz2.marpa/Marpa.Grammar.svg. This image was created with Graphviz via GraphViz2.
Install GraphViz2::Marpa as you would for any Perl module:
Perl
Run:
cpanm GraphViz2::Marpa
or run:
sudo cpan GraphViz2::Marpa
or unpack the distro, and then either:
perl Build.PL ./Build ./Build test sudo ./Build install
or:
perl Makefile.PL make (or dmake or nmake) make test make install
new() is called as my($renderer) = GraphViz2::Marpa::Renderer::GraphViz2 -> new(k1 => v1, k2 => v2, ...).
new()
my($renderer) = GraphViz2::Marpa::Renderer::GraphViz2 -> new(k1 => v1, k2 => v2, ...)
It returns a new object of type GraphViz2::Marpa::Renderer::GraphViz2.
GraphViz2::Marpa::Renderer::GraphViz2
Key-value pairs accepted in the parameter list (see corresponding methods for details [e.g. maxlevel()]):
Specify a logger object.
To disable logging, just set logger to the empty string.
Default: An object of type Log::Handler.
To disable logging, just set 'logger' to the empty string (not undef).
This option is only used if this module creates an object of type Log::Handler. See Log::Handler::Levels.
Default: 'notice'.
Default: 'error'.
No lower levels are used.
Specify the name of the output file to write. This will contain the text string of the rendered graph.
Default: ''.
The default means the output file is not written. Use the "output_string()" method to retrieve the string.
Specify the name of a CSV file of parsed tokens to read.
This file is read only if the token option (next) does not contain an arrayref of tokens to process.
Specify the arrayref of tokens output by the parser.
The format of this array is documented in "How is the parsed graph stored in RAM?" in GraphViz2::Marpa::Parser.
Default: [].
$attributes is an arrayref of interleaved attribute ids and values.
Called by "run()".
Sets "output_string()".
Returns an arrayref of items output by the renderer.
Calls $self -> logger -> $level($s) if ($self -> logger).
Here, the [] indicate an optional parameter.
Get or set the logger object.
To disable logging, just set 'logger' to the empty string (not undef), in the call to "new()".
'logger' is a parameter to "new()". See "Constructor and Initialization" for details.
Get or set the value used by the logger object.
This option is only used if GraphViz2::Marpa:::Lexer or GraphViz2::Marpa::Parser create an object of type Log::Handler. See Log::Handler::Levels.
'maxlevel' is a parameter to "new()". See "Constructor and Initialization" for details.
'minlevel' is a parameter to "new()". See "Constructor and Initialization" for details.
See "Constructor and Initialization" for details on the parameters accepted by "new()".
Get or set the name of the output file. This will contain the text string of the rendered graph.
If the output file name is not set, use the "output_string()" method to retrieve the string.
'output_file' is a parameter to "new()". See "Constructor and Initialization" for details.
Returns the text string of the rendered graph.
To save the output in a file, use the 'output_file' parameter to "new()".
Get or set the name of the file of parsed tokens to read.
'parsed_file' is a parameter to "new()". See "Constructor and Initialization" for details.
Renders the arrayref of items as a string and, optionally, writes that string to the output file.
Calls "format_output()".
See "output_string()".
Returns 0 for success and 1 for failure.
Gets or sets the arrayref of tokens to be rendered.
'tokens' is a parameter to "new()". See "Constructor and Initialization" for details.
Get or set the utils object.
Default: A object of type GraphViz2::Marpa::Utils.
Yes - at least in the sense that running dot with them as input will produce the same output files. This is using the default renderer, of course.
Since comments in *.gv files are discarded, they can never be in the output files (*.lex, *.parse and *.rend).
So, if x.gv is formatted as I do, then x.rend will be formatted identically.
The file CHANGES was converted into Changelog.ini by Module::Metadata::Changes.
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2::Marpa.
GraphViz2::Marpa was written by Ron Savage <ron@savage.net.au> in 2012.
Home page: http://savage.net.au/index.html.
Australian copyright (c) 2012, 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 Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html
To install GraphViz2::Marpa, copy and paste the appropriate command in to your terminal.
cpanm
CPAN shell
perl -MCPAN -e shell install GraphViz2::Marpa
For more information on module installation, please visit the detailed CPAN module installation guide.