The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MarpaX::ESLIF::Value::Interface - MarpaX::ESLIF's value interface

VERSION

version 3.0.28

DESCRIPTION

Value interface is a list of methods that are required by MarpaX::ESLIF at run-time to perform valuation. It has to be an object instance, referenced with $valueInterface below.

METHODS

$valueInterface->isWithHighRankOnly()

Returns the rank order preference.

When the interface returns true, only the choices with the highest rank are kept. This method is used at valuation instance creation step only.

$valueInterface->isWithOrderByRank()

Returns the rank order preference.

Orders the parse tree values by their rank value. This method is used at valuation instance creation step only.

$valueInterface->isWithAmbiguous()

Returns the ambiguity acceptance.

Accept ambiguous parse tree. This method is used at valuation instance creation step only.

$valueInterface->isWithNull()

Returns the null acceptance.

Accept a null parse tree value (e.g. when the start rule is not complete). This method is used at valuation instance creation step only.

$valueInterface->maxParses()

Returns the maximum number of wanted parses, 0 for all parse trees.

A very ambiguous parsing can provide a lot of parse tree values, it is possible to reduce such number, at the cost of not having all the valuation possibilities. This method is used at valuation instance creation step only.

$valueInterface->setResult($result)

Store the parsing result.

When valuation is successful, marpaESLIF is using this callback.

$valueInterface->getResult()

Returns the parsing result.

marpaESLIF is not using this method per-se, but it is nevertheless required to ensure the interface coherency v.s. the getResult() required method.

LOCALIZED VARIABLES

At each symbol or rule callback, the following values are localized:

$MarpaX::ESLIF::Context::symbolName

Symbol name in case of a symbol callback, undef otherwise.

$MarpaX::ESLIF::Context::symbolNumber

Symbol number in case of a symbol callback, undef otherwise.

$MarpaX::ESLIF::Context::ruleName

Rule name in case of a rule callback, undef otherwise.

$MarpaX::ESLIF::Context::ruleNumber

Rule number in case of a rule callback, undef otherwise.

$MarpaX::ESLIF::Context::grammar

Grammar instance.

OPTIONAL METHODS SINCE VERSION 2.0.15

$valueInterface->setSymbolName($symbolName)

Stores symbol name. Always set in case of a symbol callback, undef otherwise.

$valueInterface->setSymbolNumber($symbolNumber)

Stores symbol number. Always set in case of a symbol callback, undef otherwise.

$valueInterface->setRuleName($ruleName)

Stores rule name. Always set in case of a rule callback, undef otherwise.

$valueInterface->setRuleNumber($ruleNumber)

Stores rule number. Always set in case of a rule callback, undef otherwise.

$valueInterface->setGrammar($grammar)

Stores grammar instance.

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.