|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
I'm working on something I think I'll call 'SuperPad' or 'MongoPad' (taking name ideas!). One of the features I think I'll include in some version (It's a long list!) is text highlighting. Does anyone know a highlighting algorithm for their favorite language?
I'm thinking a rule based system (Things higher in the list take presedence over items farther down). |
|
#2
|
|||||
|
|||||
|
Re: Text Highlighting Algorithms
If you search around for "syntax highlighting", you will find several algorithms for various languages.
If you know Java, you can check out the implementation used in Ostermiller.Syntax from http://ostermiller.org/syntax/. Source code is available form the download link. Last edited by ahecht : 30-04-2004 at 20:15. |
|
#3
|
|||||
|
|||||
|
Re: Text Highlighting Algorithms
Thanx! (Google)
(Ok, after going through google I'm a little frustrated: it's all language specific! does anyone know algorithms that are in psuedo code? [I'd say language specific, but the thought of syntax coloring for all languages came to mind...]) Last edited by Astronouth7303 : 30-04-2004 at 20:25. |
|
#4
|
|||
|
|||
|
Re: Text Highlighting Algorithms
Quote:
Code:
make an array of the rules make an array "colors" of RGB values with length equal to length of code for each rule in the array - for each range of strings in the code that match this rule - - set the range of values in "colors" to the color matching the rule - end for end for change the color of each character according to the colors array |
|
#5
|
|||||
|
|||||
|
Re: Text Highlighting Algorithms
Quote:
And yes. when I make a working version, I will upload it. I'm still on Alpha 0.0.000. |
|
#6
|
||||
|
||||
|
Re: Text Highlighting Algorithms
Quote:
erl -- I can't think of a more complicated case to come up with syntax highlihgting for, where a single symbol (possibly multiple characters) can have more context and different results for each context! I don't know if you are familiar with perl, but if you take a gander at CPAN you'll find a lot of useful modules that could assist in this (particularly to parse documents based on rules, not to mention that perl has some pretty powerful text handling ability ... granted, that can quickly turn into text mangling ability if you aren't careful. ) Also, you might want to check out emacs for general edification (if you haven't already). |
|
#7
|
|||||
|
|||||
|
Re: Text Highlighting Algorithms
Quote:
I think there is already a SuperPad editor. [edit] This site says that "Source code for SuperPad is delivered with Microsoft's Visual C++ [/edit] Last edited by Greg Ross : 30-04-2004 at 23:44. |
|
#8
|
|||||
|
|||||
|
Re: Text Highlighting Algorithms
Oh. I did have a long list of possible names (It started out as 'Tabbed Notepad', but the feature list got too long for that). However, currently, it's only framework. But when I finish the first version, I'll send it to anyone who wants it!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Postoholic text change | Trashed20 | CD Forum Support | 1 | 02-12-2003 09:08 |
| Inventor text | 157#1Driver | Inventor | 1 | 22-02-2003 17:38 |
| Edit text on a submitted picture description? | Elgin Clock | CD Forum Support | 0 | 11-04-2002 16:48 |
| 3D Text Editors | David Kelly | Chit-Chat | 2 | 09-06-2001 03:01 |