public function OrderByItem()
{
$type = 'ASC';
// We need to check if we are in a ResultVariable or StateFieldPathExpression
$glimpse = $this->_lexer->glimpse();
if ($glimpse['type'] != Lexer::T_DOT) {
$token = $this->_lexer->lookahead;
$expr = $this->ResultVariable();
} else {
$expr = $this->StateFieldPathExpression();
}
$item = new AST\OrderByItem($expr);
if ($this->_lexer->isNextToken(Lexer::T_ASC)) {
$this->match(Lexer::T_ASC);
} else if ($this->_lexer->isNextToken(Lexer::T_DESC)) {
$this->match(Lexer::T_DESC);
$type = 'DESC';
}
$item->type = $type;
return $item;
}