On Thu, 2007-04-26 at 10:52 -0400, Chris King wrote:
> On 4/25/07, skaller <[EMAIL PROTECTED]> wrote:
> > It opens up the issue of what
> > to do with string literals. In Python it is very painful,
> > because the literals don't support nice block indent style.
> 
> I've always liked the algorithm used by the textwrap module that Erick
> mentions:

So actually, if someone wants to write an Ocaml function:

let textwrap x = ...

and perhaps test on some examples .. we can consider adding
it to the lexer, presumably applying to """ and ''' strings
but not r""" and r''' strings.

You should note that Felix allows:

        val py = 
        "  def f(x):\n"
        "    A = x + 1" 0x12 0x10 
        "    try:\n"
        "      A = A + " (str 99) "\n"
        "    except:\n"
        "      print '" ("-" * 20) "'\n"
        "      print '" 63 "n Error'\n"
        ;

Although the concatenation is built-in to the compiler as part
of the macro time constant folding, it also works at run time:

        var hello = "Hello";
        var sp = " ";
        var dot = ".";
        var world = "World";
        var eol = "\n";
        print$ hello sp (dot * 4) sp world eol;

In fact .. there's no late optimisation of this: 
that is, there is no 'C code' constant folder or
other optimisation of C code (there could be: C code
is generated using an AST)

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to