Ejemplo n.º 1
0
 /**
  * Parses a bracketted expression.
  *
  * @param  Constraint $constraint
  * @return void
  * @throws SparqlParserException
  */
 protected function parseBrackettedExpression(&$constraint)
 {
     $open = 1;
     $exp = "";
     $this->_fastForward();
     while ($open != 0 && current($this->tokens) != false) {
         switch (current($this->tokens)) {
             case "(":
                 $open++;
                 $exp = $exp . current($this->tokens);
                 break;
             case ")":
                 $open--;
                 if ($open != 0) {
                     $exp = $exp . current($this->tokens);
                 }
                 break;
             case false:
                 throw new SparqlParserException("Unexpected end of query.", null, key($this->tokens));
             default:
                 $exp = $exp . current($this->tokens);
                 break;
         }
         next($this->tokens);
     }
     $constraint->addExpression($exp);
 }