Patternist::ExpressionFactory Class Reference
[Expressions]

The central entry point for compiling expressions. More...

#include <ExpressionFactory.h>

Inheritance diagram for Patternist::ExpressionFactory:

Inheritance graph
[legend]
Collaboration diagram for Patternist::ExpressionFactory:

Collaboration graph
[legend]
List of all members.

Public Types

enum  CompilationStage {
  QueryBodyInitial = 1, QueryBodyTypeCheck = 2, QueryBodyCompression = 4, UserFunctionTypeCheck = 8,
  GlobalVariableTypeCheck = 16
}
enum  LanguageAccent { XPath10 = 1, XPath20 = 2, XQuery10 = 4 }
typedef PlainSharedPtr< ExpressionFactoryPtr

Public Member Functions

virtual Expression::Ptr createExpression (const QString &expr, const StaticContext::Ptr &context, const LanguageAccent lang, const SequenceType::Ptr &requiredType)
 ExpressionFactory ()
virtual ~ExpressionFactory ()

Protected Member Functions

virtual void processTreePass (const Expression::Ptr &tree, const CompilationStage stage)

Detailed Description

The central entry point for compiling expressions.

Author:
Frans Englich <frans.englich@telia.com>

Definition at line 30 of file ExpressionFactory.h.


Member Enumeration Documentation

enum Patternist::ExpressionFactory::LanguageAccent

The XPath implementation, emphazing the parser, support different types of languages which all are sub-sets or very close to the XPath 2.0 syntax. This enum is used for communicating what particular language "accent" an expression is of, and should be compiled for.

Author:
Frans Englich <frans.englich@telia.com>
Enumerator:
XPath10  Signifies the XPath 2.0 language.

See also:
XML Path Language (XPath) 2.0
XPath20  Signifies the XPath 1.0 language.

See also:
XML Path Language (XPath) Version 1.0
XQuery10  Signifies the XQuery 1.0 language.
See also:
XQuery 1.0: An XML Query Language

Definition at line 47 of file ExpressionFactory.h.


Member Function Documentation

Expression::Ptr ExpressionFactory::createExpression ( const QString &  expr,
const StaticContext::Ptr context,
const LanguageAccent  lang,
const SequenceType::Ptr requiredType 
) [virtual]

Creates a compiled representation of the XPath expression expr, with Static Context information supplied via context. This is for example whether the expression is an XPath 1.0 or XPath 2.0 expression, or what functions that are available.

requiredType specifies what type results of the evaluating the expression must match. Passing CommonValues::ZeroOrMoreItems allows anything as result, while passing CommonSequenceTypes::EBV means anything but an Effective Boolean Value extractable result is a type error, for example.

Note:
An empty expr is an invalid XPath expression. It will be reported as such, but it is neverthless the caller's resonsibility to ensure that it's not that(since it is likely invalid already in the medium it was stored).

Definition at line 38 of file ExpressionFactory.cpp.

References Patternist::PlainSharedPtr< T >::get(), Patternist::OptimizationPasses::Coordinator::init(), processTreePass(), XPathparse(), and Patternist::CommonSequenceTypes::ZeroOrMoreItems.

Here is the call graph for this function:

void ExpressionFactory::processTreePass ( const Expression::Ptr tree,
const CompilationStage  stage 
) [protected, virtual]

This function is called by createExpression() each time after a pass on the AST has been completed. Under a typical compilation this function is thus called three times: after the initial build, after the Expression::typeCheck() stage, and after Expression::compress(). tree is the AST after each pass.

This mechanism is currently used for debugging, since it provides a way of introspecting what the compilation process do to the tree. The current implementation do nothing.

Definition at line 108 of file ExpressionFactory.cpp.

Referenced by createExpression().

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Feb 8 14:54:33 2007 for Patternist by  doxygen 1.5.1