NAME

MarpaX::Languages::ECMAScript::AST::Util - ECMAScript Translation to AST - Class method utilities

VERSION

version 0.020

SYNOPSIS

use MarpaX::Languages::ECMAScript::AST::Util qw/:all/;

my $whoami = whoami();
my $whowasi = whowasi();
callIt(0, '1', [2], {3 => 4});

sub callIt {
    my $hash = traceAndUnpack(['var1', 'var2', 'array1p', 'hash1p'], @_);
}

DESCRIPTION

This modules implements some function utilities.

EXPORTS

The methods whoami(), whowasi() and traceAndUnpack() are exported on demand.

SUBROUTINES/METHODS

whoami($base)

Returns the name of the calling routine. Optional $base prefix is removed. Typical usage is whoami(__PACKAGE__).

whowasi($base)

Returns the name of the parent's calling routine. Optional $base prefix is removed. Typical usage is whowasi(__PACKAGE__).

traceAndUnpack($nameOfArgumentsp, @arguments)

Returns a hash mapping @{$nameOfArgumentsp} to @arguments and trace it. The tracing is done using a method quite similar to Log::Any. Tracing and hash mapping stops at the end of @nameOfArguments or @arguments.

showLineAndCol($line, $col, $source)

Returns a string showing the request line, followed by another string that shows what is the column of interest, in the form "------^".

lineAndCol($impl, $g1)

Returns the output of Marpa's line_column at a given $g1 location. Default $g1 is Marpa's current_g1_location().

startAndLength($impl, $g1)

Returns the output of Marpa's g1_location_to_span at a given $g1 location. Default $g1 is Marpa's current_g1_location().

lastCompleted($impl, $symbol)

Returns the string corresponding the last completion of $symbol.

lastLexemeSpan($impl)

Returns the span ($start, $length) corresponding the last lexeme.

AUTHOR

Jean-Damien Durand <jeandamiendurand@free.fr>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Jean-Damien Durand.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.