Refactoring of twig token parser: extract method

Extracted method, parsing the head of twig tags. This change allows anyone write other token parsers (i.e., I want to implement tags `register_javascript` and `register_stylesheet`)