GraphViz2::Marpa::Lexer::DFA - A Perl lexer for Graphviz dot files
This module is called from GraphViz2::Marpa::Lexer.
GraphViz2::Marpa::Lexer::DFA provides a Set:FA::Element-based lexer for Graphviz (dot) graph definitions.
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($dfa) = GraphViz2::Marpa::Lexer::DFA -> new(k1 => v1, k2 => v2, ...).
new()
my($dfa) = GraphViz2::Marpa::Lexer::DFA -> new(k1 => v1, k2 => v2, ...)
It returns a new object of type GraphViz2::Marpa::Lexer::DFA.
GraphViz2::Marpa::Lexer::DFA
Key-value pairs accepted in the parameter list (see corresponding methods for details [e.g. graph_text()]):
Specify a string for the Graphviz (dot) graph definition.
Default: ''.
Specify a logger object to use.
Log the State Transition Table.
Default: 0.
Specify the name of the start state.
There is no default. The code dies if a value is not supplied.
Specify the State Transition Table.
Specify the verbosity level in the call to Set::FA::Element.
The value is only used by the latter module when a logger is not passed to it from the current module.
The [] indicate an optional parameter.
Get or set the Graphviz (dot) graph definition.
'graph_text' is a parameter to "new()". See "Constructor and Initialization" for details.
Returns a object of type Set::Array, which is an arrayref of items output by the DFA.
These items are not the same as the arrayref of items returned by the items() method in GraphViz2::Marpa::Parser, but they are the same as in GraphViz2::Marpa::Lexer.
Each element is a hashref with these keys:
Just counts the items as 1 .. N.
Not used. Always ''.
The type of the token.
The range of values is documented in the lexer's FAQ item: How is the lexed graph stored in RAM?.
The value of the token from the input stream.
Usage:
my(@items) = @{$dfa -> items};
Calls $self -> logger -> $level($s) if ($self -> logger).
Here, the [] indicate an optional parameter.
Get or set the logger object.
See "Constructor and Initialization" for details on the parameters accepted by "new()".
Get or set the value which determines whether or not to log the parsed state transition table (STT).
Calls "report()" in Set::FA::Element. Set min and max log levels to 'info' for this.
'report_stt' is a parameter to "new()". See "Constructor and Initialization" for details.
Runs the state machine.
Afterwards, you call "items()" to retrieve the arrayref of results.
Get or set the name of the state in which the STT starts.
'start' is a parameter to "new()". See "Constructor and Initialization" for details.
Get or set the hashref defining the STT.
'state' is a parameter to "new()". See "Constructor and Initialization" for details.
Get or set the verbosity level when calling Set::FA::Element.
'verbose' is a parameter to "new()". See "Constructor and Initialization" for details.
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.