Go to Post "It was defense killed the beast." - Justin [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-30-2004, 07:09 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
Question Text Highlighting Algorithms

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   Spotlight this post!  
Unread 04-30-2004, 07:12 PM
ahecht's Avatar
ahecht ahecht is offline
'Luzer'
AKA: Zan
no team
Team Role: Alumni
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Billerica, MA
Posts: 976
ahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond repute
Send a message via ICQ to ahecht Send a message via AIM to ahecht Send a message via Yahoo to ahecht
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.
__________________
Zan Hecht

Scorekeeper: '05 Championship DaVinci Field/'10 WPI Regional
Co-Founder: WPI-EBOT Educational Robotics Program
Alumnus: WPI/Mass Academy Team #190
Alumnus (and founder): Oakwood Robotics Team #992


"Life is an odd numbered problem the answer isn't in the back of the book." — Anonymous WPI Student

Last edited by ahecht : 04-30-2004 at 07:15 PM.
  #3   Spotlight this post!  
Unread 04-30-2004, 07:16 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
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 : 04-30-2004 at 07:25 PM.
  #4   Spotlight this post!  
Unread 04-30-2004, 08:46 PM
SilverStar's Avatar
SilverStar SilverStar is offline
948 Alum
AKA: Advay Mengle
FRC #0948 (Newport Robotics Group)
Team Role: Leadership
 
Join Date: Mar 2002
Rookie Year: 2001
Location: USA
Posts: 368
SilverStar is just really niceSilverStar is just really niceSilverStar is just really niceSilverStar is just really nice
Re: Text Highlighting Algorithms

Quote:
Originally Posted by Astronouth7303
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...])
Pseudocode coming up:
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
When you're done could you add the code to the repository?
__________________
-- Advay Mengle
NRG Team 948 Alum
2005 Pacific NW Seed 1 (and... waiting for finals...)
2005 Pacific NW Finalists with 1359 and 1569
2004 Pacific NW Semifinalists, Seed 4
2004 Pacific NW Quarterfinalists
2003 Pacific NW Team Spirit Award, Quarterfinalists, Seed 5
  #5   Spotlight this post!  
Unread 04-30-2004, 09:13 PM
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: Text Highlighting Algorithms

Quote:
Originally Posted by Astronouth7303
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?
What kind of highlighting are you talking about? You mean a user can select a certain language and it would highlight text specific to that? (Presumably where a user could specify a custom highlighting scheme with custom rules?) Sounds complicated ... be wary of the many exceptions. Some food for thought: ignore keywords in between quotes, bearing in mind escape characters, which in general can be a pain ... ignore keywords between comments, bearing in mind that in C, anyway, you can't nest the /**/-style (C-style) comments. And, of course, more caveats abound! I suggest you take a look at Syntax::Highlight: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).
  #6   Spotlight this post!  
Unread 04-30-2004, 10:40 PM
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,244
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: Text Highlighting Algorithms

Quote:
Originally Posted by Astronouth7303
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).
Jamie,

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]
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 04-30-2004 at 10:44 PM.
  #7   Spotlight this post!  
Unread 05-01-2004, 09:19 AM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
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!
  #8   Spotlight this post!  
Unread 05-01-2004, 10:45 AM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
Re: Text Highlighting Algorithms

Quote:
Originally Posted by SilverStar
Pseudocode coming up:
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
When you're done could you add the code to the repository?
I ment for a particular language. Setting up the structure isn't hard, filling it in is.

And yes. when I make a working version, I will upload it. I'm still on Alpha 0.0.000.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postoholic text change Trashed20 CD Forum Support 1 12-02-2003 08:08 AM
Inventor text 157#1Driver Inventor 1 02-22-2003 04:38 PM
Edit text on a submitted picture description? Elgin Clock CD Forum Support 0 04-11-2002 03:48 PM
3D Text Editors David Kelly Chit-Chat 2 06-09-2001 02:01 AM


All times are GMT -5. The time now is 10:04 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi