The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.

Default: ''.

o logger => $logger

Specify a logger object to use.

Default: ''.

o report_stt => $Boolean

Get or set the value which determines whether or not to report the parsed state transition table (STT).

Default: 0.

o state => $state

Specify the state transition table.

There is no default. The code dies if a value is not supplied.

o start => $start_state_name

Specify the name of the start state.

There is no default. The code dies if a value is not supplied.

o verbose => $Boolean

Specify the verbosity level when calling Set::FA::Element.

Dedault: 0.

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.

log($level, $s)

Calls $self -> logger -> $level($s).

logger([$logger_object])

Here, the [] indicate an optional parameter.

Get or set the logger object.

To disable logging, just set logger to the empty string.

maxlevel([$string])

Here, the [] indicate an optional parameter.

Get or set the value used by the logger object.

This option is only used if Graph::Easy::Marpa:::Lexer or Graph::Easy::Marpa::Parser create an object of type Log::Handler. See Log::Handler::Levels.

minlevel([$string])

Here, the [] indicate an optional parameter.

Get or set the value used by the logger object.

This option is only used if Graph::Easy::Marpa:::Lexer or Graph::Easy::Marpa::Parser create an object of type Log::Handler. See Log::Handler::Levels.

run()

Runs the state machine.

Afterwards, you call "items()" to retrieve the arrayref of results.

verbose([$Boolean])

Here, the [] indicate an optional parameter.

Get or set the verbosity level when calling Set::FA::Element.

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