Create a new indenter object based on regexp. The idea is to have a .indent file for every language like .lang files. We could integrate the indentation directly in the .lang file but, by the momment we will test it in separate files.

Brainstorm:

C definition

The regexp in the xml are examples, it has not been tested

<indentation>
    <!-- Comments, insert the previous line indent + 2 spaces and append the * and an space-->
    <indenter match = ".*/\*(^\*/)*" indent = "current_ind" append = "  * " />

    <indenter match = "#.*" indent = "current_ind" />

    <!-- Start a block --->
    <indenter match = ".*\{[^\}]*" indent = "current_ind + 1" />
    
    <!-- When colse a parenthesis -->
    <indenter match = "*.\)\s*">
        <!-- Search the line the the open ( and set that indent + 1 indent-->
        <get_pair_line pair = "(" indent = "pair_line_ind + 1" />
    </indenter>

    <!-- The line doesn't end with a ;
    <indenter match=".*[^;]">
        <indenter match=".*\([^\)]*">
            <!-- If theis a ( in the line, set the indentation under the ( + 1 space -->
            <get_pair_line pair="(" indent="pair_pos" append=" " />
            <!-- If the previous indenter cannot find, then we set the indent + 1 -->
            <indenter indent="current_ind + 1" />
       </indenter>
    </indenter>
</indentation>

XML definition

The regexp in the xml are examples, it has not been tested

<indentation>
    <indenter match = ".*<!--(^-->)*" indent = "current_ind + 1" />
    <indenter match = ".*<[^>]*" indent = "current_ind + 1" />
    <indenter match = ".*>[^<]*">
        <get_pair_line pair = "<" indent = "pair_line_ind + 1" />
    </indenter>
</indentation>

Projects/GtkSourceView/IndentationIdeas (last edited 2013-11-22 15:58:40 by WilliamJonMcCann)