<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 6, 2013 at 11:54 AM, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">It's time for clang-format to support more flexible style configuration. We're starting to work on configuration files support for clang-format.<div>
<br><div>Some thoughts on desired features and overall design:<div>
<ul><li><b>contents</b>: fields of the FormatStyle struct, which currently has < 20 fields of primitive types;</li>
<li><b>format</b>: a set of key-value pairs, most probably JSON or YAML with flat structure, e.g.:<br> ColumnLimit: 80<br> ConstructorInitializerAllOnOneLineOrOnePerLine: true<br> ...</li><li><b>file location</b>: in a longer term we'd like to support local per-project hierarchical model, so that style can be configured for a project and then partially or fully overridden in its various subprojects. E.g. for this directory structure:<br>
<font face="courier new, monospace"> dir:<br> .clang-format<br> a.cpp<br> subdir:<br> .clang-format<br> b.cpp<br></font><br><font face="courier new, monospace"><b>clang-format dir/a.cpp</b></font> should read only <font face="courier new, monospace">dir/.clang-format</font> (assuming that there are no .clang-format files in parent directories), <font face="courier new, monospace"><b>clang-format dir/subdir/b.cpp</b></font> should use configuration values from <font face="courier new, monospace">dir/subdir/.clang-format</font>, and for the values not defined there try to get them from <font face="courier new, monospace">dir/.clang-format</font></li>
<li><font face="arial, helvetica, sans-serif"><b>command-line interface</b>: there's currently </font><font face="courier new, monospace">-style</font><font face="arial, helvetica, sans-serif"> option which takes a name of a predefined style, we can use "</font><font face="courier new, monospace">-style config</font><font face="arial, helvetica, sans-serif">" or "</font><font face="courier new, monospace">-style file</font><font face="arial, helvetica, sans-serif">" to turn on configuration file parsing, or turn it on by default.</font></li>
</ul><font face="arial, helvetica, sans-serif">Any comments/suggestions?</font></div></div></div></div>
<br></blockquote></div><br><br>(1)<br><br>Instead of writing :<br><br>ConstructorInitializerAllOnOneLineOrOnePerLine <br><br><br>Use of underscores makes reading more easier :<br><br>Constructor_Initializer_All_On_One_Line_Or_One_Per_Line<br>
<br><br>(2)<br><br></div><div class="gmail_extra">Instead of using - ( dash ) , use of underscore as a separator between words allows use of variable parsing procedures to be used for parsing lines :<br><br><font face="courier new, monospace">"clang-format" as three tokens <br>
versus </font><font face="courier new, monospace"><br>"clang_format"</font> as one token .<br><br><br><br></div><div class="gmail_extra">Thank you very much .<br><br><br></div><div class="gmail_extra">Mehmet Erol Sanliturk<br>
<br><br><br></div><div class="gmail_extra"><br><br><br></div></div>