RejectedSoftware Forums

Sign up

Diet Templates --- Grammar

Hello, I'd like to write a lexer for Textadept to syntax color Diet Templates.

Once done it would be submitted to become a part of the official distribution. I've done this sort of thing before, and it's pretty easily done for a small language by writing 1 to 2 pages of Lua. And I had no trouble having the result accepted to be a part of the Textadept distribution. There's already a lexer for D, and that can be called to color the D parts of a template. The existing HTML lexer calls the Javascript lexer in an analogous fashion. So the hard work is done in advance.

That said, I need a grammar. I'm new to vibe.d and I'd prefer someone more involved with vibe.d who has an informal possibly non-final grammar to allow me to use it, rather than my trying to vaccuum up the existing incomplete docs which would include the Jade Docs and invent my own.

Does anyone have something I could use? It's just for syntax coloring so it doesn't have to be perfect right now; I could revise the lexer once there's an official grammar. Any help much appreciated.

Re: Diet Templates --- Grammar

On Mon, 08 Feb 2016 18:06:15 GMT, Carl Sturtivant wrote:

Does anyone have something I could use? It's just for syntax coloring so it doesn't have to be perfect right now; I could revise the lexer once there's an official grammar. Any help much appreciated.

I use VS Code's highlighting for Jade, and it's exceptionally good. That said diet-ng is the forthcoming replacement to diets within Vibe. I'd recommend using that.

Re: Diet Templates --- Grammar

On Mon, 08 Feb 2016 22:47:19 GMT, Charles wrote:

I use VS Code's highlighting for Jade, and it's exceptionally good. That said diet-ng is the forthcoming replacement to diets within Vibe. I'd recommend using that.

I don't see how that helps me write a lexer in Lua for Textadept, which is the only way it will be added to the standard distribution thereof. What are you suggesting?

Re: Diet Templates --- Grammar

On Mon, 08 Feb 2016 18:06:15 GMT, Carl Sturtivant wrote:

That said, I need a grammar.
Does anyone have something I could use?

I just found this!It's only for a single line of a template, but that's better than nothing.
Anyone got something better?

Re: Diet Templates --- Grammar

On Mon, 08 Feb 2016 18:06:15 GMT, Carl Sturtivant wrote:

That said, I need a grammar.
Does anyone have something I could use?

Lost the link! Try again:

I just found this! It's only for a single line of a template. Anyone got something better?

Re: Diet Templates --- Grammar

Am 09.02.2016 um 00:23 schrieb Carl Sturtivant:

On Mon, 08 Feb 2016 18:06:15 GMT, Carl Sturtivant wrote:

That said, I need a grammar.
Does anyone have something I could use?

Lost the link! Try again:

I just found this! It's only for a single line of a template. Anyone got something better?

That's all I got for now, but it should be reasonably close to the
actual implementation and a single-line grammar should be accurate for
everything but blocks of text:

p.
     This is a block
     of text

I'll open a ticket to remember adding this to the grammar.

Re: Diet Templates --- Grammar

Am 09.02.2016 um 09:41 schrieb Sönke Ludwig:

Am 09.02.2016 um 00:23 schrieb Carl Sturtivant:

On Mon, 08 Feb 2016 18:06:15 GMT, Carl Sturtivant wrote:

That said, I need a grammar.
Does anyone have something I could use?

Lost the link! Try again:

I just found this! It's
only for a single line of a template. Anyone got something better?

That's all I got for now, but it should be reasonably close to the
actual implementation and a single-line grammar should be accurate for
everything but blocks of text:

p.
     This is a block
     of text

I'll open a ticket to remember adding this to the grammar.

#1410

Re: Diet Templates --- Grammar

On Tue, 9 Feb 2016 09:46:33 +0100, Sönke Ludwig wrote:

That's all I got for now, but it should be reasonably close to the
actual implementation and a single-line grammar should be accurate for
everything but blocks of text:

p.
     This is a block
     of text

I'll open a ticket to remember adding this to the grammar.

#1410

Thanks. I'll have a go with this.

Re: Diet Templates --- Grammar

To work efficient the whitespace characters should be displayed.

After some problems to get a editing mode for my eclipse version and giving DLangIDE a try, I now use
emacs with the .d visualization and the combined Whitespace and D mode for ,dt Templates. Not perfect but ok.

My .emacs looks now this way:

(add-to-list 'auto-mode-alist '("\\.d$" . d-mode))
(add-to-list 'auto-mode-alist '("\\.dt$" . d-mode))
(add-to-list 'auto-mode-alist '("\\.dt$" . whitespace-mode))
(setq-default tab-width 4)
(setq whitespace-line-column 250)

followed by the d-mode.el code.:

;;; d-mode.el --- D Programming Language major mode for (X)Emacs
;;;               Requires a cc-mode of version 5.30 or greater
;; Author:  William Baxter  
;; Contributors:  Andrei Alexandrescu
;; Contributors:  Russel Winder
;; Maintainer:  Russel Winder <russel@winder.org.uk>
;; Created:  March 2007
;; Version:  201512060745
;; Keywords:  D programming language emacs cc-mode
.....