Paste: clay layout syntax

Author: j
Mode: text
Date: Mon, 28 Feb 2011 18:14:56
Plain Text |
// a statement begins with the first non-whitespace character
// and extends up to (but not including):
// - the next line at the same indentation level that doesn't
//    begin with ) ] }, or
// - a ';' token

// if the last non-whitespace token on a line is ':', a
// block is opened and extends up to the next line at
// the same indentation level. alternately { } can be
// used

// manual layout:

symbol foo;
overload foo(x, y) {
    show(x);
    show(y);

    if x < y {
        return (
            x * y
            + x / y
        );
    } else {
        return 0
    }
}

// automatic layout:

symbol foo
overload foo(x, y):
    show(x)
    show(y)
    if x < y:
        return (
            x * y
            + x / y
        )
    else:
        return 0

New Annotation

Summary:
Author:
Mode:
Body: