View previous topic :: View next topic |
Author |
Message |
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jan 09, 2006 12:45 pm Post subject: Idea for adding D highlighting to the Trac code browser |
|
|
Today, I noticed the dsource ticket#8: Code Browser uses D syntax highlighting. I don't think that my parser will work for this either.
According to the SilverCity documentation (which the Trac docs refer to), if a language can be lexed by Scintilla, SilverCity can be modified to highlight it: How to add syntax-highlighting to SilverCity that exists in Scintilla.
Well, the standard Scintilla doesn't have the best support for D (in particular good luck trying to get it to handle all of D's comment's properly). But Vathix has made some changes to Scintilla and called it DLex. (IIRC, DLex is used by DCode, a D-enabled SciTE, and Poseidon.) I don't know if it'd need more modifications to compile and run on Linux, but using DLex might be the easiest way to add D to SilverCity (which should allow us to use it in Trac's "Browse Source").
I haven't tried any this myself, but it seems like it might work. |
|
Back to top |
|
|
brad Site Admin
Joined: 22 Feb 2004 Posts: 490 Location: Atlanta, GA USA
|
Posted: Mon Jan 09, 2006 5:49 pm Post subject: |
|
|
Bring it on. That sounds like what we need, and potentially, can set it as the default code highlighter for all wiki pages, getting rid of the slower python script you wrote (slower b/c of python, not you).
BA |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Tue Jan 10, 2006 3:17 am Post subject: |
|
|
brad wrote: | Bring it on. That sounds like what we need, and potentially, can set it as the default code highlighter for all wiki pages, getting rid of the slower python script you wrote (slower b/c of python, not you). | Well, I just mentioned it just as an idea. I like to have syntax highlighting for D code as often as possible.
I don't have Linux installed on my machine, but I guess I might be able to get Trac up-and-running on my computer and try it out that way at least. Do you know if Trac is any easier to install than it was a few months ago? |
|
Back to top |
|
|
brad Site Admin
Joined: 22 Feb 2004 Posts: 490 Location: Atlanta, GA USA
|
Posted: Tue Jan 10, 2006 7:42 am Post subject: |
|
|
jcc7 wrote: | I guess I might be able to get Trac up-and-running on my computer and try it out that way at least. Do you know if Trac is any easier to install than it was a few months ago? |
Um, it's not great, still. If you want, you can send to me and I'll work through it on my Gentoo laptop. Or you could suffer thru install, and be like Nod, who has Trac running, and is going to help a bit with plugin development...
More the merrier.
BA |
|
Back to top |
|
|
dan.lewis
Joined: 21 Feb 2007 Posts: 69 Location: Canada
|
Posted: Wed Mar 14, 2007 9:27 am Post subject: Scintilla |
|
|
Umm.. The SciTE/Scintilla support for D can be enhanced readily. I have mine properly handling it. Before I last formatted my drive, I even had it highlighting the inline assembler for me (copy and paste from asm.properties)
I think your biggest problem is that D is listed underneath the C++ file, along with C, Java and JavaScript. You'd have to rip it all out.
Best of luck, and I hope this happens. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
|
Back to top |
|
|
dan.lewis
Joined: 21 Feb 2007 Posts: 69 Location: Canada
|
Posted: Thu Mar 15, 2007 10:12 am Post subject: |
|
|
Well, yeah... but like I said, the official Scintilla properties file is somewhat lacking for D.
It doesn't support bool or d_time types or any inline assembler. It was only recently they finally got /+ +/ comments to work.
It uses the same parser and whatnot as javascript, c, c++ and java.. that might not be a bad thing - in case we post source in one of those languages for porting.
It's just a few minor corrections, and the source is editable. You can wing it and first instinct on how to do so will probably be the right one. |
|
Back to top |
|
|
KirkMcDonald
Joined: 22 Jun 2006 Posts: 23
|
Posted: Thu Jun 07, 2007 2:52 pm Post subject: Pygments |
|
|
FYI, the dsource code browser is now using Pygments for source code highlighting, for which I wrote a D lexer (and which Jarrett also added a MiniD lexer for). Enjoy! |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Fri Jun 08, 2007 12:17 pm Post subject: Re: Pygments |
|
|
KirkMcDonald wrote: | FYI, the dsource code browser is now using Pygments for source code highlighting, for which I wrote a D lexer (and which Jarrett also added a MiniD lexer for). Enjoy! |
Cool!
It looks pretty good, but I found a bug (not that d2html was perfect).
Apparently, it gets confused if one tries to escape a backslash in a string literal. For example, in the Escape Sequences Example, it goes haywire below the backslashReg line. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Fri Jun 08, 2007 2:05 pm Post subject: |
|
|
In case you find it helpful, I made a page listing more examples of what I believe is a bug that's related to escaped backslashes.
http://www.dsource.org/projects/tutorials/wiki/SyntaxHighlightingBugs
I can come up with a minimal test case if necessary, but I think some of the examples are already short enough to make the issue clear.
If you think the bug will be hard to fix, I probably can "code around" the issue for the examples, but I hope that it's just an easy fix. |
|
Back to top |
|
|
KirkMcDonald
Joined: 22 Jun 2006 Posts: 23
|
Posted: Thu Jul 19, 2007 3:15 pm Post subject: |
|
|
Pygments r3772 fixes the issue, and it should be working now. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Fri Jul 20, 2007 9:13 am Post subject: |
|
|
KirkMcDonald wrote: | Pygments r3772 fixes the issue, and it should be working now. | Looks great!
Thanks for fixing it and letting me know. |
|
Back to top |
|
|
|