示例#1
0
 /**
  * Parses the source expressions to the PHP code.
  *
  * @param string $expression The expression source
  * @return array
  */
 public function parse($expr)
 {
     $this->_unique = 0;
     $this->_expression = $expr;
     $lexer = new Opt_Expression_Standard_Lexer($expr);
     $parser = new Opt_Expression_Standard_Parser($this);
     while ($lexer->yylex()) {
         if ($lexer->token != 'w') {
             $parser->doParse($lexer->token, $lexer->value);
         }
     }
     $parser->doParse(0, 0);
     $exprType = Opt_Expression_Interface::COMPOUND;
     if ($this->_assign == true) {
         $exprType = Opt_Expression_Interface::ASSIGNMENT;
     }
     $this->_assign = false;
     return array('bare' => $this->_compiled, 'expression' => $this->_compiled, 'format' => $this->_format, 'complexity' => $this->_complexity, 'type' => $exprType);
 }
示例#2
0
 static function PrintTrace()
 {
     self::$yyTraceFILE = fopen('php://output', 'w');
     self::$yyTracePrompt = '<br>';
 }