#931 Pygments Fantom Lexer

andy Mon 25 Jan 2010

Bitbucket uses the Pygment project for syntax highlighting its source code listings. Currently we're missing a Fantom lexer, so if anyone is interested in contributing one, head over to: http://pygments.org/contribute/.

ivan Sun 16 Oct 2011

This weekend I started working on Fantom lexer for Pygments - Bitbucket link. So far I've added support for usings, comments, keywords, numbers, strings and URIs. Currently it looks like this:

My next plan to add slot and local var declaration detection, but it seems a bit tricky to do correctly.

I'd like to hear any feedback – comments on choice of token types (http://pygments.org/docs/tokens/), sample files to check highlighting, and especially pull requests :)

andy Sun 16 Oct 2011

Sweet! Can't wait to get this working in BitBucket ;)

brian Mon 17 Oct 2011

Looks very nice, one thing you might want to have in your test is DSLs like Str<||> and Regex<||> - I typically just treat <||> like a string literal.

ivan Mon 17 Oct 2011

Thanks!

DSL support done, also added support for type/slot literals – example

tcolar Mon 17 Oct 2011

Pretty cool, walmost started working on that few weeks ago, as I'd really like to see more than black text on bitbucket :)

I don't have the time, so glad you are ding it !

ivan Tue 18 Oct 2011

Finally I made some initial detection of method definitions, here's an example of highlighted compiler::Parserhttp://cdn.bitbucket.org/ivan_inozemtsev/fantom-pygments/downloads/Parser.html

I think that's enough for the first version, and more advanced highlighting will require more effort, so I'm going to test it thoroughly on different sources to catch obvious mistakes and then try to propose it into pygments.

andy Tue 18 Oct 2011

Nice work ivan - definitely looks usable. Do you get any control over the color scheme on BitBucket? Or is it up to them?

ivan Tue 18 Oct 2011

Thanks, Andy

In fact I have no idea – pygments lib separates lexers and colorers and I don't know what is the default scheme bitbucket uses. However pygments has docs about contributing their own colorers, so probably there's way to submit default colorer for a given lexer

Login or Signup to reply.