NAME
MarpaX::ESLIF - ESLIF is Extended ScanLess InterFace
VERSION
version 3.0.5
SYNOPSIS
use MarpaX::ESLIF;
my $eslif = MarpaX::ESLIF->new();
printf "ESLIF library version: %s\n", $eslif->version;
With a logger, using Log::Any::Adapter::Stderr as an example:
use MarpaX::ESLIF;
use Log::Any qw/$log/;
use Log::Any::Adapter ('Stderr', log_level => 'trace' );
my $eslif = MarpaX::ESLIF->new($log);
printf "ESLIF library version: %s\n", $eslif->version;
This class and its derivatives are thread-safe. Although there can be many ESLIF instances, in practice a single instance is enough, unless you want different logging interfaces. This is why the new
method is implemented as a multiton. Once a MarpaX::ESLIF instance is created, the user should create a MarpaX::ESLIF::Grammar instance to have a working grammar.
DESCRIPTION
ESLIF is derived from perl's Marpa::R2, and has its own BNF, documented in MarpaX::ESLIF::BNF.
The main features of this BNF are:
- Sub-grammars
-
The number of sub grammars is unlimited.
- Regular expressions
-
Native support of regular expression using the PCRE2 library (i.e. this is <not> exactly perl regexps, although very closed).
- Streaming
-
Native support of streaming input.
Beginners might want to look at MarpaX::ESLIF::Introduction.
METHODS
MarpaX::ESLIF->new($loggerInterface)
my $loggerInterface = My::Logger::Interface->new();
my $eslif = MarpaX::ESLIF->new();
Returns an instance of MarpaX::ESLIF, noted $eslif
below.
$loggerInterface
is an optional parameter that, when its exists, must be an object instance that can do the methods documented in MarpaX::ESLIF::Logger::Interface, or undef
.
An example of logging implementation can be a Log::Any adapter.
MarpaX::ESLIF->getInstance($loggerInterface)
Alias to new
.
$eslif->version()
printf "ESLIF library version: %s\n", $eslif->version;
Returns a string containing the current underlying ESLIF library version.
NOTES
The perl interface is an all-in-one version of marpaESLIF library, which means that character conversion is using iconv
(or iconv
-like on Windows) instead of ICU, even if the later is available on your system.
BOOLEAN TYPE
ESLIF has a boolean type, perl has not. In order to not reinvent the wheel, the widely JSON's Perl's boolean utilities via JSON::MaybeXS wrapper are used, i.e.:
- true
-
A true value. You may localize
$MarpaX::ESLIF::true
before using ESLIF to change it.Defaults to
JSON::MaybeXS::true()
. - false
-
A false value. You may localize
$MarpaX::ESLIF::false
before using ESLIF to change it.Defaults to
JSON::MaybeXS::false()
. - is_bool($value)
-
Returns a true value if
$value
is a boolean. You may localizeMarpaX::ESLIF::is_bool()
function before using ESLIF to change it.Defaults to
JSON::MaybeXS::is_bool($value)
NUMERIC TYPES
ESLIF has two functions MarpaX::ESLIF::is_Int()
and MarpaX::ESLIF::is_StrictNum()
, that maps by default to the Types::Standard implementations. You may localize them before using ESLIF if needed.
STRING TYPE
ESLIF has the function MarpaX::ESLIF::is_Str()
, that maps by default to the Types::Standard implementation. You may localize it before using ESLIF if needed.
SEE ALSO
MarpaX::ESLIF::Introduction, PCRE2, MarpaX::ESLIF::BNF, MarpaX::ESLIF::Logger::Interface, MarpaX::ESLIF::Grammar, MarpaX::ESLIF::Recognizer, Types::Standard, JSON::MaybeXS.
AUTHOR
Jean-Damien Durand <jeandamiendurand@free.fr>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 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.