The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Pygmentising Ioke

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Sam Aaron

Posts: 22
Nickname: samaaron
Registered: May, 2008

Sam Aaron is interested in the aesthetics of programming languages and domain specific languages
Pygmentising Ioke Posted: Dec 23, 2009 2:01 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Sam Aaron.
Original Post: Pygmentising Ioke
Feed Title: Communicatively Speaking
Feed URL: http://sam.aaron.name/feed/atom.xml
Feed Description: Sam Aaron's blog. Here you'll find interesting discussions on matters such as communicative programming, domain specific languages and music.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Sam Aaron
Latest Posts From Communicatively Speaking

Advertisement

Introducing the IokeLexer

It seems I just can’t stop writing syntax highlighters for Ioke. I started with adding support for TextMate, and then basic support for Geshi. Now, as a present for its P release1 I’ve added Pygments to the list:

Pygments IokeLexer

One of the things that has bugged me since Ioke’s birth is that its incubator, GitHub has not been able to do the honourable thing and highlight it appropriately. Instead, one of the most exciting languages around at the moment has been treated like dirty plain text.

Well, hopefully this can change soon. GitHub happens to use Pygments to highlight its source. Therefore I just need to throw my IokeLexer at the Pocoo chaps, hope they include it in the next version of Pygments and then wait for GitHub to upgrade. At least someone doing the hard work of writing the lexer won’t be the blocker any more…

Just to show its glory2, here’s the introduction example from http://ioke.org

Lessons Learned

OK, so apart from a fairly high number of hours battling with Python regular expressions and Ioke syntax, here’s a summary of the lessons I learned from this experience:

  • You can get pretty far with plain regexps.
  • You can get a long way with regexps and stackable contexts.
  • Writing approximately correct lexers with regexps can be fun.
  • Writing accurate lexers with regexps is for masochists, seriously.
  • Look ahead and behind regexp matchers are truly wonderful.
  • Writing a regexp lexer really helps you to hone your regexp skills.
  • Pygments is nice software.
  • Python people can be a little curt yet are very helpful nevertheless.
  • Nothing beats a real lexer for lexing.

In essence, there really should be a standard syntax for this kind of thing so when the next syntax highlighting engine comes around we don’t have to continue to re-invent the wheel.


  1. Perhaps the P in the strange Ioke version naming scheme stands for Pygments? ;-)

  2. This blog also happens to currently use Pygments to highlight its source.

Read: Pygmentising Ioke

Topic: Aleksey Gureiev Winner RPCFN #4 Previous Topic   Next Topic Topic: What's New in Edge Rails: Set Flash in redirect_to

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use