This is the mail archive of the
mailing list for the GCC project.
Re: [GSoC] writing test-case
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Diego Novillo <dnovillo at google dot com>, gcc <gcc at gcc dot gnu dot org>, Maxim Kuvyrkov <maxim dot kuvyrkov at linaro dot org>
- Date: Sun, 11 May 2014 16:40:35 +0200
- Subject: Re: [GSoC] writing test-case
- Authentication-results: sourceware.org; auth=none
- References: <CAJXstsAsui9S5q2Q0VxUjnrtgvbgd+W_cxcZqXG-p5dEqpNnEQ at mail dot gmail dot com>
Prathamesh Kulkarni <email@example.com> writes:
> a) I am not able to follow why 3 slashes are required here
> in x_.\\\(D\\\) ? Why does x_.\(D\) not work ?
Two of the three backslashes are eaten by the tcl parser. But actually
only two backslashes are needed, since the parens are not special to tcl
(but are special to the regexp engine, so you want a single backslash
surviving the tcl parser).
> b) The expression after folding would be of the form:
> t2_<digit> = x_<digit>(D) - y_<digit>(D)
> I have used the operator "." in the pattern to match digit.
> While that works in the above case, I think a better
> idea would be to match using [0-9].
> I tried the following but it does not work:
> t_[0-9] = x_[0-9]\\\(D\\\) - y_[0-9]\\\(D\\\)
> Neither does \\\[ and \\\] work.
Brackets are special in tcl (including inside double quotes), so they
need to be quoted. But you want the brackets to appear unquoted to the
regexp engine, so a single backslash will do the Right Thing.
See tcl(n) for the tcl parsing rules.
Andreas Schwab, firstname.lastname@example.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."