MarpaX::Languages::M4 - M4 pre-processor
version 0.020
use POSIX qw/EXIT_SUCCESS/; use MarpaX::Languages::M4; use Log::Any; use Log::Any::Adapter; use Log::Any::Adapter::Callback; Log::Any::Adapter->set('Callback', min_level => 'trace', logging_cb => \&_logging_cb); my $m4 = MarpaX::Languages::M4->new_with_options(); $m4->parse('debugmode(`V\')m4wrap(`test\')'); print "Value: " . $m4->value . "\n"; print "Rc: " . $m4->rc . "\n"; sub _logging_cb { my ($method, $self, $format, @params) = @_; printf STDERR "$format\n", @args; }
This package is an implementation of M4.
Please do m4pp --help for a list of all options. Returns a new M4 object instance.
Returns $string enclosed by current quote start and quote end.
Returns the unquoted $string.
Append string $result to M4 preprocessing output.
Return M4 preprocessing output.
Return a reference to the M4 preprocessing output.
Parses $input. Can be called any number of times.
Wrapper on parseIncremental(). Calling this method parses a single input and disable any later call to parseIncremental().
Returns the input not yet parsed. For example, when input ends with a macro call that requires parameters, and the parameters list is not complete.
Turns on end-of-input flag. Then no call to parseIncremental() or parse() will be possible.
Get current end-of-input flag.
Log $message to error stream and throw an exception of class ImplException.
Get current file name. See NOTES.
Get current line number. See NOTES.
Get current parse return code. Should be POSIX::EXIT_SUCCESS() or POSIX::EXIT_FAILURE().
Return a boolean saying if $obj argument is an ImplException consumer.
Execute macro $macro with arguments @args. Output is dependent of current parsing context, and can return an internal token instead of a string.
Return current macro internal call identifier. This number increases every time a macro is called.
Return number of input processed so far.
Enters interactive mode.
Return debug file, undef if none.
Return default --warn-macro-sequence option value (used by m4pp to handle MooX::Option non support of optional value on the command-line)
file() and line() methods, nor synchronisation output, are currently not supported. This is on the TODO list for this package.
M4 is a MooX::Role::Logger consumer, using explicitely Log::Any's "f" functions in all its logging methods. This mean that the message, in case you would use something like e.g. Log::Any::Adapter::Callback, is always formatted, with no additional parameter.
Marpa::R2, Moops, MooX::Role::Logger, Log::Any, Log::Any::Adapter::Callback, POSIX, M4 POSIX, M4 GNU
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2015 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.
To install MarpaX::Languages::M4, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::Languages::M4
CPAN shell
perl -MCPAN -e shell install MarpaX::Languages::M4
For more information on module installation, please visit the detailed CPAN module installation guide.