Request for CoffeeScript/Jade/Stylus support

302 views
Skip to first unread message

anengineer

unread,
Nov 26, 2011, 5:10:08 AM11/26/11
to Colorer
Could I ask you to support the following languages ?

CoffeeScript <http://jashkenas.github.com/coffee-script/>
Jade - Template Engine <http://jade-lang.com/>
Stylus <http://learnboost.github.com/stylus/>

These are coming popular in the node.js world.

anatoly techtonik

unread,
Nov 28, 2011, 8:19:56 AM11/28/11
to col...@googlegroups.com
You can, but usually people submit schemes themselves. There is an HRC reference available on site. Feel free to propose your enhancements for the docs or ask questions about it.
--
anatoly t.

Igor Russkih

unread,
Nov 28, 2011, 9:35:03 PM11/28/11
to col...@googlegroups.com
Anengineer,

I don't use these syntaxes, but some time ago I've added support for 'rails world' stuff: haml, sass.

jade syntax is very similar to haml - think it could be derived easily, stylus is no doubt similar to sass.

For CoffeeScript think the native javascript mode could be used and then modified incrementally.

I encourage you to try doing this by yourself - its not very difficult. Because otherwise you have to wait for someone, who in use both with these syntaxes and with colorer. That could be a long way.

  Igor

Eric Gustavson

unread,
Jan 6, 2012, 8:52:34 AM1/6/12
to col...@googlegroups.com
Hi,

I would like to add support for SHPAML, a HAML-like language.

I could use some help getting started on this task, and I have been following the instructions here. I have successfully installed the eclipse colorer plugin. I am running eclipse on Ubuntu 32bit Linux.

1) I am having trouble locating the colorer.hrc file in my eclipse/plugins directory. Anywhere else I should look?

2) Once I create support for SHPAML, how do I get it integrated with your main repository branch?

I'm sure I may have more questions as things progress. I plan on modifying the HAML colorer to suit my needs.

Thanks,

Eric

Igor Russkih

unread,
Jan 7, 2012, 4:36:21 AM1/7/12
to col...@googlegroups.com
Hi Eric,

1) Main hrc registry is in net.sf.colorer/colorer/hrc/proto.hrc. All the definitions are in core.jar file.

2) Just post it here and we'll take care on this.

Visually the syntax looks very similar to haml - so thing you are right and can start with HAML, trying to adopt it.

  Igor

Eric Gustavson

unread,
Jan 8, 2012, 10:45:48 AM1/8/12
to col...@googlegroups.com
Hi,

Thanks for the help so far. I have begun making progress on the shpaml.hrc file, using the haml.hrc file as a basis. I have a few questions.

1) What does region00 and region01 mean in the following code block? I checked out the re documentation, but there was no mention of what region00 might mean (only mention of region0)

      <block start='/^((\s\s)*):(ruby)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
         region00='def:PairStart' region10='def:PairEnd' scheme='ruby:ruby'/>

2) I am also confused about the usage of \M and \m. I understand from the boundaries documentation that \m (redefines RE start) and \M (redefines RE end), but I'm confused as to what redefining the start and end actually does.

Thanks!

Eric Gustavson

unread,
Jan 8, 2012, 11:02:15 AM1/8/12
to col...@googlegroups.com
Update on 1)

I realized that I should have been looking at the block documentation. I understand that:
  • region0x corresponds to round brackets of <start> tag
  • region1x is for <end> tag brackets

Keeping that in mind, would region00 correspond to the following? ((\s\s)*)
And would region01 be? (ruby)


Igor Russkih

unread,
Jan 8, 2012, 2:59:41 PM1/8/12
to col...@googlegroups.com
Eric,

1) As far as I remember region00 defines the whole range of the start tag (btw defined with \m\M operators).
region01, 02 then assigns to the first, second, etc. bracket.

2) RE boundaries are important in whole context parsing. Next token recognition starts exactly at the end of the previous token. And redefining end position of RE allows you to highlight with overlapped color regions (different REs could 'overlap' each other).

  Igor

Eric Gustavson

unread,
Jan 9, 2012, 5:10:14 PM1/9/12
to col...@googlegroups.com
3) What is the significance of \y1 in the following? extended metachars doc

<block start='/([&apos;&quot;])/' end='/\y1/' region='def:String'
             region00='def:PairStart' region10='def:PairEnd' scheme='def:empty'/>

Does it mean that end will only match an apostrophe if start was an apostrophe? I did a test and this appears to be the case.

Igor Russkih

unread,
Jan 10, 2012, 12:36:26 AM1/10/12
to col...@googlegroups.com
Right,

However thats a dynamic operator - mean it'll match whatever content was in start's block (in below example - apostrophe or qoutation).

  Igor

Eric Gustavson

unread,
Jan 20, 2012, 11:23:31 AM1/20/12
to col...@googlegroups.com
Thanks for your help so far. I am stuck in that I cannot get the following jscript block to end when I want it to (see google drawing).

Please see this google drawing to see my problem.

The code in question is below, and I have attached 2 files:
  • shpaml.hrc
  • welcome.html.shpaml (a sample SHPAML file)

      <block start='/^((\s\s)*)script type=([&apos;&quot;])?text\/javascript([&apos;&quot;])? VERBATIM/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion'       region01='def:Outlined' region00='def:PairStart' region10='def:PairEnd' scheme='jScript:jScript'/>


I am most confused about how the end attribute works in this specific example. Thanks for your continued help.
shpaml.hrc
welcome.html.shpaml

Igor Russkih

unread,
Jan 20, 2012, 1:21:39 PM1/20/12
to col...@googlegroups.com
Hi.

I think you have there conflict of rules. Top level context expect the block to be closed (with the "end" you have below). But internal JS context eats up all the stuff before parent can findout that this is the end of the scheme.

Try to insert content-priority="low" into the block below. Read http://colorer.sourceforge.net/hrc-ref/#schemesyntax.boundaries about it.

I also wondering why do you need to match indentation here. You have explicit {block} {endblock} construction - why can't you rely on it when defining the inner scheme?
In haml there is just no any explicit markers - because the logic is so complex.

  Igor

Eric Gustavson

unread,
Jan 20, 2012, 2:10:39 PM1/20/12
to col...@googlegroups.com
content-priority="low" fixed the problem. Thanks.

To answer your question:
{% block %} and {% endblock %} are actually django tags. They aren't part of the SHPAML markup. However, since SHPAML is commonly used with django, these (and other) django tags need to be recognized.

Eric Gustavson

unread,
Jan 21, 2012, 5:46:19 PM1/21/12
to col...@googlegroups.com
Hi,

I have finished the first version of the SHPAML highlighter. I have put it on github: https://github.com/occulens/shpaml-colorer

Thanks again for your help.

--Eric

Jan Killian

unread,
May 6, 2013, 1:43:12 AM5/6/13
to col...@googlegroups.com
There's a HRC for Jade: https://github.com/aulphar/Jade-syntax-highlight-HRC

No luck with Coffee/Stylus afaik.
Reply all
Reply to author
Forward
0 new messages