Follow up with yesterday:
you can get my Scala syntax gem extension here, and read below for the instructions on how to install it.
First here is the result:
/** so much fun */ class Auction(seller: Actor, minBid: Int, closing: Date) extends Actor { val StringForFun = "hello" val timeToShutdown = 36000000 // msec val bidIncrement = 10 def act() { var maxBid = minBid - bidIncrement var maxBidder: Actor = null var running = true while (running) { receiveWithin ((closing.getTime() - new Date().getTime())) { case Offer(bid, client) => if (bid >= maxBid + bidIncrement) { if (maxBid >= minBid) maxBidder ! BeatenOffer(bid) maxBid = bid; maxBidder = client; client ! BestOffer } else { client ! BeatenOffer(maxBid) } case Inquire(client) => client ! Status(maxBid, closing) case TIMEOUT => if (maxBid >= minBid) { val reply = AuctionConcluded(seller, maxBidder) maxBidder ! reply; seller ! reply } else { seller ! AuctionFailed } receiveWithin(timeToShutdown) { case Offer(_, client) => client ! AuctionOver case TIMEOUT => running = false } } } } }
You will need to add those CSS elements to display things correctly:
pre {
background: #000000 repeat-x;
color: #00FF00;
font-family: arial, 'lucida console', sans-serif;
line-height: 160%;
font-size: 120%;
}
code {
color: #00EE00;
font-style: bold;
font-family: arial, 'lucida console', sans-serif;
}
.comment { color: #333; font-style: italic; }
.keyword { color: #eff; font-weight: bold; }
.punct { color: #444; font-weight: bold; }
.symbol { color: #0bb; }
.string { color: #6b4; }
.ident { color: #00b; }
.constant { color: #66f; }
.regex { color: #a82; }
.number { color: #a33; }
.expr { color: #227; }
Then on your machine, you will need ruby and rubygems installed, and install redcloth and syntax:
gem install syntax gem install redcloth
Put your sample into a text file in the same folder as run.rb, then run:
ruby run.rb myscala.txt > output.html
That’s about it. It’d be great to develop the same things for Java and CSS. In the mean time, enjoy!














I really like the idea of being able to customise the colours via CSS. I can’t say I share your particular choice of colours, but I’ve argued that Eclipse should be able to handle a global colouring for IDEs based on what the user wants, rather than what the developer of the IDE wants.
You should definitely file this as a suggestion into https://bugs.eclipse.org for consideration into the generic IDE project.
Alex,
regarding my choice of colors, I still have to refine them (a lot), for now I want to keep on posting content and I’ll update them.
The Eclipse syntax coloring is something that could certainly be achieved much in the same way the Ruby tokenizer works.
From what I remember, text editors may have portions of text recognized in the same way.
So maybe a new extension point ? I’ll file a bug and we can continue the discussion there.
Ok I opened a bug.
See you there!