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 methods are triggered by items in the input stream matching elements of the current grammar (and Marpa does the calling).
Outputs to a stack managed by Set::Array. See "items()".
Installation
See "Installation" in MarpaX::Languages::SVG::Parser.
Constructor and Initialization
new()
is called as my($actions) = MarpaX::Languages::SVG::Parser::Actions -> new(k1 => v1, k2 => v2, ...)
.
It returns a new object of type MarpaX::Languages::SVG::Parser::Actions
.
Key-value pairs accepted in the parameter list (see also the corresponding methods [e.g. "logger([$log_object])"]):
- 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.
Default: undef.
Methods
boolean($t1)
Pushes the boolean $t1 onto the stack managed by $self -> items.
command($t1)
Pushes the command $t1 onto the stack managed by $self -> items.
float($t1)
Pushes the float $t1 onto the stack managed by $self -> items.
integer($t1)
Pushes the integer $t1 onto the stack managed by $self -> items.
item_count([$new_value])
Here, the [] indicate an optional parameter.
Get or set the counter used to populate the count
key in the hashref in the array of parsed tokens.
items()
Returns the instance of Set::Array which manages the array of hashrefs holding the parsed tokens.
$object -> items -> print returns an array ref.
See "Synopsis" in MarpaX::Languages::SVG::Parser for sample code.
See also "new_item($type, $name, $value)".
log($level, $s)
Calls $self -> logger -> log($level => $s) if ($self -> logger).
logger([$log_object])
Here, the [] indicate an optional parameter.
Get or set the log object.
$log_object must be a Log::Handler-compatible object.
To disable logging, just set logger to the empty string.
Note: logger
is a parameter to new().
new()
This method is auto-generated by Moo.
new_item($type, $name, $value)
Pushes another hashref onto the stack managed by $self -> items.
param_count([$new_value])
Here, the [] indicate an optional parameter.
Get or set the counter used to populate the name
(sic) key in the hashref in the array of parsed tokens, in those cases that the array elements contain parameters for SVG commands.
See "FAQ" in MarpaX::Languages::SVG::Parser for a discussion of this complex issue.
report()
Prints the stack managed by $self -> items.
string($t1)
Pushes the string $t1 onto the stack managed by $self -> items.
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