[code] Doing folds with weird syntax.

From: Michael Richter <ttmrichter.att.gmail.com>
Date: Sun, 10 Nov 2013 13:52:37 +0800

I'm finishing up my lexer for the Mercury language. I've hit a bit of a
snag in doing fold support.

In Mercury, for example, a type declaration looks like this:

:- type tree234(K, V)
    ---> empty
    ; two(K, V, tree234(K, V), tree234(K, V))
    ; three(K, V, K, V, tree234(K, V), tree234(K, V), tree234(K, V))
    ; four(K, V, K, V, K, V, tree234(K, V), tree234(K, V),
                tree234(K, V), tree234(K, V)).

You would fold on the *type* keyword as well as the *--->* operator. In
both instances, however, you terminate on the *same period*. I can't
figure out how I'd do this for folding. Further, in the first case you're
folding on a *keyword* (type) but ending on an *operator* (.) which, again,
I can't figure out how to provide the magic incantations for.

How would others do this one?

-- 
"Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 10 Nov 2013 - 00:52:37 EST

This archive was generated by hypermail 2.2.0 : Sun 10 Nov 2013 - 06:33:36 EST