Example #1
0
 /**
  * Asserts that a valid end of statement follows the current position
  * 
  * @return boolean
  * 
  * @throws Exception
  */
 protected function assertEndOfStatement()
 {
     //The end of statement is reached when it is followed by line
     //terminators, end of source, "}" or ";". In the last case the token
     //must be consumed
     if (!$this->scanner->noLineTerminators()) {
         return true;
     } else {
         if ($this->scanner->consume(";")) {
             return true;
         }
         $token = $this->scanner->getToken();
         if (!$token || $token->getValue() === "}") {
             return true;
         }
     }
     return $this->error();
 }