gniezen/n3pygments — pull request #2 by uholzer (2013-07-20 18:56:06+00:00)
Title: N3 lexer: support for formulas and more

I have taken a shot at adding missing features to the N3 lexer. Unfortunately it ended up in a rewrite. It should follow more closely the [grammar](http://www.w3.org/2000/10/swap/grammar/n3-ietf.txt). Note that the grammar is not correct in all aspects.

New features:
- Formulas in curly braces `{ ... }`
- quick variables (starting with `?`)
- quantifiers `@forSome`, `@forAll`
- numbers and booleans
- `=>`, `=`, `<=`
- property paths with `.`, `^`, `!`, for example `:something.log:uri`

Still to be discussed: Basically, a triple is
```:subject :predicate :object```
This has somehow to be mapped to Pygment's [builtin tokens](http://pygments.org/docs/tokens/).
I still use `Name.Class` for the subject. Using `Operator` for the predicate (like before this rewrite) seems weird, as `Operator` is more for `+`, `*`, and the like. Rather, predicates are binary relations. I use `Name.Function` which is close enough. Using `Name.Attribute` for the object is weird too, but I kept it.
Then there are also property paths, like ':something.log:uri'. I also use `Name.Function` for the part behind the dot.
So, I am not sure which tokens are the right ones. Any advice?

Feel free to demand different Tokens and additional features. Also feel free to reject the whole pull request.

Also, we should get the N3 lexer into Pygments itself. (Another SPARQL lexer has already been proposed to the developers.)

If you like to look at a preview: I currently use my implementation for [one of my articles](http://www.andonyar.com/articles/2013/websites-by-reasoning/)