Initial import on SourceForge

SVN:code[2]
This commit is contained in:
Denis Flaven
2009-03-13 17:13:48 +00:00
parent 02a9fe6429
commit ec48618573
347 changed files with 47666 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?
class OqlNormalizeException extends OQLException
{
}
class OqlInterpreterException extends OQLException
{
}
class OqlInterpreter
{
public $m_sQuery;
public function __construct($sQuery)
{
$this->m_sQuery = $sQuery;
}
protected function Parse()
{
$oLexer = new OQLLexer($this->m_sQuery);
$oParser = new OQLParser($this->m_sQuery);
while($oLexer->yylex())
{
$oParser->doParse($oLexer->token, $oLexer->value, $oLexer->getTokenPos());
}
$res = $oParser->doFinish();
return $res;
}
public function ParseQuery()
{
$oRes = $this->Parse();
if (!$oRes instanceof OqlQuery)
{
throw new OqlException('Expecting an OQL query', $this->m_sQuery, 0, 0, get_class($oRes), array('OqlQuery'));
}
return $oRes;
}
public function ParseExpression()
{
$oRes = $this->Parse();
if (!$oRes instanceof Expression)
{
throw new OqlException('Expecting an OQL expression', $this->m_sQuery, 0, 0, get_class($oRes), array('Expression'));
}
return $oRes;
}
}
?>