Compare commits

...
16 Commits
Author SHA1 Message Date
Andre Simon 82fd2d21c7 updated notes 2023-06-16 21:42:37 +02:00
saalen 3675f954b6 https://sourceforge.net/p/astyle/bugs/353/ fix indent after new in previous line #2 2023-06-15 17:02:25 +02:00
saalen 5551b2b25b https://sourceforge.net/p/astyle/bugs/353/ fix indent after new in previous line 2023-06-14 16:14:35 +02:00
saalen 221457c348 updated astyle docs and shell completion 2023-06-14 10:31:25 +02:00
saalen 21a892b5b5 updated notes 2023-06-14 10:08:56 +02:00
saalen a372130733 #6 updated docs 2023-06-14 10:01:48 +02:00
saalen 69c8c34f43 https://gitlab.com/saalen/astyle/-/issues/12 fixed indentation of struct assignments 2023-06-14 10:01:14 +02:00
saalen 8e66ef8de3 #10 fixed indentation of member declarations 2023-06-12 13:57:20 +02:00
saalen e0963a5233 #11 fixed false lambda recognition 2023-06-12 11:44:57 +02:00
saalen 8f421ab582 #7 added new option --indent-lambda to to enable new lambda recognition 2023-06-12 11:44:21 +02:00
saalen 28f2c87919 #8 fixed formatting of CS interpolation literals 2023-06-06 13:37:05 +02:00
André Simon 90232de96e Merge branch 'std_namespace' into 'master'
Add missing std namespace

See merge request saalen/astyle!2
2023-05-24 12:31:51 +00:00
Antoine Belvire c03fe1133f Add missing std namespace
Fixes build on Linux.
2023-05-24 10:38:10 +00:00
saalen 0ffb5e4426 updated version string 2023-05-17 11:10:34 +02:00
saalen aa9a8beafa https://sourceforge.net/p/astyle/bugs/487/ fixed indent of brace initializer with new 2023-05-15 16:46:49 +02:00
saalen 56ddd730d9 updated release notes 2023-05-11 16:00:03 +02:00
14 changed files with 359 additions and 255 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ endif()
# Linux Soname Version
set(MAJORVER 3)
set(MINORVER 3)
set(MINORVER 4)
set(PATCHVER 0)
set(SOLIBVER ${MAJORVER}.${MINORVER}.${PATCHVER})
+266 -177
View File
@@ -17,14 +17,16 @@
<style type="text/css">
hr { margin-left: -0.4in; }
/* the following styles are for formatting code samples */
div.code { background: #fffdda; padding: 0.5em; border-style: 1px solid;}
div.code { background: #fffdda; padding: 0.5em; border: 1px gray solid; border-radius: 5px;}
/* code */
code { color: navy; }
code { color: mediumblue; }
code.title { font-size: larger; font-weight: bold; }
/* spans */
span.brace { color: red; }
span.comment { color: dimgray; font-style: italic; }
span.option { color: saddlebrown; font-weight: bold; }
p.contents2 > a { margin-left: 2em; display: list-item;}
</style>
<!-- When the user scrolls down from the top of the document, show the button -->
@@ -62,162 +64,166 @@
<h2>
A Free, Fast, and Small Automatic Formatter<br />
for C, C++, C++/CLI, Objective&#8209;C, C#, and Java Source Code
for C, C++, C++/CLI, Objective-C, C#, and Java Source Code
</h2>
<h3 id="Contents">Contents</h3>
<p class="contents1">
<a class="contents" href="#_General_Information">General&nbsp;Information</a></p>
<a href="#_General_Information">General&nbsp;Information</a></p>
<p class="contents1">
<a class="contents" href="#_Quick_Start">Quick&nbsp;Start</a></p>
<a href="#_Quick_Start">Quick&nbsp;Start</a></p>
<p class="contents1">
<a class="contents" href="#_Usage">Usage</a></p>
<a href="#_Usage">Usage</a></p>
<p class="contents1">
<a class="contents" href="#_Options">Options</a></p>
<a href="#_Options">Options</a></p>
<p class="contents1">
<a class="contents" href="#_Option_Files">Option&nbsp;Files</a></p>
<a href="#_Option_Files">Option&nbsp;Files</a></p>
<p class="contents1">
<a class="contents" href="#_Disable_Formatting">Disable&nbsp;Formatting</a></p>
<a href="#_Disable_Formatting">Disable&nbsp;Formatting</a></p>
<p class="contents1">
<a class="contents" href="#_Basic_Brace_Styles">Basic&nbsp;Brace&nbsp;Styles</a></p>
<a href="#_Basic_Brace_Styles">Basic&nbsp;Brace&nbsp;Styles</a></p>
<p class="contents1">
<a class="contents" href="#_Brace_Style_Options">Brace&nbsp;Style&nbsp;Options</a></p>
<a href="#_Brace_Style_Options">Brace&nbsp;Style&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_default_brace_style">default&nbsp;brace&nbsp;style</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=allman">style=allman</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=java">style=java</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=kr">style=kr</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=stroustrup">style=stroustrup</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=whitesmith">style=whitesmith</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=vtk">style=vtk</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=ratliff">style=ratliff</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=gnu">style=gnu</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=linux">style=linux</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=horstmann">style=horstmann</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=1tbs">style=1tbs</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=google">style=google</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=mozilla">style=mozilla</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=webkit">style=webkit</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=pico">style=pico</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_style=lisp">style=lisp</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_default_brace_style">default&nbsp;brace&nbsp;style</a>
<a class="contents" href="#_style=allman">style=allman</a>
<a class="contents" href="#_style=java">style=java</a>
<a class="contents" href="#_style=kr">style=kr</a>
<a class="contents" href="#_style=stroustrup">style=stroustrup</a>
<a class="contents" href="#_style=whitesmith">style=whitesmith</a>
<a class="contents" href="#_style=vtk">style=vtk</a>
<a class="contents" href="#_style=ratliff">style=ratliff</a>
<a class="contents" href="#_style=gnu">style=gnu</a>
<a class="contents" href="#_style=linux">style=linux</a>
<a class="contents" href="#_style=horstmann">style=horstmann</a>
<a class="contents" href="#_style=1tbs">style=1tbs</a>
<a class="contents" href="#_style=google">style=google</a>
<a class="contents" href="#_style=mozilla">style=mozilla</a>
<a class="contents" href="#_style=webkit">style=webkit</a>
<a class="contents" href="#_style=pico">style=pico</a>
<a class="contents" href="#_style=lisp">style=lisp</a>
</p>
<p class="contents1">
<a class="contents" href="#_Tab_Options">Tab&nbsp;Options</a></p>
<a href="#_Tab_Options">Tab&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_default_indent">default&nbsp;indent</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent=spaces">indent=spaces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent=tab">indent=tab</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent=force-tab">indent=force&#8209;tab</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent=force-tab-x">--indent=force&#8209;tab&#8209;x</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_default_indent">default&nbsp;indent</a>
<a class="contents" href="#_indent=spaces">indent=spaces</a>
<a class="contents" href="#_indent=tab">indent=tab</a>
<a class="contents" href="#_indent=force-tab">indent=force-tab</a>
<a class="contents" href="#_indent=force-tab-x">--indent=force-tab-x</a>
</p>
<p class="contents1">
<a class="contents" href="#_Brace_Modify_Options">Brace&nbsp;Modify&nbsp;Options</a></p>
<a href="#_Brace_Modify_Options">Brace&nbsp;Modify&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_attach_namespaces">attach&#8209;namespaces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach_classes">attach&#8209;classes</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach_inlines">attach&#8209;inlines</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach-extern-c">attach&#8209;extern&#8209;c</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach-closing-while">attach&#8209;closing&#8209;while</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach_namespaces">attach-namespaces</a>
<a class="contents" href="#_attach_classes">attach-classes</a>
<a class="contents" href="#_attach_inlines">attach-inlines</a>
<a class="contents" href="#_attach-extern-c">attach-extern-c</a>
<a class="contents" href="#_attach-closing-while">attach-closing-while</a>
</p>
<p class="contents1">
<a class="contents" href="#_Indentation_Options">Indentation&nbsp;Options</a></p>
<a href="#_Indentation_Options">Indentation&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_indent-classes">indent&#8209;classes</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-modifiers">indent&#8209;modifiers</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-switches">indent&#8209;switches</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-cases">indent&#8209;cases</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-namespaces">indent&#8209;namespaces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-after-parens">indent&#8209;after&#8209;parens</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-continuation">indent&#8209;continuation</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-labels">indent&#8209;labels</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-preproc-block">indent&#8209;preproc&#8209;block</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-preproc-define">indent&#8209;preproc&#8209;define</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-preproc-cond">indent&#8209;preproc&#8209;cond</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-col1-comments">indent&#8209;col1&#8209;comments</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_min-conditional-indent">min&#8209;conditional&#8209;indent</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_max-continuation-indent">max&#8209;continuation&#8209;indent</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_indent-classes">indent-classes</a>
<a class="contents" href="#_indent-modifiers">indent-modifiers</a>
<a class="contents" href="#_indent-switches">indent-switches</a>
<a class="contents" href="#_indent-cases">indent-cases</a>
<a class="contents" href="#_indent-namespaces">indent-namespaces</a>
<a class="contents" href="#_indent-after-parens">indent-after-parens</a>
<a class="contents" href="#_indent-continuation">indent-continuation</a>
<a class="contents" href="#_indent-labels">indent-labels</a>
<a class="contents" href="#_indent-preproc-block">indent-preproc-block</a>
<a class="contents" href="#_indent-preproc-define">indent-preproc-define</a>
<a class="contents" href="#_indent-preproc-cond">indent-preproc-cond</a>
<a class="contents" href="#_indent-col1-comments">indent-col1-comments</a>
<a class="contents" href="#_min-conditional-indent">min-conditional-indent</a>
<a class="contents" href="#_max-continuation-indent">max-continuation-indent</a>
<a class="contents" href="#_lambda_indent">lambda-indent</a>
</p>
<p class="contents1">
<a class="contents" href="#_Padding_Options">Padding&nbsp;Options</a></p>
<a href="#_Padding_Options">Padding&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_break-blocks">break&#8209;blocks</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-blocks=all">break&#8209;blocks=all</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-oper">pad&#8209;oper</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-comma">pad&#8209;comma</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-paren">pad&#8209;paren</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-paren-out">pad&#8209;paren&#8209;out</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-first-paren-out">pad&#8209;first&#8209;paren&#8209;out</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-paren-in">pad&#8209;paren&#8209;in</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-header">pad&#8209;header</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_unpad-paren">unpad&#8209;paren</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-brackets">pad&#8209;brackets</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_unpad-brackets">unpad&#8209;brackets</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_delete-empty-lines">delete&#8209;empty&#8209;lines</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_fill-empty-lines">fill&#8209;empty&#8209;lines</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_align-pointer">align&#8209;pointer</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_align-reference">align&#8209;reference</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-blocks">break-blocks</a>
<a class="contents" href="#_break-blocks=all">break-blocks=all</a>
<a class="contents" href="#_pad-oper">pad-oper</a>
<a class="contents" href="#_pad-comma">pad-comma</a>
<a class="contents" href="#_pad-paren">pad-paren</a>
<a class="contents" href="#_pad-paren-out">pad-paren-out</a>
<a class="contents" href="#_pad-first-paren-out">pad-first-paren-out</a>
<a class="contents" href="#_pad-paren-in">pad-paren-in</a>
<a class="contents" href="#_pad-header">pad-header</a>
<a class="contents" href="#_unpad-paren">unpad-paren</a>
<a class="contents" href="#_pad-brackets">pad-brackets</a>
<a class="contents" href="#_unpad-brackets">unpad-brackets</a>
<a class="contents" href="#_delete-empty-lines">delete-empty-lines</a>
<a class="contents" href="#_fill-empty-lines">fill-empty-lines</a>
<a class="contents" href="#_squeeze-ws">squeeze-ws</a>
<a class="contents" href="#_squeeze-lines">squeeze-lines</a>
<a class="contents" href="#_align-pointer">align-pointer</a>
<a class="contents" href="#_align-reference">align-reference</a>
</p>
<p class="contents1">
<a class="contents" href="#_Formatting_Options">Formatting&nbsp;Options</a></p>
<a href="#_Formatting_Options">Formatting&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_break-closing-braces">break&#8209;closing&#8209;braces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-elseifs">break&#8209;elseifs</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-one-line-headers">break&#8209;one&#8209;line&#8209;headers</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_add-braces">add&#8209;braces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_add-one-line-braces">add&#8209;one&#8209;line&#8209;braces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_remove-braces">remove&#8209;braces</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-return-type">break&#8209;return&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_attach-return-type">attach&#8209;return&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_keep-one-line-blocks">keep&#8209;one&#8209;line&#8209;blocks</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_keep-one-line-statements">keep&#8209;one&#8209;line&#8209;statements</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_convert-tabs">convert&#8209;tabs</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_close-templates">close&#8209;templates</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_remove-comment-prefix">remove&#8209;comment&#8209;prefix</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_max-code-length">max&#8209;code&#8209;length</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_max-code-length">break&#8209;after&#8209;logical</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_mode">mode</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_break-closing-braces">break-closing-braces</a>
<a class="contents" href="#_break-elseifs">break-elseifs</a>
<a class="contents" href="#_break-one-line-headers">break-one-line-headers</a>
<a class="contents" href="#_add-braces">add-braces</a>
<a class="contents" href="#_add-one-line-braces">add-one-line-braces</a>
<a class="contents" href="#_remove-braces">remove-braces</a>
<a class="contents" href="#_break-return-type">break-return-type</a>
<a class="contents" href="#_attach-return-type">attach-return-type</a>
<a class="contents" href="#_keep-one-line-blocks">keep-one-line-blocks</a>
<a class="contents" href="#_keep-one-line-statements">keep-one-line-statements</a>
<a class="contents" href="#_convert-tabs">convert-tabs</a>
<a class="contents" href="#_close-templates">close-templates</a>
<a class="contents" href="#_remove-comment-prefix">remove-comment-prefix</a>
<a class="contents" href="#_max-code-length">max-code-length</a>
<a class="contents" href="#_max-code-length">break-after-logical</a>
<a class="contents" href="#_mode">mode</a>
</p>
<p class="contents1">
<a class="contents" href="#_Objective_C_Options">Objective&#8209;C&nbsp;Options</a></p>
<a href="#_Objective_C_Options">Objective-C&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_pad-method-prefix">pad&#8209;method&#8209;prefix</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_unpad-method-prefix">unpad&#8209;method&#8209;prefix</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-return-type">pad&#8209;return&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_unpad-return-type">unpad&#8209;return&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-param-type">pad&#8209;param&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_unpad-param-type">unpad&#8209;param&#8209;type</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_align-method-colon">align&#8209;method&#8209;colon</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-method-colon">pad&#8209;method&#8209;colon</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_pad-method-prefix">pad-method-prefix</a>
<a class="contents" href="#_unpad-method-prefix">unpad-method-prefix</a>
<a class="contents" href="#_pad-return-type">pad-return-type</a>
<a class="contents" href="#_unpad-return-type">unpad-return-type</a>
<a class="contents" href="#_pad-param-type">pad-param-type</a>
<a class="contents" href="#_unpad-param-type">unpad-param-type</a>
<a class="contents" href="#_align-method-colon">align-method-colon</a>
<a class="contents" href="#_pad-method-colon">pad-method-colon</a>
</p>
<p class="contents1">
<a class="contents" href="#_Other_Options">Other&nbsp;Options</a>&nbsp;&nbsp;&nbsp;</p>
<a href="#_Other_Options">Other&nbsp;Options</a> </p>
<p class="contents2">
<a class="contents" href="#_suffix">suffix</a>&nbsp;&nbsp;&nbsp; <a class="contents" href="#_suffix=none">suffix=none</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_recursive">recursive</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_dry-run">dry-run</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_exclude">exclude</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_ignore-exclude-errors">ignore&#8209;exclude&#8209;errors</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_ignore-exclude-errors-x">ignore&#8209;exclude&#8209;errors&#8209;x</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_errors-to-stdout">errors&#8209;to&#8209;stdout</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_preserve-date">preserve&#8209;date</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_verbose">verbose</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_formatted">formatted</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_quiet">quiet</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_lineend">lineend</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_suffix">suffix</a> <a class="contents" href="#_suffix=none">suffix=none</a>
<a class="contents" href="#_recursive">recursive</a>
<a class="contents" href="#_dry-run">dry-run</a>
<a class="contents" href="#_exclude">exclude</a>
<a class="contents" href="#_ignore-exclude-errors">ignore-exclude-errors</a>
<a class="contents" href="#_ignore-exclude-errors-x">ignore-exclude-errors-x</a>
<a class="contents" href="#_errors-to-stdout">errors-to-stdout</a>
<a class="contents" href="#_preserve-date">preserve-date</a>
<a class="contents" href="#_verbose">verbose</a>
<a class="contents" href="#_formatted">formatted</a>
<a class="contents" href="#_quiet">quiet</a>
<a class="contents" href="#_lineend">lineend</a>
</p>
<p class="contents1">
<a class="contents" href="#_Command_Line_Only">Command&nbsp;Line&nbsp;Only</a></p>
<a href="#_Command_Line_Only">Command&nbsp;Line&nbsp;Only</a></p>
<p class="contents2">
<a class="contents" href="#_options">options</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_project">project</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_ascii">ascii</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_version">version</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_help">help</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_html">html</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_html=">html=</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_stdin=">stdin=</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_stdout=">stdout=</a>&nbsp;&nbsp;&nbsp;
<a class="contents" href="#_options">options</a>
<a class="contents" href="#_project">project</a>
<a class="contents" href="#_ascii">ascii</a>
<a class="contents" href="#_version">version</a>
<a class="contents" href="#_help">help</a>
<a class="contents" href="#_html">html</a>
<a class="contents" href="#_html=">html=</a>
<a class="contents" href="#_stdin=">stdin=</a>
<a class="contents" href="#_stdout=">stdout=</a>
</p>
<p>
&nbsp;</p>
@@ -269,11 +275,11 @@
these settings. If no translation is available it will default to English. There is an "ascii" option to use English
instead of the system language.</p>
<p>
The source code for the translations is at the end of ASLocalizer.cpp in the form of an English&#8209;Translation
The source code for the translations is at the end of ASLocalizer.cpp in the form of an English-Translation
pair. If you make corrections to a translation, send the source as a bug report and it will be included in the
next release.</p>
<p>
To add a new language, add a new translation class to ASLocalizer.h. Add the English&#8209;Translation pair to
To add a new language, add a new translation class to ASLocalizer.h. Add the English-Translation pair to
the constructor in ASLocalizer.cpp. Update the WinLangCode array and add the language code to the function setTranslationClass().
The ASLocalizer.cpp program contains comments that give web pages for obtaining the LCIDs and language codes.
Send the source code as a bug report and it will be included in the next release.</p>
@@ -284,10 +290,10 @@
The names of special characters used in programming vary by region. The terminology used by Artistic Style,
followed by other common names, is<strong>:</strong></p>
<blockquote>
braces or curly braces { } &#8209; also called brackets, or curly brackets.<br />
parens or round brackets ( ) &#8209; also called parentheses, brackets, circle brackets, or soft brackets.<br />
square brackets [ ] &#8209; also called block parens, brackets, closed brackets, or hard brackets.<br />
angle brackets < > &#8209; also called brackets, pointy brackets, triangular brackets, diamond brackets, tuples,
braces or curly braces { } - also called brackets, or curly brackets.<br />
parens or round brackets ( ) - also called parentheses, brackets, circle brackets, or soft brackets.<br />
square brackets [ ] - also called block parens, brackets, closed brackets, or hard brackets.<br />
angle brackets < > - also called brackets, pointy brackets, triangular brackets, diamond brackets, tuples,
or chevrons.
</blockquote>
<p>
@@ -305,12 +311,12 @@
hanging indent format is used. If the "exec sql" statement is indented more than the following statements, the
SQL will be aligned in a single column.</p>
<p>
Unicode files encoded as UTF&#8209;16, both big and little endian, will be formatted. The files must begin with
a byte order mark (BOM) to be recognized. Files encoded as UTF&#8209;32 will be rejected. Some compilers do not
support these encodings. These files can be converted to UTF&#8209;8 encoding with the program "iconv". There
Unicode files encoded as UTF-16, both big and little endian, will be formatted. The files must begin with
a byte order mark (BOM) to be recognized. Files encoded as UTF-32 will be rejected. Some compilers do not
support these encodings. These files can be converted to UTF-8 encoding with the program "iconv". There
are Linux and Windows versions available (the Windows version does not seem to work for all encodings). Visual
Studio can convert the files from the "File &gt; Advanced Save Options" menu. There are other development environments
and text editors, such as SciTE, that can convert files to UTF&#8209;8.</p>
and text editors, such as SciTE, that can convert files to UTF-8.</p>
<p>
Embedded statements that are multiple-line and are NOT in a C-type format, such as Python, are usually mal-formatted
(a C-type format has blocks enclosed by braces and statements terminated by a semi-colon). Macros that define
@@ -656,8 +662,8 @@ indent-switches <span class="comment"># cannot do this on the command line</
a function.</p>
<p>
Using the k&amp;r option may cause problems because of the &amp;. This can be resolved by enclosing the k&amp;r
in quotes (e.g. &#8209;&#8209;style="k&amp;r") or by using one of the alternates &#8209;&#8209;style=kr or
&#8209;&#8209;style=k/r.</p>
in quotes (e.g. --style="k&amp;r") or by using one of the alternates --style=kr or
--style=k/r.</p>
<div class="code">
<pre>int Foo(bool isBar)
<span class="brace">{</span>
@@ -676,7 +682,7 @@ indent-switches <span class="comment"># cannot do this on the command line</
Stroustrup style uses linux braces. Opening braces are broken from function definitions only. The opening braces
are attached to everything else, including namespaces, classes, arrays, structs, enums, and statements within
a function.&nbsp; The closing headers are broken from closing braces (e.g. --break-closing-headers). This style
frequently is used with attach&#8209;closing&#8209;while, tabbed indents, and an indent of 5
frequently is used with attach-closing-while, tabbed indents, and an indent of 5
spaces. </p>
<div class="code">
<pre>int Foo(bool isBar)
@@ -815,7 +821,7 @@ indent-switches <span class="comment"># cannot do this on the command line</
else, including arrays, structs, enums, and statements within a function. </p>
<p>
In the following example, braces have been added to the "return 0;" statement. The option
&#8209;&#8209;add&#8209;one&#8209;line&#8209;braces can also be used with this style.</p>
--add-one-line-braces can also be used with this style.</p>
<div class="code">
<pre>int Foo(bool isBar)
<span class="brace">{</span>
@@ -869,7 +875,7 @@ indent-switches <span class="comment"># cannot do this on the command line</
<code class="title">--style=webkit / -A17</code><br />
WebKit style uses linux braces. Opening braces are broken from function definitions only. The opening braces are
attached to everything else, including namespaces, classes, arrays, structs, enums, and statements within a function.
This style frequently is used with attach&#8209;closing&#8209;while, and an indent of 4 spaces.
This style frequently is used with attach-closing-while, and an indent of 4 spaces.
</p>
<div class="code">
<pre>int Foo(bool isBar)
@@ -1159,7 +1165,7 @@ public:
<code class="title">--indent-modifiers / -xG</code><br />
Indent 'class ' and 'struct' access modifiers, 'public:', 'protected:'
and 'private:', one half indent. The rest of the class is not indented. This option is effective
for C++ files only. If used with indent&#8209;classes this option will be ignored.</p>
for C++ files only. If used with indent-classes this option will be ignored.</p>
<div class="code">
<pre>class Foo
<span class="brace">{</span>
@@ -1444,7 +1450,7 @@ error:
<p id="_indent-col1-comments">
<code class="title">--indent-col1-comments / -Y</code><br />
Indent C++ comments beginning in column one. By default C++ comments beginning in column one are
assumed to be commented&#8209;out code and not indented. This option will allow the comments to be indented with
assumed to be commented-out code and not indented. This option will allow the comments to be indented with
the code.</p>
<div class="code">
<pre>void Foo()\n"
@@ -1509,6 +1515,7 @@ if (a &lt; b
</div>
<p>
&nbsp;</p>
<p id="_max-continuation-indent">
<code class="title">--max-continuation-indent=<span class="option">#</span> / -M<span class="option">#</span></code><br />
Set the &nbsp;maximum of <span class="option">#</span> spaces to indent a continuation line. The
@@ -1536,6 +1543,38 @@ fooFunction(barArg1,
barArg3);
</pre>
</div>
<p id="_lambda_indent">
<code class="title">--lambda-indent</code><br />
This option improves indentation of C++ lambda functions. As it currently does not work well with complex lambda function bodies, this feature is not enabled by default.
</p>
<div class="code">
<pre>void abssort (float* x, unsigned n)
{
std::sort (x, x + n,
[] (float a, float b) {
return (std::abs (a) < std::abs (b));
}
);
}</pre>
</div>
<p class="code">
becomes:</p>
<div class="code">
<pre>void abssort (float* x, unsigned n)
{
std::sort (x, x + n,
[] (float a, float b) {
return (std::abs (a) < std::abs (b));
}
);
}</pre>
</div>
<p>
&nbsp;</p>
<hr />
@@ -1673,9 +1712,9 @@ isBar = false;
<br />
Insert space padding around the <strong>first</strong> paren in a series on the <strong>outside</strong>
only. Parens that are empty will not be padded. Any end of line comments will remain in the original column,
if possible. This can be used with unpad-paren below to remove unwanted spaces. If used with pad&#8209;paren or
pad&#8209;paren&#8209;out, this option will be ignored. If used with pad&#8209;paren&#8209;in, the result will
be the pad&#8209;paren.</p>
if possible. This can be used with unpad-paren below to remove unwanted spaces. If used with pad-paren or
pad-paren-out, this option will be ignored. If used with pad-paren-in, the result will
be the pad-paren.</p>
<div class="code">
<pre>if (isFoo((a+2), b))
bar(a, b);
@@ -1727,13 +1766,13 @@ isBar = false;
<br />
Remove extra space padding around parens on the inside and outside. Any end of line comments will remain
in the original column, if possible. This option can be used in combination with the paren padding options
pad&#8209;paren, pad&#8209;paren&#8209;out, pad&#8209;paren&#8209;in,
and pad&#8209;header above. Only padding that has not been requested by other options will be
pad-paren, pad-paren-out, pad-paren-in,
and pad-header above. Only padding that has not been requested by other options will be
removed.</p>
<p>
For example, if a source has parens padded on both the inside and outside, and you want inside only. You need
to use unpad-paren to remove the outside padding, and pad&#8209;paren&#8209;in to
retain the inside padding. Using only pad&#8209;paren&#8209;in> would not remove the outside
to use unpad-paren to remove the outside padding, and pad-paren-in to
retain the inside padding. Using only pad-paren-in> would not remove the outside
padding.</p>
<div class="code">
<pre>if ( isFoo( ( a+2 ), b ) )
@@ -1794,14 +1833,68 @@ isBar = false;
<span class="brace">{</span>
foo1 = 1;
foo2 = 2;
<span class="brace">}</span>
</pre>
<span class="brace">}</span></pre>
</div>
<p>
&nbsp;</p>
<p id="_fill-empty-lines">
<code class="title">--fill-empty-lines / -E</code><br />
Fill empty lines with the white space of the previous line.</p>
<p>
&nbsp;</p>
<p id="_squeeze-lines">
<code class="title">--squeeze-lines=#</code><br />
Remove superfluous empty lines exceeding the given number.</p>
<div class="code">
<pre>void Foo()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span>
void Foo2()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span>
</pre>
<p class="code">
becomes:</p>
<pre>void Foo()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span>
void Foo2()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span></pre>
</div>
<p>
&nbsp;</p>
<p id="_squeeze-ws">
<code class="title">--squeeze-ws</code><br />
Remove superfluous whitespace</p>
<div class="code">
<pre>void Foo ()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span>
</pre>
<p class="code">
becomes:</p>
<pre>void Foo ()
<span class="brace">{</span>
foo1 = 1;
<span class="brace">}</span></pre>
</div>
<p>
&nbsp;</p>
<p id="_align-pointer">
@@ -2033,7 +2126,7 @@ else
<p>
&nbsp;</p>
<p id="_break-return-type">
<code class="title">--break-return-type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; / -xB</code><br />
<code class="title">--break-return-type &nbsp;&nbsp; / -xB</code><br />
<code class="title">--break-return-type-decl / -xD</code><br />
Break the return type from the function name. The two options are for the function definitions (-xB), and the
function declarations or signatures (-xD). If used with --attach-return-type, the result will be to break the
@@ -2048,7 +2141,7 @@ Foo(bool isFoo);</pre>
<p>
&nbsp;</p>
<p id="_attach-return-type">
<code class="title">--attach-return-type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; / -xf</code><br />
<code class="title">--attach-return-type &nbsp;&nbsp; / -xf</code><br />
<code class="title">--attach-return-type-decl / -xh</code><br />
Attach the return type to the function name. The two options are for the function definitions (-xf), and the
function declarations or signatures (-xh). They are intended to undo the --break-return-type options. If used
@@ -2138,19 +2231,19 @@ Foo(bool isFoo);</pre>
<code class="title">--max-code-length=<span class="option">#</span>&nbsp;&nbsp; / -xC<span class="option">#</span>
<br />
--break-after-logical / -xL</code><br />
The option max&#8209;code&#8209;length will break a line if the code exceeds <span class="option">#</span>
The option max-code-length will break a line if the code exceeds <span class="option">#</span>
characters. The valid values are <strong>50</strong> thru <strong>200</strong>. Lines without logical conditionals
will break on a logical conditional (||, &amp;&amp;, ...), comma, paren, semicolon, or space.</p>
<p>
Some code will not be broken, such as comments, quotes, and arrays. If used with keep&#8209;one&#8209;line&#8209;blocks
or add-one-line-braces the blocks will NOT be broken. If used with keep&#8209;one&#8209;line&#8209;statements
Some code will not be broken, such as comments, quotes, and arrays. If used with keep-one-line-blocks
or add-one-line-braces the blocks will NOT be broken. If used with keep-one-line-statements
the statements will be broken at a semicolon if the line goes over the maximum length. If there is no available
break point within the max code length, the line will be broken at the first available break point after the max
code length.</p>
<p>
By default logical conditionals will be placed first in the new line. The option
<strong>break&#8209;after&#8209;logical</strong> will cause the logical conditionals to be placed last on the
previous line. This option has no effect without max&#8209;code&#8209;length.</p>
<strong>break-after-logical</strong> will cause the logical conditionals to be placed last on the
previous line. This option has no effect without max-code-length.</p>
<div class="code">
<pre>if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3)
bar();</pre>
@@ -2161,7 +2254,7 @@ Foo(bool isFoo);</pre>
|| thisVariable3 == thatVariable3)
bar();</pre>
<p class="code">
becomes (with break&#8209;after&#8209;logical):</p>
becomes (with break-after-logical):</p>
<pre>if (thisVariable1 == thatVariable1 ||
thisVariable2 == thatVariable2 ||
thisVariable3 == thatVariable3)
@@ -2185,18 +2278,18 @@ Foo(bool isFoo);</pre>
<!-- * * * * * * * * * * * * * Objective-C Options * * * * * * * * * * * * * -->
<h3 id="_Objective_C_Options">Objective&#8209;C Options</h3>
<h3 id="_Objective_C_Options">Objective-C Options</h3>
<p>
These options are effective for Objective&#8209;C files only. The standard paren padding options will still apply
These options are effective for Objective-C files only. The standard paren padding options will still apply
to the Objective-C method prefix and return type unless overridden by the following options.</p>
<p>
Because of the longer indents sometimes needed for Objective&#8209;C, the option "max-continuation-indent" may
Because of the longer indents sometimes needed for Objective-C, the option "max-continuation-indent" may
need to be increased. If you are not getting the paren and square bracket alignment you want, try increasing
this value. The option is described in the "Indentation Options" section.</p>
<p id="_pad-method-prefix">
<code class="title">--pad-method-prefix / -xQ</code><br />
Insert space padding <strong>after</strong> the '-' or '+' Objective&#8209;C method prefix. This will add
Insert space padding <strong>after</strong> the '-' or '+' Objective-C method prefix. This will add
exactly one space. Any additional spaces will be deleted.</p>
<div class="code">
<pre>-(void)foo1;
@@ -2210,8 +2303,8 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_unpad-method-prefix">
<code class="title">--unpad-method-prefix / -xR</code><br />
Remove all space padding <strong>after</strong> the &#39;-&#39; or &#39;+&#39; Objective&#8209;C method prefix.&nbsp;
This option will be ignored if used with pad&#8209;method&#8209;prefix. This option takes precedence over the
Remove all space padding <strong>after</strong> the &#39;-&#39; or &#39;+&#39; Objective-C method prefix.&nbsp;
This option will be ignored if used with pad-method-prefix. This option takes precedence over the
pad paren outside option.</p>
<div class="code">
<pre>- (void) foo1;
@@ -2225,7 +2318,7 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_pad-return-type">
<code class="title">--pad-return-type / -xq</code><br />
Insert space padding <strong>after</strong> the Objective&#8209;C return type. This will add exactly one
Insert space padding <strong>after</strong> the Objective-C return type. This will add exactly one
space. Any additional spaces will be deleted. </p>
<div class="code">
<pre>-(void)foo1;
@@ -2239,8 +2332,8 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_unpad-return-type">
<code class="title">--unpad-return-type / -xr</code><br />
Remove all space padding <strong>after</strong> the Objective&#8209;C return type. This option
will be ignored if used with pad&#8209;return&#8209;type. This option takes precedence over the pad paren
Remove all space padding <strong>after</strong> the Objective-C return type. This option
will be ignored if used with pad-return-type. This option takes precedence over the pad paren
outside option. </p>
<div class="code">
<pre>-(void) foo1;
@@ -2254,7 +2347,7 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_pad-param-type">
<code class="title">--pad-param-type / -xS</code><br />
Insert space padding around an Objective&#8209;C parameter type. This will add exactly
Insert space padding around an Objective-C parameter type. This will add exactly
one space. Any additional spaces will be deleted. This has precedence over the pad method colon option and
will always cause space padding after a method colon.</p>
<div class="code">
@@ -2269,7 +2362,7 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_unpad-param-type">
<code class="title">--unpad-param-type / -xs</code><br />
Remove all space padding around an Objective&#8209;C parameter type. This option takes precedence over the
Remove all space padding around an Objective-C parameter type. This option takes precedence over the
pad paren outside option. The pad method colon option has precedence over the <strong>opening</strong> paren.
The closing paren will always be unpadded.</p>
<div class="code">
@@ -2289,7 +2382,7 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_align-method-colon">
<code class="title">--align-method-colon / -xM</code><br />
Align the colons in Objective&#8209;C method declarations
Align the colons in Objective-C method declarations
and method calls. If this option is not declared, method definitions will be indented uniformly, and method calls
will align with the first keyword.</p>
<div class="code">
@@ -2327,11 +2420,11 @@ Foo(bool isFoo);</pre>
&nbsp;</p>
<p id="_pad-method-colon">
<code class="title">--pad-method-colon=none&nbsp;&nbsp; / -xP0<br />
--pad-method-colon=all&nbsp;&nbsp;&nbsp; / -xP1<br />
--pad-method-colon=all / -xP1<br />
--pad-method-colon=after&nbsp; / -xP2<br />
--pad-method-colon=before / -xP3
</code><br />
Add or remove space padding before or after the colons in an Objective&#8209;C method call. These options will
Add or remove space padding before or after the colons in an Objective-C method call. These options will
pad exactly one space. Any additional spaces will be deleted. The space padding after the method colon can be
overridden by pad-param-type.</p>
<div class="code">
@@ -2391,7 +2484,7 @@ Foo(bool isFoo);</pre>
required files.</p>
<p>
Wildcards are NOT allowed. There may be more than one exclude statement. The file path and name may be placed
in double quotes (e.g. &#8209;&#8209;exclude="foo&nbsp;bar.cpp").</p>
in double quotes (e.g. --exclude="foo&nbsp;bar.cpp").</p>
<p id="_ignore-exclude-errors">
<code class="title">--ignore-exclude-errors / -i</code><br />
Allow processing to continue if there are errors in the "exclude=###" options.<br />
@@ -2438,7 +2531,7 @@ Foo(bool isFoo);</pre>
will be ignored.</p>
<p>
&nbsp;</p>
<hr style="margin-left: -0.4in;" />
<hr />
<!-- * * * * * * * * * * * * Command-Line Options * * * * * * * * * * * * -->
@@ -2514,17 +2607,13 @@ Foo(bool isFoo);</pre>
Do not use this with "&gt;" redirection.</p>
<p>
&nbsp;</p>
<hr style="margin-left: -0.4in;" />
<hr />
<p style="margin-left: -0.4in; text-align: center;">
<p >
<a href="http://sourceforge.net/projects/astyle">
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" />
</a></p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
</body>
+11 -2
View File
@@ -58,6 +58,9 @@
<p class="contents1">
<a class="contents" href="#_Compiler_Options">Compiler Options</a></p>
<p class="contents2">
<a class="contents" href="#_PIP">Python PIP</a></p>
<h3 id="_Artistic_Style_Versions">Artistic Style Versions</h3>
<p>
@@ -585,8 +588,14 @@ mingw32-make</pre>
option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed and exceptions are
NOT used. Use whole program optimization if your compiler supports it. There may be other options you can use
depending on the compiler. </p>
<p>
&nbsp;</p>
<h3 id="_PIP">Python PIP</h3>
<p>
There are two projects which enable astyle installation using PIP: <a href="https://github.com/Freed-Wu/astyle-wheel/">astyle-wheel</a> and <a href="https://github.com/igrr/astyle_py">astyle_py (using WASM)</a>.<br>
These are useful to be included in git pre-commit hooks.
</p>
<p style="margin-left: -0.4in; text-align: center;">
<a href="http://sourceforge.net/projects/astyle">
+8 -1
View File
@@ -14,7 +14,14 @@
<h1>Artistic Style News</h1>
<h3>Artistic Style 3.3 (ongoing)</h3>
<h3>Artistic Style 3.4 (ongoing)</h3>
<p>
A new option &quot;--indent-lambda&quot; was added to apply the lambda recognition only if applicable.
Currently complex lambda functions are not intended properly.
</p>
<h3>Artistic Style 3.3</h3>
<p>
The source code has been refactored to no longer use the std namespace globally.
+11
View File
@@ -14,6 +14,17 @@
<h1>Artistic Style Release Notes</h1>
<h3>Artistic Style 3.4 (June 2023)</h3>
<ul>
<li>fixed formatting of CS interpolation literals (https://gitlab.com/saalen/astyle/-/issues/8).</li>
<li>fixed false lambda recognition (https://gitlab.com/saalen/astyle/-/issues/11)</li>
<li>fixed indentation of member declarations (https://gitlab.com/saalen/astyle/-/issues/10)</li>
<li>fixed indentation of struct assignments (https://gitlab.com/saalen/astyle/-/issues/12)</li>
<li>added new option "--indent-lambda" to to enable new lambda recognition (https://gitlab.com/saalen/astyle/-/issues/7)</li>
<li>added link to astyle Python distribution projects (https://gitlab.com/saalen/astyle/-/issues/6)</li>
</ul>
<h3>Artistic Style 3.3 (May 2023)</h3>
<ul>
+2 -2
View File
@@ -16,8 +16,8 @@
body { background-color: white; margin: 5em 15em 5em 2em; font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; }
h1 { color: mediumblue; text-align: center; font-style: italic; margin-top: 3em; }
h2 { color: mediumblue; text-align: center; font-size: larger; margin-top: 2em; }
h1 { color: mediumblue; font-style: italic; margin-top: 3em; }
h2 { color: mediumblue; font-size: larger; margin-top: 2em; }
h3 { color: mediumblue; margin-top: 2em; }
h4 { color: mediumblue; margin-top: 2em; }
h5 { text-transform: uppercase }
+5 -1
View File
@@ -4,7 +4,7 @@ _astyle() {
args=("${COMP_WORDS[@]}")
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--style --indent --attach-namespaces --attach-classes --attach-inlines --attach-extern-c --attach-closing-while --indent-classes --indent-modifiers --indent-switches --indent-cases --indent-namespaces --indent-after-parens --indent-continuation --indent-labels --indent-preproc-block --indent-preproc-cond --indent-preproc-define --indent-col1-comments --min-conditional-indent --max-continuation-indent --break-blocks --pad-oper --pad-comma --pad-paren --pad-paren-out --pad-first-paren-out --pad-paren-in --pad-header --unpad-paren --delete-empty-lines --fill-empty-lines --align-pointer --align-reference --break-closing-braces --break-elseifs --break-one-line-headers --add-braces --add-one-line-braces --remove-braces --break-return-type --attach-return-type-decl --keep-one-line-blocks --keep-one-line-statements --convert-tabs --close-templates --remove-comment-prefix --max-code-length --break-after-logical mode --pad-method-prefix --unpad-method-prefix --pad-return-type --unpad-return-type --pad-param-type --unpad-param-type --align-method-colon --pad-method-colon --suffix --recursive --dry-run --exclude --ignore-exclude-errors --ignore-exclude-errors-x --errors-to-stdout --preserve-date --verbose --formatted --quiet --lineend --options --project --ascii --version --help --html --stdin --stdout"
opts="--style --indent --attach-namespaces --attach-classes --attach-inlines --attach-extern-c --attach-closing-while --indent-classes --indent-modifiers --indent-switches --indent-cases --indent-namespaces --indent-after-parens --indent-continuation --indent-labels --indent-preproc-block --indent-preproc-cond --indent-preproc-define --indent-col1-comments --min-conditional-indent --max-continuation-indent --break-blocks --pad-oper --pad-comma --pad-paren --pad-paren-out --pad-first-paren-out --pad-paren-in --pad-header --unpad-paren --pad-brackets --unpad-brackets --delete-empty-lines --fill-empty-lines --align-pointer --align-reference --break-closing-braces --break-elseifs --break-one-line-headers --add-braces --add-one-line-braces --remove-braces --break-return-type --attach-return-type-decl --keep-one-line-blocks --keep-one-line-statements --convert-tabs --close-templates --remove-comment-prefix --max-code-length --break-after-logical mode --pad-method-prefix --unpad-method-prefix --pad-return-type --unpad-return-type --pad-param-type --unpad-param-type --align-method-colon --pad-method-colon --suffix --recursive --dry-run --exclude --ignore-exclude-errors --ignore-exclude-errors-x --errors-to-stdout --preserve-date --verbose --formatted --quiet --lineend --options --project --ascii --version --help --html --stdin --stdout --squeeze-lines --squeeze-ws"
case "$prev" in
--style)
@@ -79,6 +79,10 @@ _astyle() {
COMPREPLY=($(compgen -f -- "$cur"))
return 0
;;
--squeeze-lines)
COMPREPLY=($(compgen -f -- "$cur"))
return 0
;;
esac
if [[ "$cur" = -* ]]; then
+4
View File
@@ -29,6 +29,8 @@ complete -c astyle -l pad-first-paren-out -d 'Insert space padding around first
complete -c astyle -l pad-paren-in -d 'Insert space padding around parenthesis on the inside only'
complete -c astyle -l pad-header -d 'Insert space padding after paren headers (e.g'
complete -c astyle -l unpad-paren -d 'Remove unnecessary space padding around parenthesis'
complete -c astyle -l pad-brackets -d 'Insert space padding around square brackets on both the outside and the inside (experimental)'
complete -c astyle -l unpad-brackets -d 'Remove unnecessary space padding around square brackets (experimental)'
complete -c astyle -l delete-empty-lines -d 'Delete empty lines within a function or method'
complete -c astyle -l fill-empty-lines -d 'Fill empty lines with the white space of their previous lines'
complete -c astyle -l align-pointer -xa 'type middle name' -d 'Attach a pointer or reference operator (*, &, or ^) to either the operator type (left), middle, or operator name (right)'
@@ -77,3 +79,5 @@ complete -c astyle -l help -d 'Print help message'
complete -c astyle -l html -d 'Open the HTML help file astyle.html in the default browser'
complete -c astyle -l stdin -r -d 'Use the file path as input to single file formatting'
complete -c astyle -l stdout -r -d 'Use the file path as output from single file formatting'
complete -c astyle -l squeeze-lines -r -d 'Remove superfluous empty lines exceeding the given number'
complete -c astyle -l squeeze-ws -d 'Remove superfluous whitespace'
+4
View File
@@ -32,6 +32,8 @@ _astyle() {
"--pad-paren-in[Insert space padding around parenthesis on the inside only]"
"--pad-header[Insert space padding after paren headers (e.g]"
"--unpad-paren[Remove unnecessary space padding around parenthesis]"
"--pad-brackets[Insert space padding around square brackets on both the outside and the inside (experimental)]"
"--unpad-brackets[Remove unnecessary space padding around square brackets (experimental)]"
"--delete-empty-lines[Delete empty lines within a function or method]"
"--fill-empty-lines[Fill empty lines with the white space of their previous lines]"
"--align-pointer[Attach a pointer or reference operator (*, &, or ^) to either the operator type (left), middle, or operator name (right)]: :(type middle name)"
@@ -80,6 +82,8 @@ _astyle() {
"--html[Open the HTML help file astyle.html in the default browser]"
"--stdin[Use the file path as input to single file formatting]: :_files"
"--stdout[Use the file path as output from single file formatting]: :_files"
"--squeeze-lines[Remove superfluous empty lines exceeding the given number]: :_files"
"--squeeze-ws[Remove superfluous whitespace]"
)
_arguments -s -S \
$options \
+3
View File
@@ -268,6 +268,9 @@ parser:option "--squeeze-lines"
parser:flag "--squeeze-ws"
:description "Remove superfluous whitespace"
parser:flag "--indent-lambda"
:description "Indent C++ lambda functions (experimental, broken for complex fct bodies)"
local p = argparse "gen-completions"
p:argument "shell"
:choices {"bash", "zsh", "fish"}
+32 -5
View File
@@ -60,6 +60,7 @@ ASBeautifier::ASBeautifier()
setSwitchIndent(false);
setCaseIndent(false);
setSqueezeWhitespace(false);
setLambdaIndentation(false);
setBlockIndent(false);
setBraceIndent(false);
setBraceIndentVtk(false);
@@ -207,6 +208,7 @@ ASBeautifier::ASBeautifier(const ASBeautifier& other) : ASBase(other)
switchIndent = other.switchIndent;
caseIndent = other.caseIndent;
squeezeWhitespace = other.squeezeWhitespace;
attemptLambdaIndentation = other.attemptLambdaIndentation;
namespaceIndent = other.namespaceIndent;
braceIndent = other.braceIndent;
braceIndentVtk = other.braceIndentVtk;
@@ -1120,6 +1122,18 @@ void ASBeautifier::setSqueezeWhitespace(bool state)
squeezeWhitespace = state;
}
/**
* set the state of the lambda indentation option. If true,
* the parser tries to recognize lambda code. Indentation
* is bad if the lambda code is more complex (if/switch etc)
*
* @param state state of option.
*/
void ASBeautifier::setLambdaIndentation(bool state)
{
attemptLambdaIndentation = state;
}
/**
* get the file type.
*/
@@ -2846,7 +2860,8 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
{
headerStack->pop_back();
isInClassHeader = false;
if ( !findKeyword(line, i, AS_STRUCT) ) // if not on this line #526
if (line.find("struct ", 0) > i) // if not on this line #526, GH #12
indentCount -= classInitializerIndents;
if (indentCount < 0)
indentCount = 0;
@@ -2870,8 +2885,13 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
}
// #121
if (!isLegalNameChar(prevNonSpaceCh) && prevNonSpaceCh != ']' && prevNonSpaceCh != ')' && line.find(AS_AUTO, 0 ) == std::string::npos) {
lambdaIndicator = true;
if (attemptLambdaIndentation // GH #7
&& !isLegalNameChar(prevNonSpaceCh)
&& prevNonSpaceCh != ']'
&& prevNonSpaceCh != ')'
&& prevNonSpaceCh != '*' // GH #11
&& line.find(AS_AUTO, 0 ) == std::string::npos) {
lambdaIndicator = true;
}
}
@@ -2945,7 +2965,7 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
|| isSharpDelegate
|| isInExternC
|| isInAsmBlock
|| getNextWord(line, i) == AS_NEW
//|| getNextWord(line, i) == AS_NEW // #487
|| (isInDefine
&& (prevNonSpaceCh == '('
|| isLegalNameChar(prevNonSpaceCh))));
@@ -3265,6 +3285,12 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
if (isObjCStyle() && findKeyword(line, i, AS_NS_HANDLER))
foundPreCommandMacro = true;
//https://sourceforge.net/p/astyle/bugs/353/
// new is ending the line?
if (isJavaStyle() && findKeyword(line, i, AS_NEW) && line.length()-3 == i) {
headerStack->emplace_back(&AS_FIXED); // needs to be something which will not match - need to define a token which will never match
}
//https://sourceforge.net/p/astyle/bugs/550/
//enum can be function return value
if (parenDepth == 0 && findKeyword(line, i, AS_ENUM) && line.find_first_of(AS_OPEN_PAREN, i) == std::string::npos)
@@ -3808,7 +3834,8 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
&& prevNonSpaceCh != ']' // an array
&& statementEndsWithComma(line, i))
{
if (!haveAssignmentThisLine) // only one assignment indent per line
// only one assignment indent per line + GH #10
if (!haveAssignmentThisLine && line.find(AS_SCOPE_RESOLUTION) == std::string::npos)
{
// register indent at previous word
haveAssignmentThisLine = true;
+1 -1
View File
@@ -6254,7 +6254,7 @@ void ASFormatter::formatQuoteBody()
checkInterpolation = false;
}
}
else if (isSharpStyle())
else if (isSharpStyle() && !checkInterpolation )
{
if ((int) currentLine.length() > charNum + 1
&& currentLine[charNum + 1] == '"') // check consecutive quotes
+2
View File
@@ -371,6 +371,7 @@ public:
void setPreprocDefineIndent(bool state);
void setPreprocConditionalIndent(bool state);
void setSqueezeWhitespace(bool state);
void setLambdaIndentation(bool state);
int getBeautifierFileType() const;
int getFileType() const;
int getIndentLength() const;
@@ -556,6 +557,7 @@ private: // variables
bool shouldIndentPreprocConditional;
bool lambdaIndicator;
bool squeezeWhitespace;
bool attemptLambdaIndentation;
int indentCount;
int spaceIndentCount;
int spaceIndentObjCMethodAlignment;
+9 -65
View File
@@ -94,7 +94,7 @@ namespace astyle {
jmethodID g_mid;
#endif
const char* g_version = "3.3 beta";
const char* g_version = "3.4";
//-----------------------------------------------------------------------------
// ASStreamIterator class
@@ -431,69 +431,6 @@ void ASConsole::convertLineEnds(std::ostringstream& out, int lineEnd)
out.str(outStr);
}
/*
void ASConsole::convertLineEnds(std::ostringstream& out, int lineEnd) {
assert(lineEnd == LINEEND_WINDOWS || lineEnd == LINEEND_LINUX || lineEnd == LINEEND_MACOLD);
const std::string inStr = out.str();
std::ostringstream outStream;
for (std::string::size_type i = 0; i < inStr.length(); ++i) {
const char currChar = inStr[i];
const char nextChar = i < inStr.length() - 1 ? inStr[i + 1] : 0;
if (currChar == '\r') {
if (nextChar == '\n') {
// CRLF
if (lineEnd == LINEEND_CR) {
outStream << currChar; // Delete the LF
++i;
}
else if (lineEnd == LINEEND_LF) {
outStream << nextChar; // Delete the CR
++i;
}
else {
outStream << currChar << nextChar; // Do not change
++i;
}
}
else {
// CR
if (lineEnd == LINEEND_CRLF) {
outStream << currChar << '\n'; // Insert the LF
}
else if (lineEnd == LINEEND_LF) {
outStream << '\n'; // Insert the LF
}
else {
outStream << currChar; // Do not change
}
}
}
else if (currChar == '\n') {
// LF
if (lineEnd == LINEEND_CRLF) {
outStream << '\r' << currChar; // Insert the CR and LF
}
else if (lineEnd == LINEEND_CR) {
outStream << '\r'; // Insert the CR
}
else {
outStream << currChar; // Do not change
}
}
else {
outStream << currChar; // Write the current character
}
}
out.str(outStream.str()); // Replace the stream
}
*/
void ASConsole::correctMixedLineEnds(std::ostringstream& out)
{
LineEndFormat lineEndFormat = LINEEND_DEFAULT;
@@ -1504,7 +1441,7 @@ std::string ASConsole::getNumberFormat(int num, size_t /*lcid*/) const
// The C locale should be set but not the C++.
// This function is not necessary if the C++ locale is set.
// The locale().name() return value is not portable to all compilers.
assert(locale().name() == "C");
assert(std::locale().name() == "C");
#endif
// get the locale info
@@ -2114,6 +2051,9 @@ void ASConsole::printHelp() const
std::cout << " --indent-col1-comments OR -Y\n";
std::cout << " Indent line comments that start in column one.\n";
std::cout << std::endl;
std::cout << " --indent-lambda\n";
std::cout << " Indent C++ lambda functions (experimental, broken for complex fct bodies)\n";
std::cout << std::endl;
std::cout << " --min-conditional-indent=# OR -m#\n";
std::cout << " Indent a minimal # spaces in a continuous conditional\n";
std::cout << " belonging to a conditional header.\n";
@@ -3820,6 +3760,10 @@ bool ASOptions::parseOptionContinued(const std::string& arg, const std::string&
{
formatter.setBracketsUnPaddingMode(true);
}
else if (isOption(arg, "indent-lambda"))
{
formatter.setLambdaIndentation(true);
}
else
{
return false;