NAME

MarpaX::ESLIF::Grammar::Rule::Properties - ESLIF Grammar Rule Properties

VERSION

version 6.0.35.1

SYNOPSIS

use MarpaX::ESLIF;

my $eslif = MarpaX::ESLIF->new();
my $data = do { local $/; <DATA> };
my $eslifGrammar = MarpaX::ESLIF::Grammar->new($eslif, $data);
my $ruleProperties = $eslifGrammar->ruleProperties(0);
my $rulePropertiesByLevel = $eslifGrammar->rulePropertiesByLevel(0, 0);

__DATA__
#
# This is an example of a calculator grammar
#
:start   ::= Expression
:default ::=             action        => do_op
                         symbol-action => do_symbol

:desc    ::= 'Calculator'
:discard ::= whitespaces event  => discard_whitespaces$
:discard ::= comment     event  => discard_comment$

event ^Number = predicted Number
event Number$ = completed Number
Number   ::= NUMBER   action => ::shift

event Expression$ = completed Expression
event ^Expression = predicted Expression
Expression ::=
    Number                                           action => do_int
    | '(' Expression ')'              assoc => group action => ::copy[1]
   ||     Expression '**' Expression  assoc => right
   ||     Expression  '*' Expression
    |     Expression  '/' Expression
   ||     Expression  '+' Expression
    |     Expression  '-' Expression

whitespaces ::= WHITESPACES
comment ::= /(?:(?:(?:\/\/)(?:[^\n]*)(?:\n|\z))|(?:(?:\/\*)(?:(?:[^\*]+|\*(?!\/))*)(?:\*\/)))/u

:symbol ::= NUMBER pause => before event => ^NUMBER
:symbol ::= NUMBER pause => after  event => NUMBER$

:desc      ~ 'Calculator Tokens'
NUMBER     ~ /[\d]+/   name => 'NUMBER Lexeme'
WHITESPACES ~ [\s]+    name => 'WHITESPACES Lexeme'

$self->getId

Returns Rule's id (always >= 0)

$self->getDescription

Returns Rule's description (auto-generated if there is not "name" keyword in the grammar)

$self->getShow

Returns Rule's show

$self->getLhsId

Returns Rule's LHS symbol id (always >= 0)

$self->getSeparatorId

Returns Rule's separator symbol id (< 0 if the rule is not a sequence)

$self->getRhsIds

Returns Rule's RHS ids (none for a null rule or a sequence)

$self->getSkipIndices

Returns Rule's RHS skip indices (none for a null rule)

$self->getExceptionId

Returns Rule's exception id (< 0 if there is no exception)

$self->getAction

Returns Rule's action (null if none)

$self->getDiscardEvent

Returns Rule's discard event name (only when LHS is ":discard" and "event" keyword is present)

$self->isDiscardEventInitialState

Returns Rule's discard initial state is on ?

$self->getDiscardEventInitialState

Returns Rule's discard initial state is on ?

Alias to isDiscardEventInitialState()

$self->getRank

Returns Rule's rank (defaults to 0)

$self->isNullRanksHigh

Returns Rule rank high when it is a nullable ?

$self->getNullRanksHigh

Returns Rule rank high when it is a nullable ?

Alias to isNullRanksHigh()

$self->isSequence

Returns Rule is a sequence ?

$self->getSequence

Returns Rule is a sequence ?

Alias to isSequence()

$self->isProper

Returns Rule's separation is proper ? (meaningful only when it is sequence)

$self->getProper

Returns Rule's separation is proper ? (meaningful only when it is sequence)

Alias to isProper()

$self->getMinimum

Returns Rule's minimum number of RHS (meaningful only when rule is a sequence)

$self->getPropertyBitSet

Returns Rule's low-level property bits (combination of MarpaX::ESLIF::Grammar::Rule::PropertyBitSet values)

$self->isHideseparator

Returns Hide separator in action callback ? (meaningful only when rule is a sequence)

$self->getHideseparator

Returns Hide separator in action callback ? (meaningful only when rule is a sequence)

Alias to isHideseparator()

DESCRIPTION

ESLIF Grammar Rule Properties.

Calls to grammar's currentRuleProperties() or rulePropertiesByLevel() methods outputs an instance of this class.

SEE ALSO

MarpaX::ESLIF::Rule::PropertyBitSet

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.