#include <ExpressionFactory.h>
Inheritance diagram for Patternist::ExpressionFactory:


Public Types | |
| enum | CompilationStage { QueryBodyInitial = 1, QueryBodyTypeCheck = 2, QueryBodyCompression = 4, UserFunctionTypeCheck = 8, GlobalVariableTypeCheck = 16 } |
| enum | LanguageAccent { XPath10 = 1, XPath20 = 2, XQuery10 = 4 } |
| typedef PlainSharedPtr< ExpressionFactory > | Ptr |
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) |
Definition at line 30 of file ExpressionFactory.h.
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.
| XPath10 |
Signifies the XPath 2.0 language.
|
| XPath20 |
Signifies the XPath 1.0 language.
|
| XQuery10 |
Signifies the XQuery 1.0 language.
|
Definition at line 47 of file ExpressionFactory.h.
| 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.
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:

1.5.1