Re: Enhancement Request: Folding Whitespace

Ger Hobbelt <[email protected]> Tue, 30 Jun 2009 01:18:40 +0200
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
On Sun, Jun 28, 2009 at 10:34 AM, Chris
Babcock<[email protected]> wrote:
> A different request (unless I somehow missed it in the docs)...
> a :_var: for { and }.

Well, first off, you could of course always roll your own suing an
isolate statement like (probably buggy, off the top of my head here):

isolate (:_cbo:) /\\\{/
isolate (:_cbc:) /\\\}/

I only show three '\' here because ...

> I was building a little something to help me manage my CSS a little
> easier - http://crm.pastebin.com/f61f6952e - and I found out that it's
> somewhat tricky to match curly braces and downright demonic trying to
> match just one without its partner. This works in a match:
>
>        /\\{...\\}/
>
> Singly, however...
>
> [usak@cl-t090-563cl includes]$ crm "-{match /\\{/; output /found/}"
> {
>
> crm: *ERROR*
>  Regular Expression Compilation Problem: Missing '}'
> Sorry, but this program is very sick and probably should be killed off.
> This happened at line 2 of file (from command line):
>    match /\{/
> (runtime system location: crm_expr_match.c(249) in routine:
> crm_expr_match)
>
> This is on Blame Barack. It's between delimiters, so it shouldn't
> matter... but it does.

... this /might/ (and note: I'm now ad libbing at full power; haven't
touched crm114 in a while due to real life catching up with me) be due
to either:

a) teeny bugger in TRE (my bet is: small chance, but who am I)

b) a bugger similar to the awk escape agony sisters, where in awk you
can run into some peculiarities due to certain expressions being
'evaluated' _twice_, thus 'unescaping' twice: once every round.
Add to that possible escaping in the shell and you've got jackpot.
(Meaning: your example may behave differently as shown (shell command
line) and when run as a crm script file (where the same statement is
stored in a source file and thus fed to crm114.)

You may want to test this error happening with

\{
\\{
\\\{
\\\\{

and see which of those buggers actually makes it into TRE as a
_literal_ curly brace open, without triggering an error.

Such test cases (and that includes the error-throwing ones!) are very
nice to have for augmenting the test/regression set. Thanks for
posting #1 of that set already.


An alternative cop-out which I've used with awk (which I am a big fan
of) or sed is faking it through wrapping special chars in [] set
expressions, e.g.: sed -e expression

s/[{]/X/g



> Just wait until I finish the mailing list, blog, forums and CMS. ;-)

I am not worthy...


> What you were getting was a 500 Internal Server Error - mostly. What you
> should have been getting was a page with a map on it and a simple form
> to change the map - neatly embedded in the template that provides the
> site nav, of course.
>
> Thanks much. I got it straigtened out just before a third party site
> that most players use tanked. What a Beta party!

You're welcome. I was quite sure testing was way quicker than building
the site. ;-)



-- 
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   [email protected]
mobile: +31-6-11 120 978
--------------------------------------------------

------------------------------------------------------------------------------