PreviousNextTracker indexSee it online !

(134/231) 3441750 - mode delegation does not work


I have a strange behavior in mode files when using DELEGATE between two modes, essentially the DELEGATE command is ignored.
Find attached two mode files, plus a testcase. To reproduce:
1) Copy the testcase and mode file somewhere e.g. /path/to/bug
2) add the mode files to your .jedit/modes/catalog by adding the following lines:
<MODE NAME="spp1" FILE="\path\to\bug\spp1.xml" FILE_NAME_GLOB="{*.bug}" />
<MODE NAME="spp2" FILE="\path\to\bug\spp2.xml" />
3) open the testcase sde_dvs.bug in jedit
According to the mode files all @TEST@ should be highlighted in LITERAL4.

But infact the last @TEST@ in the line 1 and the @TEST@ inside !(...)! are not highlighted!

Both occurences are highlighted according to spp2::MAIN rule (set and string get KEYWORD1)
But although in spp2::MAIN I have an import DELEGATE=spp1::AT which should highlight @TEST@ as LITERAL4 they do not get highlighted.

Note: If in spp2::MAIN I explicitly write a SPAN to grab the @TEST@ it works.

Submitted captainhunt - 2011-11-24 - 10:55:25z Assigned daleanson
Priority 5 Category editor core
Status Open Group None
Resolution None Visibility No


2012-03-16 - 18:12:36z
I'm not sure what you're trying to accomplish with these modes. One delegates to the other which delegates back to the first. What mode is your sde_dvs.bug supposed to be? If it is set as spp2, it is highlighted as you seem to want it to. It's not clear to me why you need two different modes for this.
2012-03-21 - 10:33:15z

agree it's not obvious to see. Let me explain a bit more in detail:
The modes are written for a complex simulation framework, involving several languages like tcl and scheme. All command files can contain so called preprocessing statements e.g.
#if followed by a tcl expression, or
tcl-blocks !(...)!.
All of them are evaluated before the command file is passed to the simulator. Especially the @test@ expression can appear everywhere also in the if tcl expression or in the tcl-blocks.

From organization point of view, I guess it is agreeable that it does make sense to define all preprocessing rules in a single mode file (spp1), and share the definitions in all other modes. Now look at the #if line if a tcl block is detected [...] it delegates it to the tcl mode spp2. However, of course I have to allow any @test@ expression inside the tcl block itself. Hence I import spp1::AT in spp2.
It's not a recursion at this point, because AT itself does not point back to spp2.

Hope I could make it a bit clearer?
2013-11-11 - 23:58:26z
Is this still an issue? Since it involved a couple of non-standard edit modes, I'm inclined to close this ticket.
2013-11-12 - 08:28:20z
Yes the issue is still pending, and forces us to keep a lot of code definition dublicated.

Closing it would be a real pity because it would show that jedit's mode scheme is not suitable for larger mode projects.

And we would have to look for another editor recommendation for the TCAD simulation community.


2011-11-24 - 10:55:30z