@stt = sort @stt; # Format nicely as sample data for GraphViz2.
my($stt_graph) = GraphViz2::Parse::STT -> new;
$stt_graph -> create(stt => join("\n", @stt) );
$stt_graph -> graph -> run(format => 'svg', output_file => 'graph.easy.svg');
NAME
Graph::Easy::Marpa::Lexer::DFA - A Set::FA::Element-based lexer for Graph::Easy
Synopsis
See "Data and Script Interaction" in Graph::Easy::Marpa.
Description
Graph::Easy::Marpa::Lexer::DFA provides a Set:FA::Element-based lexer for Graph::Easy-style graph definitions.
Installation
Install Graph::Easy::Marpa as you would for any Perl
module:
Run:
cpanm Graph::Easy::Marpa
or run:
sudo cpan Graph::Easy::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
Constructor and Initialization
new()
is called as my($dfa) = Graph::Easy::Marpa::Lexer::DFA -> new(k1 => v1, k2 => v2, ...)
.
It returns a new object of type Graph::Easy::Marpa::Lexer::DFA
.
Key-value pairs accepted in the parameter list (see corresponding methods for details [e.g. graph_text()]):
- o graph_text => $string
-
Specify a string for the graph definition.
- o logger => $logger
-
Specify a logger object to use.
- o report_stt => $Boolean
-
Get or set the value which determines whether or not to report the parsed state transition table (STT).
- o state => $state
-
Specify the state transition table.
- o start => $start_state_name
-
Specify the name of the start state.
Methods
items()
Returns a object of type Set::Array, which is an arrayref of items output by the state machine.
These items are not the same as the arrayref of items returned by the items() method in Graph::Easy::Marpa::Parser, but they are the same as in Graph::Easy::Marpa::Lexer.
Each element is a hashref with these keys:
- o name => $string
-
The name of the thing (attribute, class, edge, node or subclass) found.
- o type => $string
-
The type of the name.
The value of $string is one of: attribute, class, class_attribute, edge, group, node, pop_group or subclass.
The code does not distinguish between attributes for a class, subclass, edge or node.
The value pop_group is for the ')' token at the end of the definition of a group.
- o value => $string
-
The value, if the type is attribute or class_attribute.
run()
Runs the state machine.
Afterwards, you call "items()" to retrieve the arrayref of results.
Machine-Readable Change Log
The file CHANGES was converted into Changelog.ini by Module::Metadata::Changes.
Version Numbers
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
Support
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=Graph::Easy::Marpa.
Author
Graph::Easy::Marpa was written by Ron Savage <ron@savage.net.au> in 2011.
Home page: http://savage.net.au/index.html.
Copyright
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 Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html