fishman/ctags — pull request #119 by b4n (2014-11-10 19:08:28+00:00)
Title: CSS: Replace the CSS parser with a new more powerful token-based one

When trying to merge Geany changes to the CSS parser back into CTags, I realized that they both had glaring problems that were very tricky to solve with the structure of the parser. The `css-singlequote-in-comment-issue2` failing test case is a good example, as comments couldn't be treated the same inside or outside of a definition.

So, instead of trying to patch everywhere the obviously broken code and end up with a still broken result, I chose to rewrite a simple token-based parser for it. The result is a simple and a bit naive parser, yet more solid and powerful than the old one.
The structure of the parser should also make it easier to add support for something like SCSS nesting, although it isn't done yet and requires some changes.

To achieve this I had to write many test cases as there only was one. I wrote both simple and naive tests for basic functionality, and tests for specific features the parser had. I am confident I covered everything the old parser supported, but please tell me if I missed anything.

Some highlights:
* Comments inside definitions don't break parsing anymore (nor any comments anywhere)
* Adds support for [attribute and namespace selectors](http://www.w3.org/TR/selectors/#selectors)
* Adds support for [@supports](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports) blocks
* Fixes tag types (used to report the type of the first selector element, while it should report the last as it actually select the last element)