/** * * 单一关键字,如:null, false, true, undefined, new * @param boolean $allowCalls */ public function exprAtomAst($allowCalls = false) { if ($this->isToken(FL_TOKEN_JS_OPERATOR, "new")) { $this->getNextToken(); $this->newStatement(); } if ($this->isToken(FL_TOKEN_JS_PUNC)) { switch ($this->currentToken['value']) { case "(": $this->getNextToken(); $value = $this->expressionAst(); $this->expectToken(FL_TOKEN_JS_PUNC, ")"); return $this->subScripts($value, $allowCalls); case "[": $this->getNextToken(); return $this->subScripts($this->arrayStatement(), $allowCalls); case "{": $this->getNextToken(); return $this->subScripts($this->objectStatement(), $allowCalls); } $this->unexpectTokenError(); } if ($this->isToken(FL_TOKEN_JS_KEYWORD, "function")) { $this->getNextToken(); return $this->subScripts($this->functionStatement(false), $allowCalls); } if (Fl_Js_Static::isAtomStartType($this->currentToken['type'])) { if ($this->currentToken['type'] === FL_TOKEN_JS_REGEXP) { $atom = array("regexp", $this->currentToken['value'][0], $this->currentToken['value'][1]); } else { $atom = array($this->currentToken['type'], $this->currentToken['value']); } $this->getNextToken(); return $this->subScripts($atom, $allowCalls); } $this->unexpectTokenError(); }