MarpaX-ESLIF
view release on metacpan or search on metacpan
lib/MarpaX/ESLIF/BNF.pod view on Meta::CPAN
ERROR grammar_ko callback returned a string that cannot be converted to a grammar
ERROR <luascript/>:9: Errors are trapped...
ERROR action_raising_error callback failed
ERROR <luascript/>:9: No such function unknown_action
ERROR unknown_action callback failed
NOTICE ... Grammar parse result: 5
=item Lookahead
Any RHS surrounded by C<(?=...)> or C<(?!...)> is interpreted to a positive or negative lookahead, respectively. Internally, it is processed like a lexeme, and will result in a zero-length lexeme in case of match. You can skip it in the rule valuatio...
lhs ::= (-(?= /anything/ )-)
will do a positive lookahead of regular expression C</anything/> and skip it in the rule's valuation.
=back
=head2 Grammar meta settings
=over
=item Start rule
By default, the first symbol of a grammar of level C<n> is its start symbol. This can be set once with e.g.:
:start ::= symbolname
=item Grammar description
By default, a grammar of level C<n> has the description C<Grammar level n>. This can be set once with e.g.:
:desc ::= 'A single-quoted string'
=item Settings sub grammar
Any setting consist of a reserved keyword, followed by C<< => >> or the Rightwards Double Arrow UTF-8 character C<â>, followed by a setting-specific value:
action => myAction
action â myAction
When you use the C<â> UTF-8 character, it is recommended to say that the grammar itself is encoded in UTF-8 (c.f. C<marpaESLIFGrammarOption> structure).
=item Defaults
By default, symbol action is C<::transfer> and rule action is C<::concat>, i.e. the parse tree value of a grammar is a binary concatenation of every input representation (see the I<representation> section below), without the eventual discard. Stack m...
:default ::= action => defaultRuleAction
latm => 1
discard-is-fallback => 0
symbol-action => defaultSymbolAction
regex-action => defaultRegexAction
default-encoding => UTF-8
fallback-encoding => UTF-16
Predefined actions are available for rules and symbols. Please refer the API documentation to know more about value types.
The C<symbol-action> adverb is how a match within a sub-grammar is transfered.
The C<default-encoding> adverb gives default encoding when the recognizer runs in character mode and the end-user gave no encoding.
The C<fallback-encoding> adverb gives fallback encoding when the recognizer runs in character mode and the end-user gave no encoding nor C<default-encoding>. Then MarpaX::ESLIF will try to I<guess> the encoding, and if this fail, will fallback to thi...
The C<discard-is-fallback> adverb indicates ESLIF that C<:discard> should not be tried whenever scan/resume is entered. The default is the safe implementation, i.e. it is always tried, and no grammar terminal will match if C<:discard> matches an equa...
=item Meta actions
=over
=item C<::undef>
Creates a value of type UNDEF.
Meaningful for both rule and symbol actions.
=item C<::ascii>
Creates a value of type STRING, with encoding "ASCII", from the right-hand side representation, guaranteed to be a NUL byte terminated sequence of ASCII characters, or UNDEF if representation is empty. Please refer to the I<representation> section be...
Meaningful for both rule and symbol actions.
=item C<::convert[[^]]+]>
Creates a value of type STRING from the right-hand side representation encoded in the charset specified within the brackets, or UNDEF if representation is empty. I<iconv> convention is used for the charset, i.e. a charset name, followed by eventual o...
Please refer to the I<representation> section below.
Meaningful for both rule and symbol actions.
=item C<::concat>
Creates a value of type ARRAY from the binary concatenatation all the RHS's representation, or UNDEF if representation is empty.
Please refer to the I<representation> section below.
Meaningful for both rule and symbol actions, and is the B<default rule action>.
=item C<::copy[x]>
Copies the RHS number C<x> (first RHS is at indice C<0>), putting UNDEF if it does not exist. This action is the only one that guarantees that the nature of the RHS value is unchanged.
Meaningful only for rule actions.
=item C<::shift>
Alias for C<::copy[0]>.
=item C<::transfer>
Copies the single RHS number value. This action guarantees that the nature of the RHS value is unchanged.
Meaningful only for symbol actions, and is the B<default symbol action>.
=item C<::true>
Creates a value of type BOOL, containing a true value.
Meaningful for both rule and symbol actions.
=item C<::false>
Creates a value of type BOOL, containing a false value.
( run in 1.991 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )