[Top][All Lists]

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

[Help-source-highlight] Processing escape sequences

From: Dario Teixeira
Subject: [Help-source-highlight] Processing escape sequences
Date: Thu, 18 Feb 2010 08:23:15 -0800 (PST)


I am using the Source-highlight library to perform a fairly straightforward
syntax highlighting task: given a string containing the source-code, and
another with the language definition, I want to return a string with the
highlighted version of source-code expressed in a custom "foobar" outlang.
In pseudo-C++, something like the code below:  (forget optimisations for now)

string highlight (string src, string langdef)
        istringstream in (src);
        ostringstream out;
        SourceHighlight hiliter ("foobar.outlang");
        hiliter.highlight (in, out, langdef);
        return out.str ();

In rough terms, this works.  There is however one big problem: any use of
escaping directives within the "src" (like "\n") is being processed, instead
of being written verbatim into the output string.  Is there any way to turn
off this behaviour?

Thanks in advance!
Best regards,
Dario Teixeira

reply via email to

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