public function next(SourceBuffer $generator)
	{
		while(isset($this->tokens[$this->index]))
		{
			$tok = $this->tokens[$this->index++];
				
			if(is_array($tok))
			{
				switch($tok[0])
				{
					case T_COMMENT:
						$generator->append($tok);
						$this->comment = '';
						continue 2;
					case T_WHITESPACE:
						$generator->append($tok);
						continue 2;
					case T_DOC_COMMENT:
						$generator->append($tok);
						$this->comment = trim($tok[1]);
						continue 2;
					case T_CURLY_OPEN:
					case T_DOLLAR_OPEN_CURLY_BRACES:
					case T_STRING_VARNAME:
						$this->depth++;
						$this->comment = '';
						break;
					case T_CLOSE_TAG:
						$this->comment = '';
						break;
				}
			}
			else
			{
				switch($tok)
				{
					case '{':
						$this->depth++;
						$this->comment = '';
						break;
					case '}':
						$this->depth--;
						$this->comment = '';
						break;
					case ';':
					case ',':
						$this->comment = '';
						break;
				}
			}
				
			return $tok;
		}
	
		return false;
	}
public function next(SourceBuffer $generator)
	{
		while(isset($this->tokens[$this->index]))
		{
			$tok = $this->tokens[$this->index++];
				
			if(is_array($tok))
			{
				switch($tok[0])
				{
					case T_COMMENT:
						$generator->append($tok);
						$this->comment = '';
						continue 2;
					case T_WHITESPACE:
						$generator->append($tok);
						continue 2;
					case T_DOC_COMMENT:
						$generator->append($tok);
						$this->comment = trim($tok[1]);
						continue 2;
					case T_CURLY_OPEN:
					case T_DOLLAR_OPEN_CURLY_BRACES:
					case T_STRING_VARNAME:
						$this->depth++;
						$this->comment = '';
						break;
					case T_CLOSE_TAG:
						$this->comment = '';
						break;
				}
			}
			else
			{
				switch($tok)
				{
					case '{':
						$this->depth++;
						$this->comment = '';
						break;
					case '}':
						$this->depth--;
						$this->comment = '';
						break;
					case ';':
					case ',':
						$this->comment = '';
						break;
				}
			}
				
			return $tok;
		}
	
		return false;
	}
public function next ( SourceBuffer $ generator ) { while ( isset ( $ this -> tokens [ $ this -> index ] ) ) { $ tok = $ this -> tokens [ $ this -> index ++ ] ; if ( is_array ( $ tok ) ) { switch ( $ tok [ 0 ] ) { case T_COMMENT : $ generator -> append ( $ tok ) ; $ this -> comment = '' ; continue 2 ; case T_WHITESPACE : $ generator -> append ( $ tok ) ; continue 2 ; case T_DOC_COMMENT : $ generator -> append ( $ tok ) ; $ this -> comment = trim ( $ tok [ 1 ] ) ; continue 2 ; case T_CURLY_OPEN : case T_DOLLAR_OPEN_CURLY_BRACES : case T_STRING_VARNAME : $ this -> depth ++ ; $ this -> comment = '' ; break ; case T_CLOSE_TAG : $ this -> comment = '' ; break ; } } else { switch ( $ tok ) { case '{' : $ this -> depth ++ ; $ this -> comment = '' ; break ; case '}' : $ this -> depth -- ; $ this -> comment = '' ; break ; case ';' : case ',' : $ this -> comment = '' ; break ; } } return $ tok ; } return false ; }
Read the next token from the stream, comments and whitespace will be ignored.

@param SourceBuffer $generator
@return mixed A token as array or string or false on EOF.
Read the next token from the stream comments and whitespace will be ignored .