Alt-CWB-ambs
view release on metacpan or search on metacpan
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
entire group. Note that the return value of the DPP rule calling
B<BeginGroup> becomes part of the bracketing group output. If this is not
desired, the rule must return an empty string (C<"">). Rules can also check
whether they are in a nested group with the help of the B<NestingLevel> method
(which returns 0 at the top level).
The example below extends our simple query language with regexp-style
parenthesised groups, quantifiers (C<?>, C<*>, C<+>) and alternatives (C<|>).
In order to simplify the implementation, metacharacters must be separated from
wordform patterns and from other metacharacters by blanks; and quantifiers
must be attached directly to a closing parenthesis (otherwise, the question
mark in C<) ?> would be ambiguous between a quantifier and a wildcard pattern
matching a single character). Note that the C<simple_query> rule is
practically identical to C<wordform_sequence> above, but has been renamed to
reflect its new semantics.
sub simple_query {
my ($self, $input) = @_;
my @items = split " ", $input;
my @cqp_tokens = $self->Apply("simple_query_item", @items);
return "@cqp_tokens";
( run in 1.489 second using v1.01-cache-2.11-cpan-e1769b4cff6 )