New home page
Stephan Soller
stephan.soller at helionweb.de
Thu Oct 7 01:41:52 PDT 2010
On 06.10.2010 16:26, Stephan Soller wrote:
> On 05.10.2010 19:28, Walter Bright wrote:
>> Stephan Soller wrote:
>>> This is especially handy when doing a presentation about a programming
>>> language since you can use JavaScript to write a small syntax
>>> highlighter (the grammar in the D documentation was really handy for
>>> that). :)
>>
>> A javascript D syntax highlighter? Please post!
>
> I will extract it out of the presentation. But be aware, it's just a
> small tool I used to highlight the D code in my presentation about D.
> Don't expect something like a proper lexer. ;)
Unfortunately I don't have the time right now to properly extract it and
clean it up. I don't feel it good enough to be released here but well,
here's the link to the presentation of a talk I gave about D1:
http://events.mi.hdm-stuttgart.de/archive/2010-04-13-d-einf%C3%BChrung/der-coole-stoff/Pr%C3%A4sentation%20(HTML).html
The syntax highlighter (search the source code for "syntax highlighter")
was hacked together in a few hours. It's tuned towards the code used in
the presentation and nowhere near usable for general D code. I tested it
on some of my code and right now it highlights the "in" in "main" as a
keyword…
The file also has a little presentation system build in. Press "p" to
enable it and arrow down do fade in the next item. However it only
really fits if you're looking at the page in full screen mode in Opera
(no other browsers support the "projection" mode yet).
You can also take a look at the video of the talk but it's in German. In
the first part a friend of mine introduces D and after that I'm showing
some more features of the language. Be aware that the video does not
work in Opera right now (they broke something in 10.60). There is a link
to the second part of the talk:
http://events.mi.hdm-stuttgart.de/2010-04-13-d-einf%C3%BChrung#der-coole-stoff
While the JS syntax highlighter was abandoned I created a language
highlighter for GEdit (a Linux text editor). I wasn't happy with the
provided one so I made a new one based on the D language specification.
If someone here uses GEdit (or an editor that uses the GTKSourceView2
widget) you can give it a try:
http://svn.arkanis.de/projects/tools/gedit_config/trunk/config/langs/d.lang
https://svn.arkanis.de/projects/tools/gedit_config/trunk/config/styles/doblivion.xml
https://svn.arkanis.de/projects/tools/gedit_config/trunk/tests/syntax.d
The first link is the language specification (just a big bunch of reg
expressions) and the second is a color scheme I created for it. The
third file is just a small test case to see if it works.
It's pretty complete I believe: it even contains asm instructions and
differs between function literals and function types (because I wanted
them to be shown in a different color). If there is a need I can try to
port it to JavaScript.
Happy programming
Stephan
More information about the Digitalmars-d-announce
mailing list