[antlr-interest] gUnit special character escaping

Ana Nelson nelson.ana at gmail.com
Thu Feb 7 02:05:43 PST 2008


Following Andreas' example I got the multi-line expressions to work. I had
originally tried

<<
"ABC DE"
>>

rather than

<< "ABC DE"
>>

and was getting an error since I was testing a "line" rule which only
expected a single newline character but was getting 2.

I added a note about this on the gUnit Wiki page in SimpleC.testsuite.



On 06/02/2008, Leon Su <leon.antlr at mac.com> wrote:
>
> Hi,
>
> gUnit accepts escaped character in its testsuite expressions, but
> there's a bug currently.
> You may try multiple-line expression as Andreas suggested.
> A minor update of gUnit will be release in these days.
> (the bug is also fixed.)
>
> Regards,
>
> Leon
>
> On Feb 6, 2008, at 10:15 AM, Andreas Bartho wrote:
>
> > Hi Ana,
> >
> > have you tried
> >
> > << "ABC DE"
> > >>
> >
> > as described in the wiki?
> >
> > Andreas
> >
> > Ana Nelson wrote:
> >> I'm trying to write gUnit tests for expressions like
> >> "ABC DE"\n
> >> The quotes are part of the expression, so I've been trying to
> >> escape the quotes and newline as follows to include them in
> >> my .testsuite file:
> >> "\"ABC DE\"\n"
> >> But, gUnit doesn't seem to like escaped quotes, or I'm not
> >> escaping them properly. I've tried various alternatives but
> >> haven't found anything that works. I have a clumsy workaround
> >> which is to put the quoted expression "ABC DE" into an external
> >> text file.
> >> If anyone knows the correct way of escaping quotes (and newlines)
> >> in gUnit, or if someone can tell me that it's not possible, I
> >> would appreciate it. I've looked in the gunit.jar source and see
> >> references to escaped quotes in the parser grammar but can't
> >> manage to work that back into how to write them.
> >> Many thanks! :-)
> >> Ana
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080207/8e347e14/attachment.html 


More information about the antlr-interest mailing list