The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MarpaX::Languages::SVG::Parser::Actions - A nested SVG parser, using XML::SAX and Marpa::R2

Synopsis

See "Synopsis" in MarpaX::Languages::SVG::Parser.

Description

Basically just utility routines for MarpaX::Languages::SVG::Parser. Only used indirectly by Marpa::R2.

Specifially, calls to functions are triggered by items in the input stream matching elements of the current grammar (and Marpa does the calling).

Each action function returns a hashref, which Marpa gathers. The calling code MarpaX::Languages::SVG::Parser::SAXHandler decodes the result and puts the hashrefs into a stack, described in the "FAQ" in MarpaX::Languages::SVG::Parser.

Installation

See "Installation" in MarpaX::Languages::SVG::Parser.

Constructor and Initialization

This class has no constructor. Marpa::R2 fabricates an instance, but won't let us get access to it.

So, we use a global variable, $logger, initialized in MarpaX::Languages::SVG::Parser::SAXHandler, in case we need logging. Details:

o logger => aLog::HandlerObject

By default, an object of type Log::Handler is created which prints to STDOUT, but given the default, nothing is actually printed unless the maxlevel attribute of this object is changed in MarpaX::Languages::SVG::Parser.

Default: anObjectOfTypeLogHandler.

Also, each new parse is preceeded by a call to the "init()" function, to reset some counters global to this file.

Methods

None.

Functions

boolean($t1)

Returns a hashref identifying the boolean $t1.

command($t1, @t2)

Returns a hashref identifying the command $t1 and its parameters in @t2.

float($t1)

Returns a hashref identifying the float $t1.

init()

Resets some counters global to the file. This must be called at the start of each new parse.

integer($t1)

Returns a hashref identifying the integer $t1.

log($level, $s)

Calls $logger -> log($level => $s) if ($logger).

string($t1)

Returns a hashref identifying the string $t1.

FAQ

See "FAQ" in MarpaX::Languages::SVG::Parser.

Author

MarpaX::Languages::SVG::Parser was written by Ron Savage <ron@savage.net.au> in 2013.

Home page: http://savage.net.au/.

Copyright

Australian copyright (c) 2013, 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 2.0, a copy of which is available at:
        http://www.opensource.org/licenses/index.html