help-source-highlight
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-source-highlight] Nestable background colors for Lisp code


From: Paulo Henrique Torrens
Subject: Re: [Help-source-highlight] Nestable background colors for Lisp code
Date: Wed, 6 Mar 2013 19:21:39 +0000

Yeah, of course.
Actually, what my actual code uses:


/(\()((?ms:;.*?[\r\n]|[^()]|(?R))*)(\))/


When it finds this regular _expression_, it gives a background color to it, numerates it (for when it have to repeat it), and nest inside whole grammar again, but prevents the same regex from matching the whole string (which would cause an infinite loop).

Of course we would need some new keyword or a new syntax for the *.lang files to achieve that, but... a simple regular _expression_ is enough. :)


If you would consider using the patch on the main repository, I could write it. I'm not sure yet about how the new syntax would be, any ideas?


Another thing that I wouldn't mind writing a patch is interpolating code inside strings on Ruby, PHP, Perl, etc... but, again, I'm not sure on which syntax to use on the *.lang files to mark that.











> Date: Wed, 6 Mar 2013 10:34:20 +0100
> From: address@hidden
> To: address@hidden
> Subject: Re: [Help-source-highlight] Nestable background colors for Lisp code
>
> On 03/04/2013 03:16 PM, Paulo Henrique Torrens wrote:
> > Hi,
> >
> > I have quickly made a code highlighter in PHP for a huge project (which
> > handles several programming languages, including some domain specific
> > languages created for the project), but it got too slow for big files
> > (as expected, since I didn't put much effort)... but I don't have time
> > to rewrite it taking care of speed.
> >
> > So I am intending to migrate to source-highlight, which seemed a really
> > good alternative, but I have a problem:
> >
> > Here is a screenshot of a Common Lisp code highlighted by my code:
> > http://img841.imageshack.us/img841/2706/capturadetela20130303s1.png
> >
> > This would also be useful for for highlighting regexes' subexpressions.
> >
> > I know I cannot achieve this result with source-highlight, but... are
> > you open to some extensions to make such effect? Any suggestion for the
> > syntax for the language files to make such a thing?
> >
> > I could then write the patch, if necessary.
>
> Hi Paulo
>
> as far as I understand, to highlight lisp code to that extent you need
> lots of information; can you gather that only with lexical analysis and
> regular expressions? These are the only mechanisms which
> source-highlight is based on...
>
> cheers
> Lorenzo
>
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME: http://www.lorenzobettini.it
>
>
> _______________________________________________
> Help-source-highlight mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-source-highlight

reply via email to

[Prev in Thread] Current Thread [Next in Thread]