@@ 1863-1880 (lines=18) @@ | ||
1860 | * |
|
1861 | * @return \Doctrine\ORM\Query\AST\ConditionalExpression |
|
1862 | */ |
|
1863 | public function ConditionalExpression() { |
|
1864 | $conditionalTerms = array(); |
|
1865 | $conditionalTerms[] = $this->ConditionalTerm(); |
|
1866 | ||
1867 | while ($this->lexer->isNextToken(Lexer::T_OR)) { |
|
1868 | $this->match(Lexer::T_OR); |
|
1869 | ||
1870 | $conditionalTerms[] = $this->ConditionalTerm(); |
|
1871 | } |
|
1872 | ||
1873 | // Phase 1 AST optimization: Prevent AST\ConditionalExpression |
|
1874 | // if only one AST\ConditionalTerm is defined |
|
1875 | if (count($conditionalTerms) == 1) { |
|
1876 | return $conditionalTerms[0]; |
|
1877 | } |
|
1878 | ||
1879 | return new AST\ConditionalExpression($conditionalTerms); |
|
1880 | } |
|
1881 | ||
1882 | /** |
|
1883 | * ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}* |
|
@@ 1887-1904 (lines=18) @@ | ||
1884 | * |
|
1885 | * @return \Doctrine\ORM\Query\AST\ConditionalTerm |
|
1886 | */ |
|
1887 | public function ConditionalTerm() { |
|
1888 | $conditionalFactors = array(); |
|
1889 | $conditionalFactors[] = $this->ConditionalFactor(); |
|
1890 | ||
1891 | while ($this->lexer->isNextToken(Lexer::T_AND)) { |
|
1892 | $this->match(Lexer::T_AND); |
|
1893 | ||
1894 | $conditionalFactors[] = $this->ConditionalFactor(); |
|
1895 | } |
|
1896 | ||
1897 | // Phase 1 AST optimization: Prevent AST\ConditionalTerm |
|
1898 | // if only one AST\ConditionalFactor is defined |
|
1899 | if (count($conditionalFactors) == 1) { |
|
1900 | return $conditionalFactors[0]; |
|
1901 | } |
|
1902 | ||
1903 | return new AST\ConditionalTerm($conditionalFactors); |
|
1904 | } |
|
1905 | ||
1906 | public function ConditionalFactor() { |
|
1907 | $not = false; |