Re: postscript style for source-hightlight

Lorenzo Bettini <[email protected]> Sat, 24 Mar 2007 11:20:24 +0100
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
[email protected] wrote:
> Hi                                                                                                                                          
>         

Hi Jeff and welcome to the list
 

> I recently discovered source-highlight, it appears to be a very useful
> program.                                                                                                                                    
>                                                                                                                                             
> However, when using the postscript.lang as a source language, it doesn't
> handle % within strings (%) correctly.
> 

so (%) is to be considered as a string?
in particular everything between ( and ) should be considered as a string?

> eg, the following is treated as a comment and print is highlighted as
> such, where instead because % is inside ( ) it should be treated as part
> of a string. (%) print 
> 
> I first tried adding "string = '\(.*\)'" to postscript.lang, this
> suceeded in highlighting strings correctly, but % inside ( ) was still
> making the rest of the line a comment.

mhh... probably because your definition comes after the definition of % 
comment?

> 
> I tried changing comment start "%" to comment start "(\(.*\))*(?=)%" but
> this appears to be wrong, as source-highlight prints the following:
> 
> source-highlight: /usr/include/boost/shared_ptr.hpp:253: T*
> boost::shared_ptr<T>::operator->() const [with T = RegExpFormatter]:
> Assertion `px != 0' failed.
> Aborted

yes probably this generates a regular expression that's wrong...

> 
> Are there any gurus able to assist?
> 

Although I don't know postscript I can try to fix this problem.

I'd need an input test file (in postscript) with % used in several 
context, i.e., when it should be treated as a comment and some examples 
of valid postscript strings (for instance, can ( ) strings be nested? 
can ( or ) be escaped?)

hope to hear from you soon
cheers
	Lorenzo

P.S. yesterday I released 2.6 of source-highlight

-- 
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net