Hint: In case you are wondering where the T_ constants come from, they are internal
type used for parsing code. They cover most of the common token names we usually need. Keep in mind their value is not
guaranteed so don't use numbers for comparison.

Processing the tokens

Now we know how to create tokens from string. Let's effectively process them using Stream. It has a lot of really awesome methods if you need to
traverse tokens!

Let's try to parse a simple annotation from PHPDoc and create an object from it. What regular expressions do we need for
tokens? All the annotations start with @, then there is a name, whitespace and it's value.

@ for the annotation start

\s+ for whitespaces

\w+ for strings

(Never use capturing subpatterns in Tokenizer's regular expressions like '(ab)+c', use only non-capturing ones
'(?:ab)+c'.)

This should work on simple annotations, right? Now let's define few classes to demonstrate.

So what the parse() method does? It iterates over the tokens and searches for @ which is the symbol
annotations start with. Calling nextToken() moves the cursor to the next token. Method isCurrent()
checks if the current token at the cursor is the given type. Then, if the @ is found, the parse() method
calls parseAnnotation() which expects the annotations to be in a very speficic format.

First, using the method joinUntil(), the stream keeps moving the cursor and appending the tokens values to the
buffer until it finds token of required type, then stops and returns the buffer output. Because there is only one token of type
T_STRING at that given position and it's 'name', there will be value 'name' in variable
$name.

Method nextUntil() is similar like joinUntil() but it has no buffer. It only moves the cursor until
it finds the token. So this call simply skips all the whitespaces after annotation name.

And then, there is another joinUntil(), that searches for next @. This specific call will return
"David Grudl\n ".

And there we go, we've parsed one whole annotation! Now we can create an instance of class for that specific annotation and
pass it the parsed value. The $content probably ends with whitespaces, so we have to trim it.

Try copypasting the code and running it. If you dump the $annotations variable it should return some similar
output.