# OqlParser Class Reference
[Object Query Language based on Criteria]

Inheritance diagram for OqlParser:
[legend]

List of all members.

## Public Member Functions

| parse ($string=null)
| getTokenizer ()
| setTokenizer (OqlTokenizer $tokenizer)

## Public Attributes

const | INITIAL_STATE = 254
const | FINAL_STATE = 255
const | PREFIX_UNARY_EXPRESSION = 1
const | POSTFIX_UNARY_EXPRESSION = 2
const | BINARY_EXPRESSION = 3
const | BETWEEN_EXPRESSION = 4
const | LOGIC_PRIORITY_OR = 1
const | LOGIC_PRIORITY_AND = 2
const | LOGIC_PRIORITY_LT_GT = 3
const | LOGIC_PRIORITY_EQ = 4
const | LOGIC_PRIORITY_TERMINAL = 5
const | LOGIC_PRIORITY_LOWEST = self::LOGIC_PRIORITY_OR
const | LOGIC_PRIORITY_UNARY_NOT = self::LOGIC_PRIORITY_LT_GT
const | ARITHMETIC_PRIORITY_ADD = 1
const | ARITHMETIC_PRIORITY_MUL = 2
const | ARITHMETIC_PRIORITY_TERMINAL = 3
const | ARITHMETIC_PRIORITY_LOWEST = self::ARITHMETIC_PRIORITY_ADD

## Protected Member Functions

| makeOqlObject ()
| handleState ()
| getTokenValue ($token, $raw=false)
| checkToken ($token, $type, $value=null)
| checkKeyword ($token, $value)
| checkIdentifier ($token)
| checkConstant ($token)
| checkUnaryMinus ($token)
| checkParentheses ($message=null)
| openParentheses ($required, $message=null)
| closeParentheses ($required, $message=null)
| getIdentifierExpression ()
| getConstantExpression ()
| getLogicExpression ($priority=self::LOGIC_PRIORITY_LOWEST)
| getArithmeticExpression ($priority=self::ARITHMETIC_PRIORITY_LOWEST)
| getCommaSeparatedList ($callback, $message)
| makeQueryExpression ($className)
| makeQuerySignedExpression ($argument, $isUnaryMinus)
| makeQueryParameter ($argument)
| error ($message, $extraMessage=null)

## Protected Attributes

| $state = null
| $tokenizer = null
| $oqlObject = null
| $parentheses = null

## Private Member Functions

| isArithmeticExpression ()
| getArithmeticArgumentExpression ()

## Static Private Attributes

static | $classMap
static | $binaryOperatorMap
static | $logicPriorityMap
static | $arithmeticPriorityMap

## Detailed Description

Definition at line 15 of file OqlParser.class.php.

## Member Function Documentation

OqlParser::checkConstant | ( | $ | token | ) | `[protected]`

Definition at line 198 of file OqlParser.class.php.

References OqlToken::BOOLEAN, OqlToken::NULL, OqlToken::NUMBER, OqlToken::STRING, and OqlToken::SUBSTITUTION.

OqlParser::checkIdentifier | ( | $ | token | ) | `[protected]`

Definition at line 177 of file OqlParser.class.php.

References OqlToken::AGGREGATE_FUNCTION, OqlToken::IDENTIFIER, and OqlToken::KEYWORD.

Referenced by OqlSelectParser::fromState(), OqlSelectPropertiesParser::getAlias(), getArithmeticArgumentExpression(), and getIdentifierExpression().

OqlParser::checkKeyword | ( | $ | token,
|  | $ | value |
| ) |  |  | `[protected]`

Definition at line 172 of file OqlParser.class.php.

References checkToken(), and OqlToken::KEYWORD.

Referenced by OqlSelectParser::fromState(), OqlSelectPropertiesParser::getAlias(), OqlSelectPropertiesParser::getArgumentExpression(), OqlOrderByParser::getArgumentExpression(), getLogicExpression(), OqlSelectParser::groupByState(), OqlSelectParser::havingState(), OqlSelectParser::limitState(), OqlSelectParser::offsetState(), OqlSelectParser::orderByState(), OqlSelectParser::propertyState(), and OqlSelectParser::whereState().

Here is the call graph for this function:

OqlParser::checkParentheses | ( | $ | message = `null` | ) | `[protected]`

Exceptions:

  | SyntaxErrorException |

Definition at line 219 of file OqlParser.class.php.

References closeParentheses(), error(), and openParentheses().

Referenced by parse().

Here is the call graph for this function:

OqlParser::checkToken | ( | $ | token,
|  | $ | type,
|  | $ | value = `null` |
| ) |  |  | `[protected]`

Definition at line 152 of file OqlParser.class.php.

Referenced by checkKeyword(), checkUnaryMinus(), closeParentheses(), OqlSelectPropertiesParser::getArgumentExpression(), getArithmeticArgumentExpression(), getArithmeticExpression(), getCommaSeparatedList(), getLogicExpression(), isArithmeticExpression(), OqlSelectParser::limitState(), OqlSelectParser::offsetState(), and openParentheses().

OqlParser::checkUnaryMinus | ( | $ | token | ) | `[protected]`

Definition at line 211 of file OqlParser.class.php.

References OqlToken::ARITHMETIC_OPERATOR, and checkToken().

Referenced by getArithmeticExpression(), getConstantExpression(), getIdentifierExpression(), and isArithmeticExpression().

Here is the call graph for this function:

OqlParser::closeParentheses | ( | $ | required,
|  | $ | message = `null` |
| ) |  |  | `[protected]`

Exceptions:

  | SyntaxErrorException |

Definition at line 257 of file OqlParser.class.php.

References checkToken(), error(), and OqlToken::PARENTHESES.

Referenced by checkParentheses(), OqlSelectPropertiesParser::getArgumentExpression(), getArithmeticExpression(), and getLogicExpression().

Here is the call graph for this function:

OqlParser::error | ( | $ | message,
|  | $ | extraMessage = `null` |
| ) |  |  | `[protected]`

Exceptions:

  | SyntaxErrorException |

Definition at line 742 of file OqlParser.class.php.

Referenced by checkParentheses(), closeParentheses(), OqlSelectParser::fromState(), OqlSelectPropertiesParser::getAlias(), getArithmeticExpression(), getCommaSeparatedList(), getLogicExpression(), OqlWhereParser::handleState(), OqlHavingParser::handleState(), OqlSelectParser::limitState(), OqlSelectParser::offsetState(), openParentheses(), and OqlSelectParser::propertyState().

OqlParser::getArithmeticArgumentExpression | ( |  | ) | `[private]`

Returns:
  OqlQueryParameter

Definition at line 781 of file OqlParser.class.php.

References checkIdentifier(), checkToken(), makeQueryParameter(), OqlToken::NUMBER, and OqlToken::SUBSTITUTION.

Referenced by getArithmeticExpression(), and isArithmeticExpression().

Here is the call graph for this function:

OqlParser::getArithmeticExpression | ( | $ | priority = `self::ARITHMETIC_PRIORITY_LOWEST` | ) | `[protected]`

Returns:
  OqlQueryExpression

Definition at line 590 of file OqlParser.class.php.

References OqlToken::ARITHMETIC_OPERATOR, checkToken(), checkUnaryMinus(), closeParentheses(), error(), getArithmeticArgumentExpression(), getTokenValue(), makeQueryExpression(), makeQuerySignedExpression(), and openParentheses().

Referenced by OqlSelectPropertiesParser::getArgumentExpression(), and getLogicExpression().

Here is the call graph for this function:

OqlParser::getCommaSeparatedList | ( | $ | callback,
|  | $ | message |
| ) |  |  | `[protected]`

Definition at line 663 of file OqlParser.class.php.

References checkToken(), error(), and OqlToken::PUNCTUATION.

Referenced by getLogicExpression(), OqlSelectPropertiesParser::handleState(), OqlOrderByParser::handleState(), and OqlGroupByParser::handleState().

Here is the call graph for this function:

OqlParser::getConstantExpression | ( |  | ) | `[protected]`

Returns:
  OqlQueryParameter

Definition at line 298 of file OqlParser.class.php.

References OqlToken::BOOLEAN, checkUnaryMinus(), makeQuerySignedExpression(), OqlToken::NULL, OqlToken::NUMBER, OqlToken::STRING, and OqlToken::SUBSTITUTION.

Referenced by getLogicExpression().

Here is the call graph for this function:

OqlParser::getIdentifierExpression | ( |  | ) | `[protected]`

Returns:
  OqlQueryParameter

Definition at line 279 of file OqlParser.class.php.

References checkIdentifier(), checkUnaryMinus(), and makeQuerySignedExpression().

Referenced by getLogicExpression().

Here is the call graph for this function:

OqlParser::getLogicExpression | ( | $ | priority = `self::LOGIC_PRIORITY_LOWEST` | ) | `[protected]`

Returns:
  OqlQueryExpression

Definition at line 332 of file OqlParser.class.php.

References OqlToken::BOOLEAN, checkKeyword(), checkToken(), closeParentheses(), OqlToken::COMPARISON_OPERATOR, error(), getArithmeticExpression(), getCommaSeparatedList(), getConstantExpression(), getIdentifierExpression(), getTokenValue(), InExpression::IN, PostfixUnaryExpression::IS_FALSE, PostfixUnaryExpression::IS_NOT_NULL, PostfixUnaryExpression::IS_NULL, PostfixUnaryExpression::IS_TRUE, isArithmeticExpression(), OqlToken::KEYWORD, makeQueryExpression(), makeQueryParameter(), PrefixUnaryExpression::NOT, InExpression::NOT_IN, OqlToken::NULL, openParentheses(), OqlToken::STRING, and OqlToken::SUBSTITUTION.

Referenced by OqlSelectPropertiesParser::getArgumentExpression(), OqlOrderByParser::getArgumentExpression(), OqlWhereParser::handleState(), and OqlHavingParser::handleState().

Here is the call graph for this function:

OqlParser::getTokenizer | ( |  | ) |

Returns:
  OqlTokenizer

Definition at line 127 of file OqlParser.class.php.

OqlParser::getTokenValue | ( | $ | token,
|  | $ | raw = `false` |
| ) |  |  | `[protected]`

Definition at line 142 of file OqlParser.class.php.

Referenced by OqlSelectParser::fromState(), OqlSelectPropertiesParser::getAlias(), OqlSelectPropertiesParser::getArgumentExpression(), getArithmeticExpression(), getLogicExpression(), and OqlSelectParser::offsetState().

OqlParser::handleState | ( |  | ) | `[abstract, protected]`

Reimplemented in OqlGroupByParser, OqlHavingParser, OqlOrderByParser, OqlSelectParser, OqlSelectPropertiesParser, and OqlWhereParser.

Referenced by parse().

OqlParser::isArithmeticExpression | ( |  | ) | `[private]`

Definition at line 754 of file OqlParser.class.php.

References OqlToken::ARITHMETIC_OPERATOR, checkToken(), checkUnaryMinus(), getArithmeticArgumentExpression(), and OqlToken::PARENTHESES.

Referenced by getLogicExpression().

Here is the call graph for this function:

OqlParser::makeOqlObject | ( |  | ) | `[abstract, protected]`

Returns:
  OqlQueryClause

Reimplemented in OqlGroupByParser, OqlHavingParser, OqlOrderByParser, OqlSelectParser, OqlSelectPropertiesParser, and OqlWhereParser.

Referenced by parse().

OqlParser::makeQueryExpression | ( | $ | className | ) | `[protected]`

Returns:
  OqlQueryExpression

Definition at line 688 of file OqlParser.class.php.

References OqlQueryExpression::create(), and makeQueryParameter().

Referenced by OqlSelectPropertiesParser::getArgumentExpression(), getArithmeticExpression(), getLogicExpression(), OqlHavingParser::handleState(), and OqlGroupByParser::handleState().

Here is the call graph for this function:

OqlParser::makeQueryParameter | ( | $ | argument | ) | `[protected]`

Returns:
  OqlQueryParameter

Definition at line 723 of file OqlParser.class.php.

References OqlQueryParameter::create(), and OqlToken::SUBSTITUTION.

Referenced by getArithmeticArgumentExpression(), getLogicExpression(), OqlSelectParser::limitState(), makeQueryExpression(), makeQuerySignedExpression(), and OqlSelectParser::offsetState().

Here is the call graph for this function:

OqlParser::makeQuerySignedExpression | ( | $ | argument,
|  | $ | isUnaryMinus |
| ) |  |  | `[protected]`

Returns:
  OqlQueryParameter

Definition at line 711 of file OqlParser.class.php.

References makeQueryParameter().

Referenced by getArithmeticExpression(), getConstantExpression(), and getIdentifierExpression().

Here is the call graph for this function:

OqlParser::openParentheses | ( | $ | required,
|  | $ | message = `null` |
| ) |  |  | `[protected]`

Exceptions:

  | SyntaxErrorException |

Definition at line 237 of file OqlParser.class.php.

References checkToken(), error(), and OqlToken::PARENTHESES.

Referenced by checkParentheses(), OqlSelectPropertiesParser::getArgumentExpression(), getArithmeticExpression(), and getLogicExpression().

Here is the call graph for this function:

OqlParser::parse | ( | $ | string = `null` | ) |

Returns:
  OqlQueryClause

Definition at line 102 of file OqlParser.class.php.

References checkParentheses(), handleState(), Assert::isNotNull(), Assert::isString(), and makeOqlObject().

Referenced by OqlSelectParser::groupByState(), OqlSelectParser::havingState(), OqlSelectParser::orderByState(), OqlSelectParser::propertyState(), and OqlSelectParser::whereState().

Here is the call graph for this function:

OqlParser::setTokenizer | ( | OqlTokenizer $ | tokenizer | ) |

Returns:
  OqlParser

Definition at line 135 of file OqlParser.class.php.

Referenced by OqlSelectParser::groupByState(), OqlSelectParser::havingState(), OqlSelectParser::orderByState(), OqlSelectParser::propertyState(), and OqlSelectParser::whereState().

## Member Data Documentation

OqlParser::$arithmeticPriorityMap`[static, private]`

Initial value:

     array(
                self::ARITHMETIC_PRIORITY_ADD       => array('+', '-'),
                self::ARITHMETIC_PRIORITY_MUL       => array('*', '/'),
                self::ARITHMETIC_PRIORITY_TERMINAL  => null
            )

Definition at line 80 of file OqlParser.class.php.

OqlParser::$binaryOperatorMap`[static, private]`

Initial value:

     array(
                '='                 => BinaryExpression::EQUALS,
                '!='                => BinaryExpression::NOT_EQUALS,
                'and'               => BinaryExpression::EXPRESSION_AND,
                'or'                => BinaryExpression::EXPRESSION_OR,
                '>'                 => BinaryExpression::GREATER_THAN,
                '>='                => BinaryExpression::GREATER_OR_EQUALS,
                '<'                 => BinaryExpression::LOWER_THAN,
                '<='                => BinaryExpression::LOWER_OR_EQUALS,
                'like'              => BinaryExpression::LIKE,
                'not like'          => BinaryExpression::NOT_LIKE,
                'ilike'             => BinaryExpression::ILIKE,
                'not ilike'         => BinaryExpression::NOT_ILIKE,
                'similar to'        => BinaryExpression::SIMILAR_TO,
                'not similar to'    => BinaryExpression::NOT_SIMILAR_TO,
                '+'                 => BinaryExpression::ADD,
                '-'                 => BinaryExpression::SUBSTRACT,
                '*'                 => BinaryExpression::MULTIPLY,
                '/'                 => BinaryExpression::DIVIDE
            )

Definition at line 34 of file OqlParser.class.php.

OqlParser::$classMap`[static, private]`

Initial value:

     array(
                self::PREFIX_UNARY_EXPRESSION   => 'PrefixUnaryExpression',
                self::POSTFIX_UNARY_EXPRESSION  => 'PostfixUnaryExpression',
                self::BINARY_EXPRESSION         => 'BinaryExpression',
                self::BETWEEN_EXPRESSION        => 'LogicalBetween'
            )

Reimplemented in OqlSelectPropertiesParser.

Definition at line 26 of file OqlParser.class.php.

OqlParser::$logicPriorityMap`[static, private]`

Initial value:

     array(
                self::LOGIC_PRIORITY_OR         => 'or',
                self::LOGIC_PRIORITY_AND        => 'and',
                self::LOGIC_PRIORITY_LT_GT      => array('>', '<', '>=', '<='),
                self::LOGIC_PRIORITY_EQ         => array('=', '!='),
                self::LOGIC_PRIORITY_TERMINAL   => null
            )

Definition at line 65 of file OqlParser.class.php.

OqlParser::$oqlObject = null`[protected]`

Definition at line 88 of file OqlParser.class.php.

OqlParser::$parentheses = null`[protected]`

Definition at line 90 of file OqlParser.class.php.

OqlParser::$state = null`[protected]`

Definition at line 86 of file OqlParser.class.php.

OqlParser::$tokenizer = null`[protected]`

Definition at line 87 of file OqlParser.class.php.

const OqlParser::ARITHMETIC_PRIORITY_ADD = 1

Definition at line 74 of file OqlParser.class.php.

const OqlParser::ARITHMETIC_PRIORITY_LOWEST = self::ARITHMETIC_PRIORITY_ADD

Definition at line 78 of file OqlParser.class.php.

const OqlParser::ARITHMETIC_PRIORITY_MUL = 2

Definition at line 75 of file OqlParser.class.php.

const OqlParser::ARITHMETIC_PRIORITY_TERMINAL = 3

Definition at line 76 of file OqlParser.class.php.

const OqlParser::BETWEEN_EXPRESSION = 4

Definition at line 24 of file OqlParser.class.php.

const OqlParser::BINARY_EXPRESSION = 3

Definition at line 23 of file OqlParser.class.php.

const OqlParser::FINAL_STATE = 255

Definition at line 18 of file OqlParser.class.php.

const OqlParser::INITIAL_STATE = 254

Definition at line 17 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_AND = 2

Definition at line 57 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_EQ = 4

Definition at line 59 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_LOWEST = self::LOGIC_PRIORITY_OR

Definition at line 62 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_LT_GT = 3

Definition at line 58 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_OR = 1

Definition at line 56 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_TERMINAL = 5

Definition at line 60 of file OqlParser.class.php.

const OqlParser::LOGIC_PRIORITY_UNARY_NOT = self::LOGIC_PRIORITY_LT_GT

Definition at line 63 of file OqlParser.class.php.

const OqlParser::POSTFIX_UNARY_EXPRESSION = 2

Definition at line 22 of file OqlParser.class.php.

const OqlParser::PREFIX_UNARY_EXPRESSION = 1

Definition at line 21 of file OqlParser.class.php.

The documentation for this class was generated from the following file:

- main/OQL/Parsers/OqlParser.class.php