GeSHi Bug Tracker - GeSHi
Viewing Issue Advanced Details
90 core tweak always 09-13-06 13:22 09-13-06 23:32
BenBE  
nigel  
normal  
assigned 1.1.2alpha2  
open  
none    
none  
0000090: Allow for custom starter ender names of contexts
As of pre-1.1.1 it was possible to to set the style you wanted a context starter or ender to be highlighted as. Being rewritten with 1.1.1's release (rewriting language format) you missed reimplementing that feature some language files (e.g. Delphi) relied on.
Try highlighting some source using context aliasing like:


property Foo: Bar read GetFoo write SetFoo;


which makes property become delphi/delphi/start and the final ; become delphi/delphi/end
It would be nice if there was a way to:
1. set the relative alias start and end are located at
--> $this->aliasDelimiters('delphi/delphi');
2. set explicit names for them
--> $this->aliasStarter('delphi/delphi/keyword');
--> $this->aliasEnder('delphi/delphi/symbol');
3. ask the parent context to highlight them
--> $this->aliasDelimiterMode(ALIAS_BY_PARENT);
child of 0000006assigned BenBE Delphi support 

Notes
(0000437)
nigel   
09-13-06 15:05   
Those options you give:

  * 3 may already be implemented, if you try $context->parseDelimiters(GESHI_CHILD_PARSE_NONE) in the context you have aliased, I encourage you to give that a go.
  * 2 makes sense, although I would be tempted to merge it with the call to alias() - e.g. $context->alias('delphi/delphi', 'keytype', 'symbol'); where parameters 2 and 3 are for the starter and ender
  * 1: could you explain the effect of this one more?
(0000441)
BenBE   
09-13-06 21:46   
The first is ment for languages that have a lot of subcontext where you've many context having e.g. symbols as subcontext starters. In that case you could make one genereal start \ end style pair in some context (e.g. the language root) and have all starters \ enders be aliased to that context, independet from the actual context alias used for data.

HTML could be a example of that where you could make html/html/tag/start end html/html/tag/end and have every subcontext that is initialized by a tag have its starters\enders be rendered with that style, even if the actual subcontext was php, css or such.

This method is basically a full-qualified alias for the second method to give the alias directory, the second would give the actual naes (so they could be combined).

Delphi could use this one too as I mostly start subcontexts with a keyword and terminate them by a symbol, having both being in delphi/delphi.
(0000443)
nigel   
09-13-06 23:32   
Meh. I can't really see the use of that given that there's nothing in the current language file format that can't handle this situation.

HTML won't necessarily work if the delimiter is something with attributes in it anyway, e.g. <style type="text/css"> - you still have to parse that whole thing. Of course the delphi example you give may be a place where it is used though.

I can see this possibly being a benefit as an *optimisation* - e.g. rather than parsing the delimiters (according to the _parseDelimiter flag - e.g. GESHI_CHILD_PARSE_*), if that method has been called then GeSHi could simply automatically put the stuff in that context. If that's how you would see it working, then it's probably a separate, optimisation related bug.

Number 2 is still present and valid for this bug, and will probably be implemented in a similar way to the above - i.e. where starters/enders detected, if we have an alias name for them then use that else do the parsing.

You still might want to look into number 3.