NAME
Text::Query::Parse - Base class for query parsers
SYNOPSIS
package Text::Query::ParseThisSyntax;
use Text::Query::Parse;
use vars qw(@ISA);
@ISA = qw(Text::Query::Parse);
DESCRIPTION
This module provides a virtual base class for query parsers.
It defines the prepare method that is called by the Text::Query object to compile the query string.
MEMBERS
- -build Pointer to a Text::Query::Build object.
- scope Scope stack. Defines the context in which the query must be solved.
- token The current token. Destroyed by
prepare. - tokens A reference to the list of all the tokens. Filled by parse_tokens. Destroyed by
prepare. - parseopts A reference to a hash table containing all the parameters given to the
preparefunction. - -verbose Integer indicating the desired verbose level.
METHODS
- prepare (QSTRING [OPTIONS])
-
Compiles the query expression in
QSTRINGto internal form and sets any options. First callsbuild_initto reset the builder and destroy thetokenandtokensmembers. Then callsparse_tokensto fill thetokensmember. Then callsexpressionto use the tokens fromtokens. Theexpressionis expected to call thebuild_*functions to build the compiled expression. At last callsbuild_final_expressionwith the result ofexpression.A derived parser must redefine this function to define default values for specific options.
- expression ()
-
Must be redefined by derived package. Returns the internal form of the question built from
build_*functions using thetokens. - parse_tokens (QSTRING)
-
Must be redefined by derived package. Parses the
QSTRINGscalar and fills thetokensmember with lexical units. - build_*
-
Shortcuts to the corresponding function of the Text::Query::Build object found in the
-buildmember.
OPTIONS
These are the options of the prepare method and the constructor.
- -quotes defaults to \'\"
-
Defines the quote characters.
- -case defaults to 0
-
If true, do case-sensitive match.
- -litspace defaults to 0
-
If true, match spaces (except between operators) in
QSTRINGliterally. If false, match spaces as\s+. - -regexp defaults to 0
-
If true, treat patterns in
QSTRINGas regular expressions rather than literal text. - -whole defaults to 0
-
If true, match whole words only, not substrings of words.
SEE ALSO
Text::Query(3)
AUTHORS
Eric Bohlman (ebohlman@netcom.com)
Loic Dachary (loic@senga.org)