gss / engine

GSS engine
http://gss.github.io
MIT License
2.87k stars 103 forks source link

Syntax highlighting for vim (and others)? #171

Open dlee opened 9 years ago

dlee commented 9 years ago

Do you know if there are vim syntax modules for GSS?

If so, it would be nice to put a link to it somewhere in the docs.

Hydrotoast commented 9 years ago

Syntax highlighting would be nice. If an existing syntax module does not already exist for GSS, I can write one overnight if anyone has the grammar specification somewhere.

Inviz commented 9 years ago

I believe @paulyoung worked on bringing syntax highlighting to text mate and compatible editors. I've seen screenshots where it did some proper colors and it felt great. I don't know what's the current status though, as it was a side project. I imagine it's difficult to make one-line oriented regex highlighters to do proper highlighting in multiline expressions. But I hardly know anything about it.

Currently we don't have any solution. Give it a shot, if you feel confident. We have PEG grammar for CCSS and VFL in dedicated repos linked from readme. That would be nice to have for sure.

dlee commented 9 years ago

I don't see the links in the readme (https://github.com/gss/engine/blob/master/README.md). Maybe you're referring to a different file?

Inviz commented 9 years ago

The links to repos are there. Here're the links to pegs:

https://github.com/gss/vfl-compiler/blob/master/src/grammar.peg https://github.com/gss/parser/blob/master/src/grammar.peg

I suggest checking out the specs for both parsers, they have everything in there. It's pretty mighty thing and our parser is quite an auto-generated monster. We're looking for some experienced parser tinker who could handcraft something less heavy.

paulyoung commented 9 years ago

I made some progress on this recently with the help of @infininight. I can push what I have in the morning.

paulyoung commented 9 years ago

screen shot 2015-01-26 at 10 25 24 pm screen shot 2015-01-26 at 10 25 32 pm

Hydrotoast commented 9 years ago

Nice work @paulyoung. I am interested in seeing your highlighting rules. Hopefully, I can use some ideas for the vim syntax module I just wrote: https://github.com/Hydrotoast/vim-gss

screen

Hydrotoast commented 9 years ago

And because I realized that there wasn't too much interesting in the previous screenshot, here are is a section with combinators and conditionals:

screen2

I think all that would be left would be to include the fancy selectors like ++ and ~~. I can read into those in the morning.

Inviz commented 9 years ago

Ahh, pretty! Wonder if we can work out VFL highlighting too.

Personally, I'd like to see local props like height: == or height: = be colored the same way as &[height] ==, because they are scoped explicitly. But variables like height should have its own color, to hint that hoisting can happen

paulyoung commented 8 years ago

@RedHatter – I just made https://github.com/paulyoung/GSS.tmbundle public.

paulyoung commented 8 years ago

Worth noting that I didn't get too far and was hoping to get some input from @infininight on how he would have implemented it.