« home   paste   Anonymous | Login | Signup for a new account 09-17-2019 12:20 CEST
* X »
GeSHi - Generic Syntax Highlighter Syntax Coloriser for PHP

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000083 [GeSHi] lang feature always 05-20-06 23:12 02-13-07 08:07
Reporter nigel View Status public  
Assigned To BenBE
Priority low Resolution open  
Status assigned   Product Version 1.1.1alpha4
Summary 0000083: Delphi - things the code parser could do
Description I'm just filing this to note down a few things I've seen with Delphi highlighting currently that could be improved by the code parser. They're relatively advanced things, which may slow down parsing a bit and thus later on need to be configurable, but like for Java I think that proving that this stuff can be done will be a good first step.

  * Variables: variable names could be highlighted. You can detect at least some by seeing if := has occured and modifying the previous context. Would be complicated if something like "Result" is a variable name because it's also a keyident too.
  * Data types: There's a format like:
    foo : bar;
    That looks reasonably easy to detect and thus mark bar as a custom datatype
  * Constants: looks to me like delphi has a Const keyword, and after that for a while constants can be defined. I don't think they'd be too hard to detect.
  * This:
    Function GetModuleName(Handle: THandle): String
    Looks a little wierd as GetModuleName is highlighted differently. You could detect function names inside the code quite easily in fact and highlight them differently.

I'm sure there will be other things. But this is just to get you started :).
Additional Information See the java code parser for an example of a complicated series of things being highlighted. That code parser uses references into the stack to "look into the past" and "change the past", which were very helpful.

Also note how various thing highlightings were split out into methods, which would make it easier to turn some of them off later.
Attached Files

- Relationships
child of 0000006assigned BenBE Delphi support 

- Notes
05-22-06 09:41

Well I don't expect you to do anything now. But you can guarantee that somebody will ask for it later, so it's better that these things are listed.

I can't see how variables will be too hard to detect, BTW. Java variables look like they're similarly declared and we had little trouble with those... it's not hard to find a declaration, store the name of the variable in a list and check future tokens for it.

Still anyway, like I said, you don't need to worry about those things for now.

Regarding speed, I seriously need to look at the GeSHiCodeContext::parseCode speed. I found what looks like a bug or two in it before, and I'm convinced that it can be significantly sped up. But that will be later on.
02-13-07 07:53

Looking at this old bug report again I just wondered what you ment by the last point mentioned.
02-13-07 08:07

I don't know, it was ages ago :p

- Issue History
Date Modified Username Field Change
05-20-06 23:12 nigel New Issue
05-20-06 23:12 nigel Status new => assigned
05-20-06 23:12 nigel Assigned To  => BenBE
05-22-06 07:03 BenBE Note Added: 0000406
05-22-06 09:41 nigel Note Added: 0000407
05-25-06 08:03 BenBE Relationship added child of 0000006
02-13-07 07:53 BenBE Note Added: 0000507
02-13-07 08:07 nigel Note Added: 0000509


Mantis 1.0.0rc2[^]
Copyright © 2000 - 2005 Mantis Group
42 total queries executed.
33 unique queries executed.
Powered by Mantis Bugtracker