Compare commits

...
103 Commits
Author SHA1 Message Date
saalen 3524d66639 #42 fix recognition of Java/C# multi line strings 2024-06-05 14:42:43 +02:00
saalen 3f3f90b577 updated version number 2024-06-04 16:27:41 +02:00
saalen af17f3b833 https://sourceforge.net/p/astyle/bugs/571 add option --pad-negation=before 2024-06-04 16:16:23 +02:00
saalen 88a2903caf https://sourceforge.net/p/astyle/bugs/571 add option --pad-negation in bash completion 2024-06-03 16:22:35 +02:00
saalen 4154588caf https://sourceforge.net/p/astyle/bugs/571 add option --pad-negation in help messages 2024-06-03 16:18:34 +02:00
saalen 9369c8455f https://sourceforge.net/p/astyle/bugs/571 add option --pad-negation 2024-06-03 15:27:10 +02:00
saalen aa7e2febec https://sourceforge.net/p/astyle/bugs/573/ apply align-pointer=type only if type is present 2024-06-03 14:51:15 +02:00
saalen 4e72cf7e15 updated docs 2024-06-03 14:51:15 +02:00
saalen 683a618343 https://sourceforge.net/p/astyle/bugs/574/ avoid deletion of empty lines after continuation 2024-06-03 14:51:01 +02:00
saalen 422985f01b https://sourceforge.net/p/astyle/bugs/572/ fix alignment of logical and operators 2024-06-03 12:52:57 +02:00
saalen 9fd80e1abe updated docs and version 2024-05-16 11:15:42 +02:00
saalen 485382e2aa https://gitlab.com/saalen/astyle/-/issues/35 fix of reference args alignment 2024-05-16 11:13:13 +02:00
saalen b27cccdb9d https://sourceforge.net/p/astyle/bugs/570/ fix padding of scientific notation literals 2024-05-14 23:09:36 +02:00
saalen 8c69e067ec fix padding of lambda capture with align-pointer option 2024-05-07 13:04:16 +02:00
saalen b09b2355e0 https://sourceforge.net/p/astyle/bugs/560/ exclude files ending with backup suffix from input file names list 2024-05-03 15:59:06 +02:00
saalen 86532b948f https://gitlab.com/saalen/astyle/-/issues/35 fix of --align-pointer=type option for all types in lambda parameter lists 2024-05-03 13:14:17 +02:00
saalen 3623229876 https://sourceforge.net/p/astyle/bugs/569/ fix --break-block handling of class and function blocks 2024-05-03 09:37:56 +02:00
saalen bac6279b26 https://sourceforge.net/p/astyle/bugs/566/ fix parsing of floating point literals 2024-05-02 17:09:29 +02:00
Andre Simon 050c108c28 updated astyle readme 2024-04-28 18:01:57 +02:00
saalen bcf5bb4a5e removed getIndentedLineReturn method 2024-04-17 17:16:27 +02:00
saalen 9a77b83a8b enabled C++17 compiler switch 2024-04-09 17:38:46 +02:00
saalen fd449b0e5e replaced const string refs by string_view parameters 2024-04-09 17:27:18 +02:00
saalen 803ba0955a https://gitlab.com/saalen/astyle/-/issues/24 add cmake option to disable documentation installation 2024-04-05 16:05:06 +02:00
saalen 086ed3a3d3 https://gitlab.com/saalen/astyle/-/issues/29 fix of --indent-after-parens indent count 2024-04-04 17:00:44 +02:00
saalen 9af46ccc6c https://gitlab.com/saalen/astyle/-/issues/35 fix of --align-pointer=type option for fundamental types in lambda parameter lists 2024-04-04 16:21:55 +02:00
saalen 04aabdd005 https://sourceforge.net/p/astyle/bugs/565/ fixed split references with -k1 option 2024-03-28 13:27:32 +01:00
saalen 15cf1e018b Merge branch 'master' of gitlab.com:saalen/astyle 2024-03-06 13:01:51 +01:00
saalen f32c555bc1 https://sourceforge.net/p/astyle/bugs/564/ fixed documentation 2024-03-06 12:16:10 +01:00
saalen 7e97becbcf update documentation and notes 2024-03-06 12:07:16 +01:00
saalen 21b58e214e #39 fix comment indent after string macro with R suffix 2024-03-06 12:00:40 +01:00
saalen 16c4a56aa4 #38 do not break single line block after enum in mozilla mode 2024-03-06 10:52:33 +01:00
saalen aa58fe1aa4 #40 adjust cmake policy for new versions only 2024-03-05 15:59:52 +01:00
André Simon 87e0136e5f Merge branch 'master' into 'master'
News page: Fix typo, add last release dates

See merge request saalen/astyle!9
2024-02-24 06:39:44 +00:00
Peu 3bdf5fb041 News page: Fix typo, add last release dates 2024-02-24 06:39:43 +00:00
André Simon b66f3cb173 Merge branch 'master' into 'master'
support scikit-build-core

See merge request saalen/astyle!8
2024-02-12 15:21:55 +00:00
Wu Zhenyu 055c06d4c5 support scikit-build-core
refer https://github.com/scikit-build/scikit-build-core/issues/632#issuecomment-1936946228
we must patch code to avoid more issues down the line
2024-02-10 17:12:38 +08:00
Wu Zhenyu 93605a0147 change /usr/man to /usr/share/man to respect standard 2024-02-10 17:12:12 +08:00
saalen 1c27f34918 https://gitlab.com/saalen/astyle/-/issues/36 fixed addition of closing brace within statement blocks 2024-02-02 17:19:14 +01:00
saalen 96bd14dee1 https://gitlab.com/saalen/astyle/-/issues/36 fixed addition of closing brace after multi line statements 2024-02-01 16:49:20 +01:00
saalen 90499c92cf https://gitlab.com/saalen/astyle/-/issues/36 fixed crash with opening block in next line 2024-01-30 21:21:51 +01:00
saalen cf95606462 updated docs 2024-01-30 16:32:30 +01:00
saalen 05502078e1 https://gitlab.com/saalen/astyle/-/issues/36 fixed crash with --add-braces=nested applied to if-else blocks 2024-01-26 16:22:59 +01:00
saalen 95c9e4f6db https://gitlab.com/saalen/astyle/-/issues/33 added --pad-brackets-in and --pad-brackets-out options 2024-01-19 16:40:02 +01:00
saalen 619081a737 https://gitlab.com/saalen/astyle/-/issues/28 fixed indentation of initializer lists 2024-01-16 10:37:57 +01:00
saalen 3f2b5c92a0 https://gitlab.com/saalen/astyle/-/issues/27 updated notes.html 2024-01-05 17:28:54 +01:00
saalen 99ceeb79b4 https://gitlab.com/saalen/astyle/-/issues/27 avoid assertion error if brace already exists 2024-01-05 17:26:21 +01:00
saalen bbf726c605 https://gitlab.com/saalen/astyle/-/issues/27 add new option --add-braces=nested to add braces around nested one line stmts 2024-01-05 16:59:46 +01:00
saalen 2987c9b361 https://gitlab.com/saalen/astyle/-/issues/28 fix indent of struct members with dot prefix 2024-01-03 16:19:54 +01:00
saalen 48b574fccf updated notes.html 2024-01-02 17:27:41 +01:00
saalen 15ae8d6bdb https://gitlab.com/saalen/astyle/-/issues/28 fix indent after double template brackets 2024-01-02 17:18:19 +01:00
saalen 58710b4b86 https://gitlab.com/saalen/astyle/-/issues/28 fix indent after dot 2024-01-02 15:10:36 +01:00
Andre Simon d31b289c0d https://sourceforge.net/p/astyle/bugs/559/ fix CI pipeline 2024-01-01 21:35:36 +01:00
Andre Simon 9c6e9f942a https://sourceforge.net/p/astyle/bugs/559/ change squeeze line counter int type 2024-01-01 21:24:26 +01:00
André Simon 8218a855f7 https://sourceforge.net/p/astyle/bugs/559/ initialize squeeze line counter 2024-01-01 20:58:57 +01:00
saalen 9a26f1e6d4 https://gitlab.com/saalen/astyle/-/issues/31 add experimental GHC mode 2023-12-29 16:53:22 +01:00
saalen 6f8e619193 https://gitlab.com/saalen/astyle/-/issues/32 fix indent after raw string 2023-12-29 16:01:41 +01:00
saalen a2056ddf70 https://gitlab.com/saalen/astyle/-/issues/26 disable for another approach 2023-11-30 16:52:39 +01:00
saalen c988613837 https://gitlab.com/saalen/astyle/-/issues/26 apply only to C syntax 2023-11-28 15:33:59 +01:00
saalen cea7932ed4 https://gitlab.com/saalen/astyle/-/issues/26 fix indent of switch blocks 2023-11-27 16:38:56 +01:00
saalen 05a5acaf64 https://gitlab.com/saalen/astyle/-/issues/26 fix indent of labels within functions returning a struct 2023-11-27 14:25:06 +01:00
saalen 774bf30237 https://sourceforge.net/p/astyle/bugs/558/ fixed some typos 2023-11-10 16:28:09 +01:00
saalen 824d4b7991 https://gitlab.com/saalen/astyle/-/issues/16 fixed missing indent in function parameter list 2023-10-19 18:17:11 +02:00
saalen 3818cc1def fixed CI script 2023-10-16 17:20:16 +02:00
saalen 3905a70a59 updated astyle paths in CI test scripts 2023-10-16 17:17:23 +02:00
saalen e2870b5171 https://sourceforge.net/p/astyle/bugs/557 fixed inserting space with combined --pad-oper and --align-pointer=type option 2023-10-16 13:27:30 +02:00
saalen 859f868f26 https://sourceforge.net/p/astyle/bugs/557 fixed inserting space with combined --pad-oper and --align-pointer options 2023-10-16 13:20:24 +02:00
André Simon 5b302bf3fa Merge branch 'master' into 'master'
Master

See merge request saalen/astyle!7
2023-10-13 14:37:25 +00:00
CW Holeman II 86f28be2b8 Merge branch astyle:master into master 2023-10-12 17:57:44 +00:00
cwhii 2eb37a49f6 #21 backed out style as not for HTML comments. 2023-10-12 10:56:11 -07:00
André Simon 797da683e5 Merge branch 'master' into 'master'
Master

See merge request saalen/astyle!6
2023-10-10 13:49:03 +00:00
CW Holeman II da93cd3051 Merge branch astyle:master into master 2023-10-09 14:29:45 +00:00
cwhii b0c8794ad0 #21 Use CSS white-space/nowrap rather than special dash charcter in HTML files. 2023-10-09 07:25:28 -07:00
André Simon 025ad91b75 Merge branch 'master' into 'master'
Master

See merge request saalen/astyle!5
2023-10-05 16:10:22 +00:00
saalen 45833e5e1b https://sourceforge.net/p/astyle/bugs/97/ fixed multi line assignment indentation 2023-10-04 16:30:01 +02:00
saalen 51bb19097d simplified code 2023-10-04 16:29:15 +02:00
cwhii 2cee63dd71 #21 Spell Objective-C consistently. 2023-10-03 14:54:05 -07:00
cwhii c00b836e3c Spell Objective-C consistently. 2023-10-03 14:42:43 -07:00
CW Holeman II d83f96a5b4 Merge branch astyle:master into master 2023-10-02 17:58:31 +00:00
cwhii 9db81c02ce Typo. 2023-10-02 10:15:44 -07:00
saalen 1084cdaf92 updated version 2023-09-29 16:13:29 +02:00
saalen ae991ee51c https://gitlab.com/saalen/astyle/-/issues/16 fix line break with several array initializers in a single line block 2023-09-29 16:09:55 +02:00
saalen 1e727f453d Merge branch 'master' of gitlab.com:saalen/astyle 2023-09-28 16:52:35 +02:00
saalen 77ff0d844f https://gitlab.com/saalen/astyle/-/issues/16 fix line break after casting within an if block 2023-09-28 16:52:21 +02:00
André Simon 1b2631e578 Merge branch 'master' into 'master'
Force ASCIIdoc to passthru C++ w/o formatting.

See merge request saalen/astyle!4
2023-09-27 21:04:51 +00:00
cwhii 2f60ecae3b Forse ASCIIdoc to passthru C++ w/o formatting. 2023-09-27 13:59:26 -07:00
saalen 44da67c6fb https://gitlab.com/saalen/astyle/-/issues/19 improved expressions in docs 2023-09-22 09:34:37 +02:00
saalen 7cf2c8e678 updated version 2023-09-21 17:13:07 +02:00
saalen 9ab14f1f50 https://gitlab.com/saalen/astyle/-/issues/19 added new option --pad-empty-paren 2023-09-21 17:11:37 +02:00
saalen 3368b0bc16 updated version and notes 2023-09-21 16:39:38 +02:00
saalen 80070921d5 https://gitlab.com/saalen/astyle/-/issues/16 fix line break after set variable name 2023-09-21 16:25:53 +02:00
saalen 223a8a765c https://gitlab.com/saalen/astyle/-/issues/16 adjusted indent count 2023-09-18 22:30:39 +02:00
saalen 3ed3247931 https://gitlab.com/saalen/astyle/-/issues/18 fixed empty line after switch block 2023-09-15 14:18:32 +02:00
saalen 537c3d10d3 https://gitlab.com/saalen/astyle/-/issues/19 added outer padding for emtpy parens pairs 2023-09-14 20:33:04 +02:00
saalen 55ff6e9425 https://sourceforge.net/p/astyle/bugs/556 fixed astyle docs 2023-09-13 16:10:54 +02:00
saalen 52f0e25f7f https://gitlab.com/saalen/astyle/-/issues/18 fixed empty line after closing while block - new approach 2023-09-13 16:09:02 +02:00
saalen 061c17f5e8 updated version and notes 2023-09-08 16:38:36 +02:00
saalen e1fc3515a5 https://sourceforge.net/p/astyle/bugs/434/ fixed indentation of method calls - avoid more regressions 2023-09-08 14:25:44 +02:00
saalen 664168e298 https://sourceforge.net/p/astyle/bugs/434/ fixed indentation of method calls - avoid regression 2023-09-08 13:41:19 +02:00
saalen 2d1a88565e https://sourceforge.net/p/astyle/bugs/434/ fixed indentation of method calls 2023-09-07 16:48:07 +02:00
saalen c8a2db74c9 https://gitlab.com/saalen/astyle/-/issues/18 fixed empty line after closing while block 2023-09-04 16:34:25 +02:00
saalen c7b4dbcea1 https://sourceforge.net/p/astyle/bugs/554 fixed lambda broken brace after auto keyword 2023-09-01 16:04:28 +02:00
saalen ca002bd04d https://sourceforge.net/p/astyle/bugs/226 fixed line break after comment in asm block 2023-09-01 15:18:58 +02:00
saalen 5e6a58a962 https://sourceforge.net/p/astyle/bugs/126 fixed padding of multiply operator 2023-08-31 16:14:02 +02:00
49 changed files with 6655 additions and 1065 deletions
+17
View File
@@ -0,0 +1,17 @@
# Specify the docker image to use (only used if using docker runners)
# See: http://doc.gitlab.com/ee/ci/docker/using_docker_images.html
image: debian:stable-slim
# Define commands that run before each job's script
before_script:
- apt-get update
- apt-get install -y make gcc g++ cmake
compile:
script:
- cd AStyle/
- mkdir build_local && cd build_local
- cmake .. && make
- cd ../../AStyleTest/regression-sh/
# Verify that our compiled app works properly with a custom "test" script
- bash ./run_tests.sh
+5 -1
View File
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.8)
cmake_policy(SET CMP0112 OLD)
if(CMAKE_VERSION VERSION_GREATER "3.19.0")
cmake_policy(SET CMP0112 OLD)
endif()
project(astyle CXX)
include( build/cmake/Options.cmake REQUIRED )
+1 -1
View File
@@ -3,7 +3,7 @@ Instructions for using Artistic Style are included in the *doc* directory.
The file **install.html** contains instructions for compiling and
installing Artistic Style.
The file **astyle.html**' contains information on using Artistic Style.
The file **astyle.html** contains information on using Artistic Style.
The files **news.html** and **notes.html** contain information on changes
made to the various releases.
+3 -3
View File
@@ -1,8 +1,8 @@
# Set default compile options for supported compilers
if(APPLE)
target_compile_options( astyle PRIVATE -W -Wall -fno-rtti -fno-exceptions -std=c++11 -stdlib=libc++)
target_compile_options( astyle PRIVATE -W -Wall -fno-rtti -fno-exceptions -std=c++17 -stdlib=libc++)
elseif(NOT WIN32) # Linux
target_compile_options(astyle PRIVATE -Wall -Wextra -fno-rtti -fno-exceptions -std=c++11)
target_compile_options(astyle PRIVATE -Wall -Wextra -fno-rtti -fno-exceptions -std=c++17)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "gnu")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (NOT (GCC_VERSION VERSION_GREATER 4.6 OR GCC_VERSION VERSION_EQUAL 4.6))
@@ -13,7 +13,7 @@ elseif(NOT WIN32) # Linux
target_compile_options(astyle PRIVATE -wd11074,11076)
endif()
elseif(MINGW)
target_compile_options(astyle PRIVATE -Wall -Wextra -fno-rtti -fno-exceptions -std=c++11)
target_compile_options(astyle PRIVATE -Wall -Wextra -fno-rtti -fno-exceptions -std=c++17)
elseif(BORLAND) # Release must be explicitly requested for Borland
target_compile_options(astyle PRIVATE -q -w -x-) # Cannot use no-rtti (-RT-)
endif()
+17 -4
View File
@@ -3,12 +3,21 @@
# Default linux install prefix is /usr/local"
# This may be modified by -DCMAKE_INSTALL_PREFIX=
# Default Win32 install prefix is not used (C:/Program Files (x86))
option(INSTALL_DOC ON)
if(BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS)
if(NOT WIN32)
install(TARGETS astyle DESTINATION lib)
endif()
else()
if(WIN32)
if(SKBUILD)
install(TARGETS astyle DESTINATION "${SKBUILD_SCRIPTS_DIR}")
if(INSTALL_DOC)
install(FILES ${DOCS} DESTINATION "${SKBUILD_DATA_DIR}/share/doc/astyle/html")
install(FILES ${MAN} DESTINATION "${SKBUILD_DATA_DIR}/share/man/man1")
endif()
elseif(WIN32)
set(pf86 "PROGRAMFILES(x86)")
set(prog_files $ENV{${pf86}})
if(NOT ${prog_files})
@@ -19,14 +28,18 @@ else()
elseif(APPLE)
# install to the default /usr/local/bin because of SIP restrictions
install(TARGETS astyle DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
if(INSTALL_DOC)
install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
endif()
else()
# change default to /usr/bin, the same as package installs
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
install(TARGETS astyle DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
INSTALL(FILES ${MAN} DESTINATION "${CMAKE_INSTALL_PREFIX}/man/man1")
if(INSTALL_DOC)
install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
install(FILES ${MAN} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
endif()
endif()
endif()
+1 -1
View File
@@ -10,7 +10,7 @@ endif()
# Linux Soname Version
set(MAJORVER 3)
set(MINORVER 4)
set(MINORVER 5)
set(PATCHVER 0)
set(SOLIBVER ${MAJORVER}.${MINORVER}.${PATCHVER})
+125 -37
View File
@@ -60,11 +60,11 @@
<button onclick="topFunction()" id="topBtn" title="Go to Contents"><b>Top</b></button>
<h1>Artistic Style 3.4.6</h1>
<h1>Artistic Style</h1>
<h2>
A Free, Fast, and Small Automatic Formatter<br />
for C, C++, C++/CLI, Objective-C, C#, and Java Source Code
for C, C++, C++/CLI, <span style="white-space: nowrap;">Objective-C</span>, C#, and Java Source Code
</h2>
<h3 id="Contents">Contents</h3>
@@ -111,7 +111,7 @@
<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>
<a class="contents" href="#_indent=force-tab-x">indent=force-tab-x</a>
</p>
<p class="contents1">
<a href="#_Brace_Modify_Options">Brace&nbsp;Modify&nbsp;Options</a></p>
@@ -139,7 +139,7 @@
<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>
<a class="contents" href="#_indent_lambda">indent-lambda</a>
</p>
<p class="contents1">
@@ -149,13 +149,17 @@
<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-negation">pad-negation</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-empty-paren">pad-empty-paren</a>
<a class="contents" href="#_pad-brackets">pad-brackets</a>
<a class="contents" href="#_pad-brackets-in">pad-brackets-in</a>
<a class="contents" href="#_pad-brackets-out">pad-brackets-out</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>
@@ -185,7 +189,7 @@
<a class="contents" href="#_mode">mode</a>
</p>
<p class="contents1">
<a href="#_Objective_C_Options">Objective-C&nbsp;Options</a></p>
<a href="#_Objective_C_Options"><span style="white-space: nowrap;">Objective-C</span>&nbsp;Options</a></p>
<p class="contents2">
<a class="contents" href="#_pad-method-prefix">pad-method-prefix</a>
<a class="contents" href="#_unpad-method-prefix">unpad-method-prefix</a>
@@ -243,7 +247,7 @@
<p>
Artistic Style will determine the file type from the file extension. The extension ".java" indicates a Java file,
and ".cs" indicates a C# file. Everything else is a C type file (C, C++, C++/CLI, or Objective-C). If you are
and ".cs" indicates a C# file. Everything else is a C type file (C, C++, C++/CLI, or <span style="white-space: nowrap;">Objective-C</span>). If you are
using a non-standard file extension for Java or C#, use one of the --mode= options.</p>
<h4>Wildcards and Recursion</h4>
@@ -399,7 +403,7 @@
<h4>Redirection</h4>
<p>
The < and > characters may be used to redirect the files into standard input (stdin) and out of standard output
The &lt; and &gt; characters may be used to redirect the files into standard input (stdin) and out of standard output
(stdout) - don't forget them! With this option, only one file at a time can be formatted. Wildcards are not
recognized, there are no console messages, and a backup is not created. On Windows, the output will always have
Windows line ends. The options "stdin=" and "stdout=" can be used instead of redirection.</p>
@@ -413,7 +417,8 @@
<pre>astyle --style=allman --stdin=<em>OriginalSourceFile</em> --stdout=<em>BeautifiedSourceFile</em>
</pre>
</div>
<div class="code">
<div class="code" style="margin-top:1em">
<p class="code">
The redirection option may be used to display the formatted file without updating:</p>
<pre>astyle --style=allman &lt; <em>OriginalSourceFile</em> | less
@@ -915,7 +920,7 @@ indent-switches <span class="comment"># cannot do this on the command line</
<div class="code">
<pre>int Foo(bool isBar) <span class="brace">{</span>
if (isBar) <span class="brace">{
</span> bar()
</span> bar();
return 1; <span class="brace">}
</span> else
return 0; <span class="brace">}</span>
@@ -1544,8 +1549,8 @@ fooFunction(barArg1,
</pre>
</div>
<p id="_lambda_indent">
<code class="title">--lambda-indent</code><br />
<p id="_indent_lambda">
<code class="title">--indent-lambda</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>
@@ -1670,6 +1675,41 @@ isBar = false;
bar(a, b);
</pre>
</div>
<p>
&nbsp;</p>
<p id="_pad-negation">
<code class="title">--pad-negation</code><br />
Insert space padding after negations.
</p>
<div class="code">
<pre>if (!isFoo(a,b))
bar(a,b);
</pre>
<p class="code">
becomes:</p>
<pre>if (! isFoo(a, b))
bar(a, b);
</pre>
</div>
<p>
&nbsp;</p>
<p id="_pad-negation">
<code class="title">--pad-negation=before</code><br />
Insert space padding also before negations.
</p>
<div class="code">
<pre>if (!isFoo(a,b))
bar(a,b);
</pre>
<p class="code">
becomes:</p>
<pre>if ( ! isFoo(a, b))
bar(a, b);
</pre>
</div>
<p>
&nbsp;</p>
<p id="_pad-paren">
@@ -1786,6 +1826,25 @@ isBar = false;
</div>
<p id="_pad-empty-paren">
<code class="title">--pad-empty-paren / -xo </code>
<br />
Apply padding to empty pairs of parentheses; combine with other
parentheses padding options.
</p>
<div class="code">
<pre>if (isFoo())
bar(a, b);
</pre>
<p class="code">
becomes:</p>
<pre>if ( isFoo () )
bar( a, b );
</pre>
</div>
<p>
&nbsp;</p>
<p id="_pad-brackets">
<code class="title">--pad-brackets</code>
<br />
@@ -1798,6 +1857,31 @@ isBar = false;
<pre>a = b [ a [ 1 ] ];</pre>
</div>
<p id="_pad-brackets-in">
<code class="title">--pad-brackets-in</code>
<br />
Insert space padding around square brackets the <strong>inside</strong> only.
</p>
<div class="code">
<pre>a = b[a[1]];</pre>
<p class="code">
becomes:</p>
<pre>a = b[ a[ 1 ] ];</pre>
</div>
<p id="_pad-brackets-out">
<code class="title">--pad-brackets-out</code>
<br />
Insert space padding around square brackets the <strong>outside</strong> only.
</p>
<div class="code">
<pre>a = b[a[1]];</pre>
<p class="code">
becomes:</p>
<pre>a = b [a [1]];</pre>
</div>
<p id="_unpad-brackets">
<code class="title">--unpad-brackets</code>
<br />
@@ -1916,7 +2000,7 @@ string ^s1;</pre>
char&amp; foo2;
string^ s1;</pre>
</div>
<div class="code">
<div class="code" style="margin-top:1em">
<pre>char* foo1;
char &amp; foo2;
string ^s1;</pre>
@@ -1926,7 +2010,7 @@ string ^s1;</pre>
char &amp; foo2;
string ^ s1;</pre>
</div>
<div class="code">
<div class="code" style="margin-top:1em">
<pre>char* foo1;
char &amp; foo2;
string ^s1;</pre>
@@ -1954,14 +2038,14 @@ string ^s1;</pre>
becomes (with align-reference=type):</p>
<pre>char&amp; foo1;</pre>
</div>
<div class="code">
<div class="code" style="margin-top:1em">
<pre>char&amp; foo2;</pre>
<p class="code">
becomes (with align-reference=middle):</p>
<pre>char &amp; foo2;</pre>
</div>
<div class="code">
<pre>char& foo3;</pre>
<div class="code" style="margin-top:1em">
<pre>char&amp; foo3;</pre>
<p class="code">
becomes (with align-reference=name):</p>
<pre>char &amp;foo3;</pre>
@@ -2126,11 +2210,11 @@ else
<p>
&nbsp;</p>
<p id="_break-return-type">
<code class="title">--break-return-type &nbsp;&nbsp; / -xB</code><br />
<code class="title">--break-return-type &nbsp;&nbsp;&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
return type. This option has no effect on Objective-C functions.</p>
return type. This option has no effect on <span style="white-space: nowrap;">Objective-C</span> functions.</p>
<div class="code">
<pre>void Foo(bool isFoo);</pre>
<p class="code">
@@ -2141,12 +2225,12 @@ Foo(bool isFoo);</pre>
<p>
&nbsp;</p>
<p id="_attach-return-type">
<code class="title">--attach-return-type &nbsp;&nbsp; / -xf</code><br />
<code class="title">--attach-return-type &nbsp;&nbsp;&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
with --break-return-type, the result will be to break the return type. This option has no effect on
Objective-C functions.</p>
<span style="white-space: nowrap;">Objective-C</span> functions.</p>
<div class="code">
<pre>void
Foo(bool isFoo);</pre>
@@ -2268,28 +2352,32 @@ Foo(bool isFoo);</pre>
<code class="title">--mode=js</code><br />
<code class="title">--mode=java</code><br />
<code class="title">--mode=objc</code><br />
Indent a C type, C#, Javascript, Java or Objective-C file. C type files are C, C++, C++/CLI. The option is usually
set from the file extension for each file. You can override the setting with this entry. It will be used for all
files, regardless of the file extension. It allows the formatter to identify language specific syntax such as
C++ classes, templates, and keywords.</p>
<code class="title">--mode=js <i>(experimental)</i></code><br />
<code class="title">--mode=ghc <i>(experimental)</i></code><br />
Indent a C type, C#, Javascript, Java or <span style="white-space: nowrap;">Objective-C</span> file.
JS and GHC support is experimental.
C type files are C, C++, C++/CLI. The option is usually set from the file extension for each file.
You can override the setting with this entry. It will be used for all files, regardless of the file extension.
It allows the formatter to identify language specific syntax such as C++ classes, templates, and keywords.
</p>
<p>
&nbsp;</p>
<hr />
<!-- * * * * * * * * * * * * * Objective-C Options * * * * * * * * * * * * * -->
<h3 id="_Objective_C_Options">Objective-C Options</h3>
<h3 id="_Objective_C_Options"><span style="white-space: nowrap;">Objective-C</span> Options</h3>
<p>
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>
These options are effective for <span style="white-space: nowrap;">Objective-C</span> files only. The standard paren padding options will still apply
to the <span style="white-space: nowrap;">Objective-C</span> method prefix and return type unless overridden by the following options.</p>
<p>
Because of the longer indents sometimes needed for Objective-C, the option "max-continuation-indent" may
Because of the longer indents sometimes needed for <span style="white-space: nowrap;">Objective-C</span>, 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-C method prefix. This will add
Insert space padding <strong>after</strong> the '-' or '+' <span style="white-space: nowrap;">Objective-C</span> method prefix. This will add
exactly one space. Any additional spaces will be deleted.</p>
<div class="code">
<pre>-(void)foo1;
@@ -2303,7 +2391,7 @@ 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-C method prefix.&nbsp;
Remove all space padding <strong>after</strong> the &#39;-&#39; or &#39;+&#39; <span style="white-space: nowrap;">Objective-C</span> 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">
@@ -2318,7 +2406,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-C return type. This will add exactly one
Insert space padding <strong>after</strong> the <span style="white-space: nowrap;">Objective-C</span> return type. This will add exactly one
space. Any additional spaces will be deleted. </p>
<div class="code">
<pre>-(void)foo1;
@@ -2332,7 +2420,7 @@ 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-C return type. This option
Remove all space padding <strong>after</strong> the <span style="white-space: nowrap;">Objective-C</span> 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">
@@ -2347,7 +2435,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-C parameter type. This will add exactly
Insert space padding around an <span style="white-space: nowrap;">Objective-C</span> 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">
@@ -2362,7 +2450,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-C parameter type. This option takes precedence over the
Remove all space padding around an <span style="white-space: nowrap;">Objective-C</span> 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">
@@ -2382,7 +2470,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-C method declarations
Align the colons in <span style="white-space: nowrap;">Objective-C</span> 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">
@@ -2420,11 +2508,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 / -xP1<br />
--pad-method-colon=all&nbsp;&nbsp;&nbsp; / -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-C method call. These options will
Add or remove space padding before or after the colons in an <span style="white-space: nowrap;">Objective-C</span> 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">
+9 -9
View File
@@ -18,7 +18,7 @@
<p class="noindent">
Artistic Style has compile options for creating a shared library (DLL) or static library for use with a Graphical
User Interface (GUI). The shared library can be called from a C++, Objective&#8209;C, C#, or Python program. There
User Interface (GUI). The shared library can be called from a C++, <span style="white-space: nowrap;">Objective-C</span>, C#, or Python program. There
are also compile options for a Java Native Interface (JNI) that allows it to be called from a Java program. Information
on compiling the various configurations of Artistic Style is in the Install Information.</p>
<p class="noindent">
@@ -43,12 +43,12 @@
as a shared or static library from a C++ program. It includes a C++ sample program that can be used to test the
Artistic Style libraries.</p>
<p>
<a href="https://astyle.sourceforge.net/develop/objc.html">Calling Artistic Style from an Objective-C Program</a> contains information on calling Artistic
Style as a shared or static library from an Objective-C program. It includes an Objective-C sample program that
<a href="https://astyle.sourceforge.net/develop/objc.html">Calling Artistic Style from an <span style="white-space: nowrap;">Objective-C</span> Program</a> contains information on calling Artistic
Style as a shared or static library from an <span style="white-space: nowrap;">Objective-C</span> program. It includes an <span style="white-space: nowrap;">Objective-C</span> sample program that
can be used to test the Artistic Style shared libraries.</p>
<p style="margin-left: 0.5in;">
<a href="https://astyle.sourceforge.net/develop/gnustep.html">Objective&#8209;C on Windows and Linux</a> contains information on compiling and running
Objective-C programs using GNUstep. It has instructions for compiling the Example program on Windows or
<a href="https://astyle.sourceforge.net/develop/gnustep.html"><span style="white-space: nowrap;">Objective-C</span> on Windows and Linux</a> contains information on compiling and running
<span style="white-space: nowrap;">Objective-C</span> programs using GNUstep. It has instructions for compiling the Example program on Windows or
Linux.</p>
<p>
<a href="https://astyle.sourceforge.net/develop/jni.html">Calling Artistic Style as a Java Native Interface</a> contains information on calling Artistic
@@ -92,13 +92,13 @@
<h4>
<a href="https://sourceforge.net/projects/astyle/files/OldFiles/examples/example-objc.zip" target="_blank"
title="open new window">Objective&#8209;C Example</a>
title="open new window"><span style="white-space: nowrap;">Objective-C</span> Example</a>
</h4>
<p>
The example for Objective&#8209;C contains the methods to call Artistic Style from a static or shared library
using an Objective&#8209;C program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB.
Copy the shared library to the same folder as the Objective&#8209;C Example executable. It will format files in
The example for <span style="white-space: nowrap;">Objective-C</span> contains the methods to call Artistic Style from a static or shared library
using an <span style="white-space: nowrap;">Objective-C</span> program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB.
Copy the shared library to the same folder as the <span style="white-space: nowrap;">Objective-C</span> Example executable. It will format files in
the test&#8209;data directory included in the download.</p>
<h4>
+4 -4
View File
@@ -14,11 +14,11 @@
<!-- body text -->
<h1>Artistic Style 3.4.6</h1>
<h1>Artistic Style</h1>
<h2>
A Free, Fast, and Small Automatic Formatter<br />
for C, C++, C++/CLI, Objective C, C#, and Java Source Code
for C, C++, C++/CLI, <span style="white-space: nowrap;">Objective-C</span>, C#, and Java Source Code
</h2>
<center>
@@ -42,7 +42,7 @@
<p class="noindent" style="margin-top: 2em">
Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective&#8209;C,
Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, <span style="white-space: nowrap;">Objective-C</span>,
C# and Java programming languages. Written in C++, it can be used from the command line or incorporated as
a library in another program. Options can be entered from the command line or from an option file. The library
version can be called from programs written in languages other that C++.</p>
@@ -121,7 +121,7 @@
Artistic Style has compile options for creating a shared library (DLL) or static library for use with a Graphical
User Interface (GUI). With the Java Development Kit (JDK) installed it can be compiled as a Java Native Interface
(JNI) and called from a Java program. The Developer Information documents the calling procedure and has example
programs for C++, C++/CLI, Objective&#8209;C, Java, C#, and Python.</p>
programs for C++, C++/CLI, <span style="white-space: nowrap;">Objective-C</span>, Java, C#, and Python.</p>
<h3>Bug Reports, Change Requests, Update Notifications</h3>
+2 -2
View File
@@ -213,7 +213,7 @@ make install</pre>
<h4 id="_Clang_Makefile">Clang Makefile</h4>
<p>
Clang has a static analyzer that finds potential bugs in C/C++ and Objective-C programs. It can be run as a standalone
Clang has a static analyzer that finds potential bugs in C/C++ and <span style="white-space: nowrap;">Objective-C</span> programs. It can be run as a standalone
tool from the command-line and runs in tandem with a build. There is a script file, analyze.sh, that will run
the analysis on Artistic Style.</p>
<p>
@@ -328,7 +328,7 @@ make install</pre>
<li><strong>AStyleA</strong> builds the Artistic Style program as a Static Library (libastyle.a). This can be statically
linked with an executable.</li>
<li><strong>AStyleDylib</strong> builds the Artistic Style program as a Dynamic Library (libastyle.dylib). It can
be used with C/C++, Objective C, C#, and Python programs.</li>
be used with C/C++, <span style="white-space: nowrap;">Objective-C</span>, C#, and Python programs.</li>
<li><strong>AStyleJava</strong> builds the Artistic Style program as a Dynamic Library (libastylej.dylib) that can
be called from a Java program. The Java Development (JDK) is required for the project to compile. The Project
Properties must have an include path to the JDK include directory. The output dylib can also be called from a
+610 -603
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -23,13 +23,13 @@
With a new Artistic Style release some unchanged source files will be formatted because of changes to Artistic
Style. You may want to format your source before making program changes in order to bring it up to date.</p>
<p>
A new programming language, Objective&#8209;C, has been added to Artistic Style. Four new options, "align&#8209;method&#8209;colon",
A new programming language, <span style="white-space: nowrap;">Objective-C</span>, has been added to Artistic Style. Four new options, "align&#8209;method&#8209;colon",
"pad&#8209;method&#8209;colon=", "pad&#8209;method&#8209;prefix", and "unpad&#8209;method&#8209;prefix" have been
added to format the methods. The options are described in a new "Objective&#8209;C" section in the documentation.
These new options affect only Objective&#8209;C source code. They have no effect on the other programming
added to format the methods. The options are described in a new "<span style="white-space: nowrap;">Objective-C</span>" section in the documentation.
These new options affect only <span style="white-space: nowrap;">Objective-C</span> source code. They have no effect on the other programming
languages.</p>
<p>
Because of the longer continuation indents sometimes needed for Objective&#8209;C, the option "max-instatement-indent"
Because of the longer continuation indents sometimes needed for <span style="white-space: nowrap;">Objective-C</span>, the option "max-instatement-indent"
may need to be increased. If you are not getting the paren and block paren alignment you want, try increasing
this value. The default minimum is 40 and the maximum is 120.</p>
<p>
@@ -87,11 +87,11 @@
The "Links" page has two new sections for links mentioned in previous versions of Artistic Style. It links to
free software and other information.</p>
<p>
The "Developer Information" section has a new example and download for calling Artistic Style from an Objective&#8209;C
The "Developer Information" section has a new example and download for calling Artistic Style from an <span style="white-space: nowrap;">Objective-C</span>
program. Since it is another "C" language the only thing needed is to link the program with a library build of
Artistic Style. The example was developed on Windows and Linux using the GNUstep project. Since the example is
a console program the problems with the GNUstep GUI have been avoided. It has not been tested on a Mac, but should
be close to working. The "Developer Information" section also has a new page for "Objective&#8209;C on Windows
be close to working. The "Developer Information" section also has a new page for "<span style="white-space: nowrap;">Objective-C</span> on Windows
and Linux" which has information on compiling and running the example on those systems.</p>
<p>
The executable included in the Windows distribution was compiled with Visual Studio 2010 (platform toolset v100).
+119 -35
View File
@@ -14,51 +14,135 @@
<h1>Artistic Style Release Notes</h1>
<h3>Artistic Style 3.5 (June 2024)</h3>
<ul>
<li>Add option --pad-negation (https://sourceforge.net/p/astyle/bugs/571)</li>
<li>Apply align-pointer=type only if type is present (https://sourceforge.net/p/astyle/bugs/573)</li>
<li>Avoid deletion of empty lines after continuation (https://sourceforge.net/p/astyle/bugs/574)</li>
<li>Fix alignment of logical AND operators (https://sourceforge.net/p/astyle/bugs/572)</li>
<li>Fix recognition of Java/C# multi line strings (https://gitlab.com/saalen/astyle/-/issues/42)</li>
</ul>
<h3>Artistic Style 3.4.16 (May 2024)</h3>
<ul>
<li>Fix padding of scientific notation literals (#570)</li>
<li>Fix of reference args alignment (https://gitlab.com/saalen/astyle/-/issues/35)</li>
</ul>
<h3>Artistic Style 3.4.15 (May 2024)</h3>
<ul>
<li>Fix parsing of floating point literals (#566)</li>
<li>Fix "--break-block" handling of class and function blocks (#569)</li>
<li>Fix "--align-pointer=type" option for all types in lambda parameter lists (https://gitlab.com/saalen/astyle/-/issues/35)</li>
<li>Fix padding of lambda capture with align-pointer option</li>
<li>Exclude files ending with backup suffix from input file names list (#560)</li>
</ul>
<h3>Artistic Style 3.4.14 (April 2024)</h3>
<ul>
<li>Fix split references with "-k1" option (#565)</li>
<li>Fix "--align-pointer=type" option for fundamental types in lambda parameter lists (https://gitlab.com/saalen/astyle/-/issues/35)</li>
<li>Fix "--indent-after-parens" indent count (https://gitlab.com/saalen/astyle/-/issues/29)</li>
</ul>
<h3>Artistic Style 3.4.13 (March 2024)</h3>
<ul>
<li>Fix comment indent after string macro with R suffix (https://gitlab.com/saalen/astyle/-/issues/39)</li>
<li>Do not break single line block after enum in mozilla mode (https://gitlab.com/saalen/astyle/-/issues/38)</li>
<li>Adjust cmake policy for new versions only (https://gitlab.com/saalen/astyle/-/issues/40)</li>
<li>Update man page path</li>
<li>Add support for scikit-build-core</li>
</ul>
<h3>Artistic Style 3.4.12 (February 2024)</h3>
<ul>
<li>Add "--pad-brackets-in" and "--pad-brackets-out" options (https://gitlab.com/saalen/astyle/-/issues/33)</li>
<li>Fix indentation of initializer lists (https://gitlab.com/saalen/astyle/-/issues/28)</li>
<li>Fix crash with "--add-braces=nested" applied to if-else blocks (https://gitlab.com/saalen/astyle/-/issues/36)</li>
</ul>
<h3>Artistic Style 3.4.11 (January 2024)</h3>
<ul>
<li>Add new option "--add-braces=nested" to add braces in nested single line statements (https://gitlab.com/saalen/astyle/-/issues/27)</li>
<li>Fix indent after double template brackets (https://gitlab.com/saalen/astyle/-/issues/28)</li>
<li>Fix indent after dot (https://gitlab.com/saalen/astyle/-/issues/28)</li>
<li>Option "--squeeze-lines=1" is no longer default with Linux builds (#559)</li>
<li>Add experimental GHC mode (https://gitlab.com/saalen/astyle/-/issues/31)</li>
<li>Fix indent after raw string (https://gitlab.com/saalen/astyle/-/issues/32)</li>
</ul>
<h3>Artistic Style 3.4.10 (October 2023)</h3>
<ul>
<li>Fix missing indent in function parameter list (https://gitlab.com/saalen/astyle/-/issues/16)</li>
</ul>
<h3>Artistic Style 3.4.9 (October 2023)</h3>
<ul>
<li>Apply one wording for <span style="white-space: nowrap;">Objective-C</span> in the docs</li>
<li>Fix more CS regressions (https://gitlab.com/saalen/astyle/-/issues/16)</li>
<li>Fix inserting space with combined "--pad-oper" and "--align-pointer" options (#557)</li>
</ul>
<h3>Artistic Style 3.4.8 (September 2023)</h3>
<ul>
<li>Fix lambda broken brace after auto keyword (#554)</li>
<li>Fix line break after comment in asm block (#226)</li>
<li>Fix padding of multiply operator (#126)</li>
<li>Fix indentation of method calls (#434)</li>
<li>Fix empty line after closing while block (https://gitlab.com/saalen/astyle/-/issues/18)</li>
<li>Add outer padding for empty parens pairs (https://gitlab.com/saalen/astyle/-/issues/19) </li>
<li>Fix more CS regressions (https://gitlab.com/saalen/astyle/-/issues/16)</li>
</ul>
<h3>Artistic Style 3.4.6 (August 2023)</h3>
<ul>
<li>added VS2022 project files (https://gitlab.com/saalen/astyle/-/merge_requests/3)</li>
<li>fixed CS regressions (https://gitlab.com/saalen/astyle/-/issues/16)</li>
<li>added CS coalesce assignment operator (https://gitlab.com/saalen/astyle/-/issues/17)</li>
<li>Add VS2022 project files (https://gitlab.com/saalen/astyle/-/merge_requests/3)</li>
<li>Fix CS regressions (https://gitlab.com/saalen/astyle/-/issues/16)</li>
<li>Add CS coalesce assignment operator (https://gitlab.com/saalen/astyle/-/issues/17)</li>
</ul>
<h3>Artistic Style 3.4.1 (August 2023)</h3>
<ul>
<li>fixed padding of &amp; following a comma (#552)</li>
<li>fixed indent of function declarations following access modifiers (#504)</li>
<li>fixed indent of C# allocation blocks (#464)</li>
<li>fixed indentation of comments after CS interpolation quotes (https://gitlab.com/saalen/astyle/-/issues/16)</li>
<li>Fix padding of &amp; following a comma (#552)</li>
<li>Fix indent of function declarations following access modifiers (#504)</li>
<li>Fix indent of C# allocation blocks (#464)</li>
<li>Fix indentation of comments after CS interpolation quotes (https://gitlab.com/saalen/astyle/-/issues/16)</li>
</ul>
<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>
<li>Fix formatting of CS interpolation literals (https://gitlab.com/saalen/astyle/-/issues/8).</li>
<li>Fix false lambda recognition (https://gitlab.com/saalen/astyle/-/issues/11)</li>
<li>Fix indentation of member declarations (https://gitlab.com/saalen/astyle/-/issues/10)</li>
<li>Fix indentation of struct assignments (https://gitlab.com/saalen/astyle/-/issues/12)</li>
<li>Add new option "--indent-lambda" to enable new lambda recognition (https://gitlab.com/saalen/astyle/-/issues/7)</li>
<li>Add link to astyle Python distribution projects (https://gitlab.com/saalen/astyle/-/issues/6)</li>
</ul>
<h3>Artistic Style 3.3 (May 2023)</h3>
<ul>
<li>added new option "--squeeze-ws" to remove superfluous whitespace (experimental)</li>
<li>added new option "--squeeze-lines" to remove superfluous empty lines (experimental, #19, #22, #43, #72, #84, #93, #105, #517)</li>
<li>added new options "--pad-brackets" and "--unpad-brackets" to add or remove whitespace around square brackets (experimental)</li>
<li>fixed indent of lambda bodies in fct calls (#121)</li>
<li>fixed indent of struct names including &quot;struct&quot; (#526)</li>
<li>fixed indent of C++11 initializer lists (#516)</li>
<li>fixed padding of pointers separated by comma (#537)</li>
<li>refactored namespace std usage</li>
<li>Add new option "--squeeze-ws" to remove superfluous whitespace (experimental)</li>
<li>Add new option "--squeeze-lines" to remove superfluous empty lines (experimental, #19, #22, #43, #72, #84, #93, #105, #517)</li>
<li>Add new options "--pad-brackets" and "--unpad-brackets" to add or remove whitespace around square brackets (experimental)</li>
<li>Fix indent of lambda bodies in fct calls (#121)</li>
<li>Fix indent of struct names including &quot;struct&quot; (#526)</li>
<li>Fix indent of C++11 initializer lists (#516)</li>
<li>Fix padding of pointers separated by comma (#537)</li>
<li>Refactor namespace std usage</li>
</ul>
<h3>Artistic Style 3.2.1 (March 2023)</h3>
<ul>
<li>fixed struct recognition related to SF #534 (https://gitlab.com/saalen/astyle/-/issues/1)</li>
<li>Fix struct recognition related to SF #534 (https://gitlab.com/saalen/astyle/-/issues/1)</li>
</ul>
<h3>Artistic Style 3.2 (March 2023)</h3>
@@ -130,12 +214,12 @@
<li>Fix indentation of compound literals in an argument list (#456).</li>
<li>Fix indentation of trailing return type method following a constructor (#463).</li>
<li>Fix space padding of closing brace before a dot (#468).</li>
<li>Fix Objective-C to allow for &quot;Extern C&quot; statements in the source files (#443, 444, 446).</li>
<li>Fix Objective-C to allow for method definitions without a specified return type (#447).</li>
<li>Fix Objective-C to allow for method definitions with multiple param types.</li>
<li>Fix Objective-C to replace tabbed padding with a space.</li>
<li>Fix Objective-C formatting of line-end comments with &quot;unpad-return-type&quot;.</li>
<li>Fix Objective-C &quot;align-method-colon&quot; to ignore ternary (?) operators.</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> to allow for &quot;Extern C&quot; statements in the source files (#443, 444, 446).</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> to allow for method definitions without a specified return type (#447).</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> to allow for method definitions with multiple param types.</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> to replace tabbed padding with a space.</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> formatting of line-end comments with &quot;unpad-return-type&quot;.</li>
<li>Fix <span style="white-space: nowrap;">Objective-C</span> &quot;align-method-colon&quot; to ignore ternary (?) operators.</li>
<li>Fix C# base class constructor indentation (#459).</li>
<li>Fix C# indentation of method declaration containing a colon (#465)</li>
<li>Fix C/C++ to allow &quot;interface&quot; as a non-keyword (#445).</li>
@@ -207,13 +291,13 @@
<li>Add new option &quot;indent-continuation&quot;.</li>
<li>Add new option &quot;pad-comma&quot; (#100).</li>
<li>Add removing spaces before a comma (#100).</li>
<li>Add new Objective&#8209;C options "pad-return-type" (-xq) and "unpad-return-type" (-xr).</li>
<li>Add new Objective&#8209;C options "pad-param-type" (-xS) and "unpad-param-type" (-xs).</li>
<li>Add new <span style="white-space: nowrap;">Objective-C</span> options "pad-return-type" (-xq) and "unpad-return-type" (-xr).</li>
<li>Add new <span style="white-space: nowrap;">Objective-C</span> options "pad-param-type" (-xS) and "unpad-param-type" (-xs).</li>
<li>Add formatting of C++14 single-quote digit separators (#337).</li>
<li>Add indentation for CORBA IDL module statement (#414).</li>
<li>Add translations for Bulgarian, Estonian, Greek, Hungarian, Norwegian, and Romanian.</li>
<li>Remove lineend option from formatCinToCout function.</li>
<li>Improve align-method-colon and apply to Objective&#8209;C method calls.</li>
<li>Improve align-method-colon and apply to <span style="white-space: nowrap;">Objective-C</span> method calls.</li>
<li>Improve recognition of header guards in preprocessor statements.</li>
<li>Improve recognition of C++11 uniform initializer brackets (#381, 411, 415).</li>
<li>Improve the processing of quoted strings and verbatim strings.</li>
@@ -238,8 +322,8 @@
<li>Fix C# to recognize &quot;using&quot; as a header.</li>
<li>Fix C# to always recognize &quot;forever&quot; as a header.</li>
<li>Fix Pico style not always computing the indentation for one line blocks.</li>
<li>Fix indentation of Objective-C @interface statement (#333).</li>
<li>Fix assert error when Objective-C &quot;@&quot; is followed by whitespace.</li>
<li>Fix indentation of <span style="white-space: nowrap;">Objective-C</span> @interface statement (#333).</li>
<li>Fix assert error when <span style="white-space: nowrap;">Objective-C</span> &quot;@&quot; is followed by whitespace.</li>
<li>Fix end of line comments for &quot;pad-method-prefix&quot; and &quot;unpad-method-prefix&quot;.</li>
<li>Fix end of line comments for &quot;pad-method-colon&quot;.</li>
<li>Refactoring:
@@ -334,8 +418,8 @@
</ul>
<p>
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/notesArchives.html">Release
Notes Archives</a>.</strong></p>
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/notesArchives.html">Release Notes Archives</a>.</strong>
</p>
<p style="margin-left: -0.4in; text-align: center;">
<a href="http://sourceforge.net/projects/astyle">
+9 -10
View File
@@ -20,7 +20,7 @@
<h3>Artistic Style 2.04&nbsp; (November 2013)</h3>
<ul>
<li>Add new programming language Objective&#8209;C.</li>
<li>Add new programming language <span style="white-space: nowrap;">Objective-C</span>.</li>
<li>Add new bracket style option "style=google" (-A14). </li>
<li>Add new option "indent-preproc-cond" (xw) to indent preprocessor conditional statements (#118). </li>
<li>Add new bracket modify options "attach-namespaces", "attach-classes", "attach-inlines", and "attach-extern-c".
@@ -28,9 +28,9 @@
<li>Add new option "indent-modifiers" (-xG) to indent class access modifiers one-half indent (#130). </li>
<li>Add new option "remove-brackets" (-xj) to remove brackets from single line conditional statements.</li>
<li>Add new option "remove-comment-prefix" (-xp) to remove the leading '*' from multi-line comments. </li>
<li>Add new option "align-method-colon" (-xM) to align Objective&#8209;C method colons. </li>
<li>Add new option "pad-method-colon=#" (-xP#) to space pad Objective&#8209;C method colons. </li>
<li>Add new options "pad-method-prefix" (-xQ), and "unpad-method-prefix" (-xR) to pad the Objective&#8209;C "-" and
<li>Add new option "align-method-colon" (-xM) to align <span style="white-space: nowrap;">Objective-C</span> method colons. </li>
<li>Add new option "pad-method-colon=#" (-xP#) to space pad <span style="white-space: nowrap;">Objective-C</span> method colons. </li>
<li>Add new options "pad-method-prefix" (-xQ), and "unpad-method-prefix" (-xR) to pad the <span style="white-space: nowrap;">Objective-C</span> "-" and
"+" method prefix. </li>
<li>Add new dll entry point AStyleMainUtf16 for processing C# UTF-16 strings. </li>
<li>Add formatting of C++11 raw string literals (#222). </li>
@@ -39,7 +39,7 @@
<li>Improve recognition and formatting of pointers and references (#174 and other changes). </li>
<li>Improve the recognition of block-opening brackets.</li>
<li>Improve code using a static code analyzer (#195).</li>
<li>Change "max-code-length" to include Objective&#8209;C methods.</li>
<li>Change "max-code-length" to include <span style="white-space: nowrap;">Objective-C</span> methods.</li>
<li>Change "indent-elseifs" and "break-blocks" to look ahead only if in command-type brackets (speed improvement).
</li>
<li>Fix linux bracket styles to break the opening bracket in inline function definitions (#185). </li>
@@ -876,7 +876,7 @@
<li>Compilation under G++ 3.0 now works properly.</li>
<li>Bug fix: Opening brackets that appear at the beginning of a line immediately after an empty line comment are now
handled properly, and not appended as part of the line comment.</li>
<li>Bug fix: Brackets inside comments are now not mis-indented within the comment.</li>
<li>Bug fix: Brackets inside comments are properly indented within the comment.</li>
</ul>
<h3>Artistic Style 1.14.1 (2 June 2001)</h3>
@@ -1015,13 +1015,13 @@
<h3>Artistic Style 1.11.1 (3 September 1999)</h3>
<ul>
<li>Fixed a bug that inserted an empty line at the begining of source files.</li>
<li>Fixed a bug that inserted an empty line at the beginning of source files.</li>
</ul>
<h3>Artistic Style 1.11.0 (3 September 1999)</h3>
<ul>
<li>Astyle now filters out line-feeds ('\r') before begining to parse lines. This should take care of bizarre formatting
<li>Astyle now filters out line-feeds ('\r') before beginning to parse lines. This should take care of bizarre formatting
that existed when moving source files from Windows (which breaks lines with a linefeed AND newline ("\r\n") to
unix (which breaks lines only with newlines).</li>
<li>The "struct", "static" and "synchronized" keywords are now finally handled correctly in both the contexts of block
@@ -1088,7 +1088,7 @@
for similarity with the new option above.</li>
<li>Changed the short option name of the option '-<strong>-errors-to-standard-output</strong>' from '<strong>-o</strong>'
to '<strong>-X</strong>'.</li>
<li>Up to now, Artistic Style always inserted a minimal indent of <strong>t</strong>wice the current selected indent
<li>Up to now, Artistic Style always inserted a minimal indent of <strong>twice</strong> the current selected indent
size inside multi-line conditional headers ('if', 'while' ...), so that it would be clear where the headers end
and the code after them begins. The current version adds the option '<strong>--min-conditional-indent=#</strong>'
(or '<strong>-m#</strong>') that sets the absolute minimal indent between conditional headers and their multiple-line
@@ -1347,4 +1347,3 @@
</body>
</html>
+27 -7
View File
@@ -1,4 +1,4 @@
.TH astyle 1 "2023-04-18" "Andre Simon" "user documentation"
.TH astyle 1 "2024-05-03" "Andre Simon" "user documentation"
.SH NAME
astyle - C syntax indenter and formatter
@@ -9,7 +9,7 @@ astyle - C syntax indenter and formatter
.SH DESCRIPTION
.B astyle
provides a variety of options to apply a consistent coding style to C, C++, Java or Objective C source code files.
provides a variety of options to apply a consistent coding style to C, C++, Java or Objective-C source code files.
.PP
When indenting a specific file, the resulting indented file RETAINS
the original file-name. The original pre-indented file is renamed,
@@ -218,6 +218,12 @@ Insert space padding around operators.
.IP "--pad-comma OR -xg"
Insert space padding after commas.
.IP "--pad-negation"
Insert space padding after negations.
.IP "--pad-negation=before"
Insert space padding also before negations.
.IP "--pad-paren OR -P"
Insert space padding around parenthesis on both the outside
and the inside.
@@ -239,12 +245,22 @@ Insert space padding after paren headers (e.g. 'if', 'for'...).
Remove unnecessary space padding around parenthesis. This
can be used in combination with the 'pad' options above.
.IP "--pad-empty-paren OR -xo"
Apply padding to empty pairs of parentheses; combine with other
parenthesis padding options.
.IP "--pad-brackets"
Insert space padding around square brackets on both the outside
and the inside (experimental).
and the inside.
.IP "--pad-brackets-in"
Insert space padding around square brackets the inside only.
.IP "--pad-brackets-out"
Insert space padding around square brackets the outside only.
.IP "--unpad-brackets"
Remove unnecessary space padding around square brackets (experimental).
Remove unnecessary space padding around square brackets.
.IP "--delete-empty-lines OR -xe"
Delete empty lines within a function or method.
@@ -270,10 +286,10 @@ the operator type (left), middle, or operator name (right).
If not set, follow pointer alignment.
.IP "--squeeze-lines=#"
Remove superfluous empty lines exceeding the given number (experimental).
Remove superfluous empty lines exceeding the given number.
.IP "--squeeze-ws"
Remove superfluous whitespace (experimental).
Remove superfluous whitespace.
.SH Formatting Options
@@ -289,6 +305,7 @@ Break one line headers (e.g. 'if', 'while', 'else', ...) from a
statement residing on the same line.
.IP "--add-braces OR -j"
.IP "--add-braces=nested (experimental)"
Add braces to unbraced one line conditional statements.
.IP "--add-one-line-braces OR -J"
@@ -349,6 +366,9 @@ Indent an Objective-C source file.
.IP "--mode=js"
Indent a JavaScript source file (experimental).
.IP "--mode=ghc"
Indent a GHC source file (experimental).
.SH Objective-C Options
.IP "--pad-method-prefix OR -xQ"
@@ -517,6 +537,6 @@ astyle --style=allman --recursive /home/project/*.cpp,*.h
astyle --style=allman < OriginalSourceFile > BeautifiedSourceFile
.SH AUTHORS
Andre Simon <a.simon@mailbox.org>
Andre Simon <as@andre-simon.de>
.SH SEE ALSO
More information at https://sourceforge.net/p/astyle/.
+1 -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 --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"
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-negation --pad-paren --pad-paren-out --pad-first-paren-out --pad-paren-in --pad-header --unpad-paren --pad-empty-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)
+1
View File
@@ -29,6 +29,7 @@ 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-empty-paren -d 'Apply padding to empty pairs of parentheses'
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'
+1
View File
@@ -32,6 +32,7 @@ _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-empty-paren[Apply padding to empty pairs of parentheses]"
"--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]"
+10 -1
View File
@@ -89,6 +89,9 @@ parser:flag "--pad-oper"
parser:flag "--pad-comma"
:description "Insert space padding after commas"
parser:flag "--pad-negation"
:description "Insert space padding after negations"
parser:flag "--pad-paren"
:description "Insert space padding around parenthesis on both the outside and the inside"
@@ -108,7 +111,13 @@ parser:flag "--unpad-paren"
:description "Remove unnecessary space padding around parenthesis"
parser:flag "--pad-brackets"
:description "Insert space padding around square brackets on both the outside and the inside (experimental)."
:description "Insert space padding around square brackets on both the outside and the inside."
parser:flag "--pad-brackets-in"
:description "Insert space padding around square brackets on the inside only."
parser:flag "--pad-brackets-out"
:description "Insert space padding around square brackets on the outside only."
parser:flag "--unpad-brackets"
:description "Remove unnecessary space padding around square brackets (experimental)."
+207 -74
View File
@@ -72,6 +72,7 @@ ASBeautifier::ASBeautifier()
setPreprocDefineIndent(false);
setPreprocConditionalIndent(false);
setAlignMethodColon(false);
isInAssignment = isInInitializerList = isInMultiLineString = false;
// initialize ASBeautifier member vectors
beautifierFileType = INVALID_TYPE; // reset to an invalid type
@@ -209,6 +210,10 @@ ASBeautifier::ASBeautifier(const ASBeautifier& other) : ASBase(other)
caseIndent = other.caseIndent;
squeezeWhitespace = other.squeezeWhitespace;
attemptLambdaIndentation = other.attemptLambdaIndentation;
isInAssignment = other.isInAssignment;
isInInitializerList = other.isInInitializerList;
isInMultiLineString = other.isInMultiLineString;
namespaceIndent = other.namespaceIndent;
braceIndent = other.braceIndent;
braceIndentVtk = other.braceIndentVtk;
@@ -602,16 +607,16 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
&& line.length() > 0
&& line[0] != '#')
{
std::string indentedLine;
if (isIndentModeOff)
return originalLine;
if (isInClassHeaderTab || isInClassInitializer)
{
// parsing is turned off in ASFormatter by indent-off
// the originalLine will probably never be returned here
indentedLine = preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount) + line;
return getIndentedLineReturn(indentedLine, originalLine);
return preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount) + line;
}
indentedLine = preLineWS(preprocBlockIndent, 0) + line;
return getIndentedLineReturn(indentedLine, originalLine);
return preLineWS(preprocBlockIndent, 0) + line;
}
if (!isInComment
@@ -646,10 +651,18 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
}
else
indentedLine = preLineWS(preprocBlockIndent, 0) + line;
return getIndentedLineReturn(indentedLine, originalLine);
if (isIndentModeOff)
return originalLine;
else
return indentedLine;
}
if (shouldIndentPreprocConditional && preproc.length() > 0)
{
if (isIndentModeOff)
return originalLine;
std::string indentedLine;
if (preproc.length() >= 2 && preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef
{
@@ -661,7 +674,7 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
preprocIndentStack->emplace_back(entry);
indentedLine = preLineWS(preprocIndentStack->back().first,
preprocIndentStack->back().second) + line;
return getIndentedLineReturn(indentedLine, originalLine);
return indentedLine;
}
if (preproc == "else" || preproc == "elif")
{
@@ -669,7 +682,7 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
{
indentedLine = preLineWS(preprocIndentStack->back().first,
preprocIndentStack->back().second) + line;
return getIndentedLineReturn(indentedLine, originalLine);
return indentedLine;
}
}
else if (preproc == "endif")
@@ -679,7 +692,7 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
indentedLine = preLineWS(preprocIndentStack->back().first,
preprocIndentStack->back().second) + line;
preprocIndentStack->pop_back();
return getIndentedLineReturn(indentedLine, originalLine);
return indentedLine;
}
}
}
@@ -699,14 +712,14 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
{
isInDefineDefinition = false;
// this could happen with invalid input
if (activeBeautifierStack->empty())
if (activeBeautifierStack->empty() || isIndentModeOff)
return originalLine;
ASBeautifier* defineBeautifier = activeBeautifierStack->back();
activeBeautifierStack->pop_back();
std::string indentedLine = defineBeautifier->beautify(line);
delete defineBeautifier;
return getIndentedLineReturn(indentedLine, originalLine);
return indentedLine;
}
// unless this is a multi-line #define, return this precompiler line as is.
@@ -749,7 +762,7 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
size_t iPrelim = headerStack->size();
// calculate preliminary indentation based on headerStack and data from past lines
computePreliminaryIndentation();
computePreliminaryIndentation(line);
// parse characters in the current line.
parseCurrentLine(line);
@@ -800,8 +813,7 @@ std::string ASBeautifier::beautify(const std::string& originalLine)
indentCount = spaceIndentCount = 0;
// finally, insert indentations into beginning of line
std::string indentedLine = preLineWS(indentCount, spaceIndentCount) + line;
indentedLine = getIndentedLineReturn(indentedLine, originalLine);
std::string indentedLine = isIndentModeOff ? originalLine : preLineWS(indentCount, spaceIndentCount) + line;
prevFinalLineSpaceIndentCount = spaceIndentCount;
prevFinalLineIndentCount = indentCount;
@@ -856,6 +868,14 @@ void ASBeautifier::setSharpStyle()
fileType = SHARP_TYPE;
}
/**
* set indentation style to GHC.
*/
void ASBeautifier::setGHCStyle()
{
fileType = GHC_TYPE;
}
/**
* set mode manually set flag
*/
@@ -1301,13 +1321,6 @@ int ASBeautifier::getTabLength() const
return tabLength;
}
const std::string& ASBeautifier::getIndentedLineReturn(const std::string& newLine, const std::string& originalLine) const
{
if (isIndentModeOff)
return originalLine;
return newLine;
}
std::string ASBeautifier::preLineWS(int lineIndentCount, int lineSpaceIndentCount) const
{
if (shouldForceTabIndentation)
@@ -1338,9 +1351,10 @@ std::string ASBeautifier::preLineWS(int lineIndentCount, int lineSpaceIndentCoun
/**
* register a continuation indent.
*/
void ASBeautifier::registerContinuationIndent(const std::string& line, int i, int spaceIndentCount_,
void ASBeautifier::registerContinuationIndent(std::string_view line, int i, int spaceIndentCount_,
int tabIncrementIn, int minIndent, bool updateParenStack)
{
//return;
assert(i >= -1);
int remainingCharNum = line.length() - i;
int nextNonWSChar = getNextProgramCharDistance(line, i);
@@ -1350,14 +1364,25 @@ void ASBeautifier::registerContinuationIndent(const std::string& line, int i, in
if (nextNonWSChar == remainingCharNum || shouldIndentAfterParen)
{
int previousIndent = spaceIndentCount_;
if (!continuationIndentStack->empty())
previousIndent = continuationIndentStack->back();
int currIndent = continuationIndent * indentLength + previousIndent;
// GL29
if (shouldIndentAfterParen) {
currIndent = indentLength;
}
if (currIndent > maxContinuationIndent && line[i] != '{')
currIndent = indentLength * 2 + spaceIndentCount_;
continuationIndentStack->emplace_back(currIndent);
if (updateParenStack)
if (updateParenStack) {
parenIndentStack->emplace_back(previousIndent);
}
return;
}
@@ -1387,9 +1412,10 @@ void ASBeautifier::registerContinuationIndent(const std::string& line, int i, in
continuationIndentCount = minIndent + spaceIndentCount_;
// this is not done for an in-statement array
int multiplier = isInAssignment ? 1 : 2; // GL16 - no multiply in assignments
if (continuationIndentCount > maxContinuationIndent
&& !(prevNonLegalCh == '=' && currentNonLegalCh == '{'))
continuationIndentCount = indentLength * 2 + spaceIndentCount_;
continuationIndentCount = indentLength * multiplier + spaceIndentCount_;
if (!continuationIndentStack->empty()
&& continuationIndentCount < continuationIndentStack->back())
@@ -1406,7 +1432,7 @@ void ASBeautifier::registerContinuationIndent(const std::string& line, int i, in
/**
* Register a continuation indent for a class header or a class initializer colon.
*/
void ASBeautifier::registerContinuationIndentColon(const std::string& line, int i, int tabIncrementIn)
void ASBeautifier::registerContinuationIndentColon(std::string_view line, int i, int tabIncrementIn)
{
assert(line[i] == ':');
assert(isInClassInitializer || isInClassHeaderTab);
@@ -1432,7 +1458,7 @@ void ASBeautifier::registerContinuationIndentColon(const std::string& line, int
*/
std::pair<int, int> ASBeautifier::computePreprocessorIndent()
{
computePreliminaryIndentation();
computePreliminaryIndentation("");
std::pair<int, int> entry(indentCount, spaceIndentCount);
if (!headerStack->empty()
&& entry.first > 0
@@ -1448,7 +1474,7 @@ std::pair<int, int> ASBeautifier::computePreprocessorIndent()
* get distance to the next non-white space, non-comment character in the line.
* if no such character exists, return the length remaining to the end of the line.
*/
int ASBeautifier::getNextProgramCharDistance(const std::string& line, int i) const
int ASBeautifier::getNextProgramCharDistance(std::string_view line, int i) const
{
bool inComment = false;
int remainingCharNum = line.length() - i;
@@ -1521,7 +1547,7 @@ int ASBeautifier::convertTabToSpaces(int i, int tabIncrementIn) const
* @return the trimmed line.
* @param str the line to trim.
*/
std::string ASBeautifier::trim(const std::string& str) const
std::string ASBeautifier::trim(std::string_view str) const
{
int start = 0;
int end = str.length() - 1;
@@ -1546,15 +1572,14 @@ std::string ASBeautifier::trim(const std::string& str) const
* @return the trimmed line.
* @param str the line to trim.
*/
std::string ASBeautifier::rtrim(const std::string& str) const
std::string ASBeautifier::rtrim(std::string_view str) const
{
size_t len = str.length();
size_t end = str.find_last_not_of(" \t");
if (end == std::string::npos
|| end == len - 1)
return str;
std::string returnStr(str, 0, end + 1);
return returnStr;
return std::string(str);
return std::string(str.substr(0, end + 1));
}
/**
@@ -1684,7 +1709,7 @@ void ASBeautifier::initTempStacksContainer(std::vector<std::vector<const std::st
*
* @return true if line ends with a comma, otherwise false.
*/
bool ASBeautifier::statementEndsWithComma(const std::string& line, int index) const
bool ASBeautifier::statementEndsWithComma(std::string_view line, int index) const
{
assert(line[index] == '=');
@@ -1765,7 +1790,7 @@ bool ASBeautifier::statementEndsWithComma(const std::string& line, int index) co
*
* @return is before a line-end comment.
*/
bool ASBeautifier::isLineEndComment(const std::string& line, int startPos) const
bool ASBeautifier::isLineEndComment(std::string_view line, int startPos) const
{
assert(line.compare(startPos, 2, "/*") == 0);
@@ -1785,7 +1810,7 @@ bool ASBeautifier::isLineEndComment(const std::string& line, int startPos) const
*
* @return is the index to the previous word (the in statement indent).
*/
int ASBeautifier::getContinuationIndentAssign(const std::string& line, size_t currPos) const
int ASBeautifier::getContinuationIndentAssign(std::string_view line, size_t currPos) const
{
assert(line[currPos] == '=');
@@ -1813,7 +1838,7 @@ int ASBeautifier::getContinuationIndentAssign(const std::string& line, size_t cu
*
* @return is the indent to the second word on the line (the in statement indent).
*/
int ASBeautifier::getContinuationIndentComma(const std::string& line, size_t currPos) const
int ASBeautifier::getContinuationIndentComma(std::string_view line, size_t currPos) const
{
assert(line[currPos] == ',');
@@ -1874,10 +1899,10 @@ std::string ASBeautifier::getNextWord(const std::string& line, size_t currPos) c
*
* @return is true or false.
*/
bool ASBeautifier::isIndentedPreprocessor(const std::string& line, size_t currPos) const
bool ASBeautifier::isIndentedPreprocessor(std::string_view line, size_t currPos) const
{
assert(line[0] == '#');
std::string nextWord = getNextWord(line, currPos);
std::string nextWord = getNextWord(std::string(line), currPos);
if (nextWord == "region" || nextWord == "endregion")
return true;
// is it #pragma omp
@@ -1908,7 +1933,7 @@ bool ASBeautifier::isIndentedPreprocessor(const std::string& line, size_t currPo
break;
}
// check for "pragma omp"
std::string word = line.substr(start, end - start);
std::string_view word = line.substr(start, end - start);
if (word == "omp" || word == "region" || word == "endregion")
return true;
}
@@ -1920,7 +1945,7 @@ bool ASBeautifier::isIndentedPreprocessor(const std::string& line, size_t currPo
*
* @return is true or false.
*/
bool ASBeautifier::isPreprocessorConditionalCplusplus(const std::string& line) const
bool ASBeautifier::isPreprocessorConditionalCplusplus(std::string_view line) const
{
std::string preproc = trim(line.substr(1));
if (preproc.compare(0, 5, "ifdef") == 0 && getNextWord(preproc, 4) == "__cplusplus")
@@ -1952,7 +1977,7 @@ bool ASBeautifier::isPreprocessorConditionalCplusplus(const std::string& line) c
*
* @return is true or false.
*/
bool ASBeautifier::isInPreprocessorUnterminatedComment(const std::string& line)
bool ASBeautifier::isInPreprocessorUnterminatedComment(std::string_view line)
{
if (!isInPreprocessorComment)
{
@@ -1987,7 +2012,7 @@ int ASBeautifier::getBeautifierFileType() const
/**
* Process preprocessor statements and update the beautifier stacks.
*/
void ASBeautifier::processPreprocessor(const std::string& preproc, const std::string& line)
void ASBeautifier::processPreprocessor(std::string_view preproc, std::string_view line)
{
// When finding a multi-lined #define statement, the original beautifier
// 1. sets its isInDefineDefinition flag
@@ -2077,7 +2102,7 @@ void ASBeautifier::processPreprocessor(const std::string& preproc, const std::st
// Compute the preliminary indentation based on data in the headerStack
// and data from previous lines.
// Update the class variable indentCount.
void ASBeautifier::computePreliminaryIndentation()
void ASBeautifier::computePreliminaryIndentation(std::string_view line)
{
indentCount = 0;
spaceIndentCount = 0;
@@ -2105,10 +2130,12 @@ void ASBeautifier::computePreliminaryIndentation()
|| (*headerStack)[i] == &AS_THROWS
|| (*headerStack)[i] == &AS_STATIC))
++indentCount;
} else {
//GL37
if (!(i > 0 && (*headerStack)[i - 1] != &AS_OPEN_BRACE
&& (*headerStack)[i] == &AS_OPEN_BRACE))
++indentCount;
}
else if (!(i > 0 && (*headerStack)[i - 1] != &AS_OPEN_BRACE
&& (*headerStack)[i] == &AS_OPEN_BRACE))
++indentCount;
if (!isJavaStyle() && !namespaceIndent && i > 0
&& ((*headerStack)[i - 1] == &AS_NAMESPACE
@@ -2134,6 +2161,24 @@ void ASBeautifier::computePreliminaryIndentation()
isInSwitch = true;
}
// GL26 check if line is a label.... do not indent
//std::cerr << "line "<<line<< "\n";
/*
if (!blockIndent) {
size_t lastCharPos = line.find_last_not_of(" \t");
if ( isCStyle()
&& line[lastCharPos] == ':'
) {
if (labelIndent)
--indentCount; // unindent label by one indent
else
indentCount = 0;
}
} */
} // end of for loop
if (isInClassHeader)
@@ -2321,7 +2366,7 @@ int ASBeautifier::adjustIndentCountForBreakElseIfComments() const
* Extract a preprocessor statement without the #.
* If a error occurs an empty std::string is returned.
*/
std::string ASBeautifier::extractPreprocessorStatement(const std::string& line) const
std::string ASBeautifier::extractPreprocessorStatement(std::string_view line) const
{
std::string preproc;
size_t start = line.find_first_not_of("#/ \t");
@@ -2334,7 +2379,7 @@ std::string ASBeautifier::extractPreprocessorStatement(const std::string& line)
return preproc;
}
void ASBeautifier::adjustObjCMethodDefinitionIndentation(const std::string& line_)
void ASBeautifier::adjustObjCMethodDefinitionIndentation(std::string_view line_)
{
// register indent for Objective-C continuation line
if (line_.length() > 0
@@ -2365,7 +2410,7 @@ void ASBeautifier::adjustObjCMethodDefinitionIndentation(const std::string& line
}
}
void ASBeautifier::adjustObjCMethodCallIndentation(const std::string& line_)
void ASBeautifier::adjustObjCMethodCallIndentation(std::string_view line_)
{
static int keywordIndentObjCMethodAlignment = 0;
if (shouldAlignMethodColon && objCColonAlignSubsequent != -1)
@@ -2442,7 +2487,7 @@ void ASBeautifier::clearObjCMethodDefinitionAlignment()
* Find the first alignment colon on a line.
* Ternary operators (?) are bypassed.
*/
int ASBeautifier::findObjCColonAlignment(const std::string& line) const
int ASBeautifier::findObjCColonAlignment(std::string_view line) const
{
bool haveTernary = false;
for (size_t i = 0; i < line.length(); i++)
@@ -2466,13 +2511,41 @@ int ASBeautifier::findObjCColonAlignment(const std::string& line) const
return -1;
}
/* chatgpt
int ASBeautifier::findObjCColonAlignment(const std::string& line) const
{
bool haveTernary = false;
for (char c : line)
{
if (c == ':' || c == '?')
{
if (c == '?')
{
haveTernary = true;
continue;
}
if (haveTernary)
{
haveTernary = false;
continue;
}
return &c - line.c_str(); // Calculate the index of the found character
}
}
return -1;
}
*/
/**
* Compute the spaceIndentCount necessary to align the current line colon
* with the colon position in the argument.
* If it cannot be aligned indentLength is returned and a new colon
* position is calculated.
*/
int ASBeautifier::computeObjCColonAlignment(const std::string& line, int colonAlignPosition) const
int ASBeautifier::computeObjCColonAlignment(std::string_view line, int colonAlignPosition) const
{
int colonPosition = findObjCColonAlignment(line);
if (colonPosition < 0 || colonPosition > colonAlignPosition)
@@ -2486,7 +2559,7 @@ int ASBeautifier::computeObjCColonAlignment(const std::string& line, int colonAl
* Use for now and see what happens.
* Most programmers will probably use align-method-colon anyway.
*/
int ASBeautifier::getObjCFollowingKeyword(const std::string& line, int bracePos) const
int ASBeautifier::getObjCFollowingKeyword(std::string_view line, int bracePos) const
{
assert(line[bracePos] == '[');
size_t firstText = line.find_first_not_of(" \t", bracePos + 1);
@@ -2517,7 +2590,8 @@ int ASBeautifier::getObjCFollowingKeyword(const std::string& line, int bracePos)
size_t keyPos = line.find_first_not_of(" \t", objectEnd + 1);
if (keyPos == std::string::npos)
return 0;
return keyPos - firstText;
return static_cast<int>(keyPos - firstText); // Cast to int for return value
}
/**
@@ -2525,11 +2599,11 @@ int ASBeautifier::getObjCFollowingKeyword(const std::string& line, int bracePos)
* The indentCount is NOT included
* Needed to compute an accurate alignment.
*/
std::string ASBeautifier::getIndentedSpaceEquivalent(const std::string& line_) const
std::string ASBeautifier::getIndentedSpaceEquivalent(std::string_view line_) const
{
std::string spaceIndent;
spaceIndent.append(spaceIndentCount, ' ');
std::string convertedLine = spaceIndent + line_;
std::string convertedLine = spaceIndent + std::string(line_);
for (size_t i = spaceIndent.length(); i < convertedLine.length(); i++)
{
if (convertedLine[i] == '\t')
@@ -2573,7 +2647,7 @@ bool ASBeautifier::isTopLevel() const
/**
* Parse the current line to update indentCount and spaceIndentCount.
*/
void ASBeautifier::parseCurrentLine(const std::string& line)
void ASBeautifier::parseCurrentLine(std::string_view line)
{
bool isInLineComment = false;
bool isInOperator = false;
@@ -2585,10 +2659,12 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
char ch = ' ';
int tabIncrementIn = 0;
if (isInQuote
&& !haveLineContinuationChar
&& !isInVerbatimQuote
&& !isInAsm)
&& !isInAsm
&& !isInMultiLineString)
isInQuote = false; // missing closing quote
haveLineContinuationChar = false;
@@ -2600,6 +2676,8 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
if (isInBeautifySQL)
continue;
bool isTripleQuoteDelimiter = (isJavaStyle() || isSharpStyle() ) && line.length() > i + 2 && line[i + 1] == '"' && line[i + 2 ] == '"';
// handle special characters (i.e. backslash+character such as \n, \t, ...)
if (isInQuote && !isInVerbatimQuote)
{
@@ -2645,15 +2723,18 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
&& (ch == '"'
|| (ch == '\'' && !isDigitSeparator(line, i))))
{
if (!isInQuote)
if (!isInQuote && !isInMultiLineString)
{
quoteChar = ch;
isInQuote = true;
isInMultiLineString = isTripleQuoteDelimiter;
char prevCh = i > 0 ? line[i - 1] : ' ';
char prevPrevCh = i > 1 ? line[i - 2] : ' ';
// GL 32
// https://sourceforge.net/p/astyle/bugs/535/
if (isCStyle() && prevCh == 'R' && !(isalpha(prevNonSpaceCh) || prevNonSpaceCh == '(' ))
if (isCStyle() && prevCh == 'R' && !isalpha(prevPrevCh) && !(isalpha(prevNonSpaceCh) ))
{
int parenPos = line.find('(', i);
if (parenPos != -1)
@@ -2694,6 +2775,13 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
}
}
}
else if (isTripleQuoteDelimiter && isInMultiLineString)
{
isInMultiLineString = false;
isInQuote = false;
isContinuation = true;
continue;
}
else if (quoteChar == ch)
{
isInQuote = false;
@@ -2817,7 +2905,9 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
prevNonSpaceCh = currentNonSpaceCh;
currentNonSpaceCh = ch;
if (!isLegalNameChar(ch) && ch != ',' && ch != ';')
// #SF 97
if (!isLegalNameChar(ch) /*&& ch != ',' && ch != ';'*/)
{
prevNonLegalCh = currentNonLegalCh;
currentNonLegalCh = ch;
@@ -2854,8 +2944,10 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
}
// handle parentheses
if (ch == '(' || ch == '[' || ch == ')' || ch == ']')
if ((ch == '(' && !isInInitializerList) || ch == '[' || ch == ')' || ch == ']')
{
// GL28 xx
if (ch == '(' || ch == '[')
{
isInOperator = false;
@@ -2894,8 +2986,9 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
if ( !isLegalNameChar(prevNonSpaceCh)
&& prevNonSpaceCh != ']'
&& prevNonSpaceCh != ')'
&& prevNonSpaceCh != '*' // GH #11
&& line.find(AS_AUTO, 0 ) == std::string::npos)
&& prevNonSpaceCh != '*' // GL #11
//&& line.find(AS_AUTO, 0 ) == std::string::npos
)
{
lambdaIndicator = true;
}
@@ -2992,6 +3085,9 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
isBlockOpener = true;
}
// GL28 fix initializer lists like x({a.x=0;})
isInInitializerList = isCStyle() && isBlockOpener && (prevNonSpaceCh=='(' || prevNonSpaceCh=='=');
if (!isBlockOpener && currentHeader != nullptr)
{
for (const std::string* const nonParenHeader : *nonParenHeaders)
@@ -3128,7 +3224,7 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
else if (isSharpStyle()
&& (newHeader == &AS_GET || newHeader == &AS_SET))
{
if (getNextWord(line, i + (*newHeader).length()) == "is")
if (getNextWord(std::string(line), i + (*newHeader).length()) == "is")
newHeader = nullptr;
}
else if (newHeader == &AS_USING
@@ -3325,6 +3421,8 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
if (ch == '?')
isInQuestion = true;
// special handling of colons XXX 533
if (ch == ':')
{
@@ -3421,11 +3519,11 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
}
}
if ((ch == ';' || (parenDepth > 0 && ch == ',')) && !continuationIndentStackSizeStack->empty())
if ((ch == ';' || (parenDepth > 0 && ch == ',')) && !continuationIndentStackSizeStack->empty()){
while ((int) continuationIndentStackSizeStack->back() + (parenDepth > 0 ? 1 : 0)
< (int) continuationIndentStack->size())
continuationIndentStack->pop_back();
}
else if (ch == ',' && (isInEnum || isInStruct) && isNonInStatementArray && !continuationIndentStack->empty())
continuationIndentStack->pop_back();
@@ -3467,6 +3565,8 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
// handle ends of statements
if ((ch == ';' && parenDepth == 0) || ch == '}')
{
isInAssignment = isInInitializerList = false;
if (ch == '}')
{
@@ -3712,7 +3812,7 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
}
// bypass the entire name for all others
std::string name = getCurrentWord(line, i);
std::string_view name = getCurrentWord(line, i);
i += name.length() - 1;
continue;
}
@@ -3725,11 +3825,11 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
&& !isWhiteSpace(line[i + 1])
&& isCharPotentialHeader(line, i + 1))
{
std::string curWord = getCurrentWord(line, i + 1);
std::string_view curWord = getCurrentWord(line, i + 1);
if (curWord == AS_INTERFACE || curWord == AS_AUTORELEASEPOOL)
{
isInObjCInterface = true;
std::string name = '@' + curWord;
std::string name = '@' + std::string(curWord);
i += name.length() - 1;
continue;
}
@@ -3747,7 +3847,7 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
--indentCount;
if (modifierIndent)
spaceIndentCount += (indentLength / 2);
std::string name = '@' + curWord;
std::string name = '@' + std::string(curWord);
i += name.length() - 1;
continue;
}
@@ -3757,7 +3857,7 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
popLastContinuationIndent();
spaceIndentCount = 0;
isInObjCMethodDefinition = false;
std::string name = '@' + curWord;
std::string name = '@' + std::string(curWord);
i += name.length() - 1;
continue;
}
@@ -3812,14 +3912,39 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
if (foundNonAssignmentOp->length() > 1)
i += foundNonAssignmentOp->length() - 1;
// For C++ input/output, operator<< and >> should be
// For C++ input/output, operator<<, >> and . method calls should be
// aligned, if we are not in a statement already and
// also not in the "operator<<(...)" header line
// GL28: method calls have to contain only alphanumeric identifier
size_t openParenPos = line.find(AS_OPEN_PAREN, i);
std::string methodName = getNextWord(std::string(line), i);
size_t methodNameEndPos = i + methodName.length() + 1;
size_t firstCharAfterMethod = line.substr(i + methodName.length() + 1).find_first_not_of(" \t");
if (firstCharAfterMethod != std::string::npos)
{
methodNameEndPos += firstCharAfterMethod;
}
size_t firstCharOfLine = line.find_first_not_of(" \t");
bool lineStartsWithDot = false;
if (firstCharOfLine != std::string::npos)
{
lineStartsWithDot = line[firstCharOfLine] == '.';
}
// GL28: do not mixup template closing ">>" with IO operator
std::string searchTemplatePattern = std::string(line).substr(0, i);
size_t countLS = std::count_if( searchTemplatePattern.begin(), searchTemplatePattern.end(), []( char c ){return c =='<';});
if (!isInOperator
&& continuationIndentStack->empty()
&& isCStyle()
&& (foundNonAssignmentOp == &AS_GR_GR
|| foundNonAssignmentOp == &AS_LS_LS))
&& !lineStartsWithDot
&& ( (foundNonAssignmentOp == &AS_GR_GR && countLS < 2 )
|| foundNonAssignmentOp == &AS_LS_LS
|| (foundNonAssignmentOp == &AS_DOT && openParenPos == methodNameEndPos)))
{
// this will be true if the line begins with the operator
if (i < foundNonAssignmentOp->length() && spaceIndentCount == 0)
@@ -3831,6 +3956,9 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
else if (foundAssignmentOp != nullptr)
{
isInAssignment = true;
foundPreCommandHeader = false; // clears this for array assignments
foundPreCommandMacro = false;
@@ -3864,6 +3992,11 @@ void ASBeautifier::parseCurrentLine(const std::string& line)
{
if (i == 0 && spaceIndentCount == 0)
spaceIndentCount += indentLength;
// #SF 97
if (prevNonLegalCh == '=' && currentNonLegalCh == '=')
spaceIndentCount = 0;
registerContinuationIndent(line, i, spaceIndentCount, tabIncrementIn, 0, false);
isContinuation = true;
}
+11 -12
View File
@@ -188,7 +188,7 @@ void ASEnhancer::convertSpaceIndentToForceTab(std::string& line) const
* @param caseIndex the line index of the case statement.
* @return the line index of the colon.
*/
size_t ASEnhancer::findCaseColon(const std::string& line, size_t caseIndex) const
size_t ASEnhancer::findCaseColon(std::string_view line, size_t caseIndex) const
{
size_t i = caseIndex;
bool isInQuote_ = false;
@@ -276,9 +276,9 @@ int ASEnhancer::indentLine(std::string& line, int indent) const
* @param index the current line index.
* @return true if a hit.
*/
bool ASEnhancer::isBeginDeclareSectionSQL(const std::string& line, size_t index) const
bool ASEnhancer::isBeginDeclareSectionSQL(std::string_view line, size_t index) const
{
std::string word;
size_t hits = 0;
size_t i;
for (i = index; i < line.length(); i++)
@@ -290,8 +290,8 @@ bool ASEnhancer::isBeginDeclareSectionSQL(const std::string& line, size_t index)
break;
if (!isCharPotentialHeader(line, i))
continue;
word = getCurrentWord(line, i);
for (char& character : word)
std::string_view word = getCurrentWord(line, i);
for (char character : word)
character = (char) toupper(character);
if (word == "EXEC" || word == "SQL")
{
@@ -325,9 +325,8 @@ bool ASEnhancer::isBeginDeclareSectionSQL(const std::string& line, size_t index)
* @param index the current line index.
* @return true if a hit.
*/
bool ASEnhancer::isEndDeclareSectionSQL(const std::string& line, size_t index) const
bool ASEnhancer::isEndDeclareSectionSQL(std::string_view line, size_t index) const
{
std::string word;
size_t hits = 0;
size_t i;
for (i = index; i < line.length(); i++)
@@ -339,8 +338,8 @@ bool ASEnhancer::isEndDeclareSectionSQL(const std::string& line, size_t index) c
break;
if (!isCharPotentialHeader(line, i))
continue;
word = getCurrentWord(line, i);
for (char& character : word)
std::string_view word = getCurrentWord(line, i);
for (char character : word)
character = (char) toupper(character);
if (word == "EXEC" || word == "SQL")
{
@@ -374,7 +373,7 @@ bool ASEnhancer::isEndDeclareSectionSQL(const std::string& line, size_t index) c
* @return false = one-line brace has not been reached.
* true = one-line brace has been reached.
*/
bool ASEnhancer::isOneLineBlockReached(const std::string& line, int startChar) const
bool ASEnhancer::isOneLineBlockReached(std::string_view line, int startChar) const
{
assert(line[startChar] == '{');
@@ -619,7 +618,7 @@ void ASEnhancer::parseCurrentLine(std::string& line, bool isInPreprocessor, bool
// bypass the entire word
if (isPotentialKeyword)
{
std::string name = getCurrentWord(line, i);
std::string_view name = getCurrentWord(line, i);
i += name.length() - 1;
}
continue;
@@ -712,7 +711,7 @@ size_t ASEnhancer::processSwitchBlock(std::string& line, size_t index)
}
if (isPotentialKeyword)
{
std::string name = getCurrentWord(line, i); // bypass the entire name
std::string_view name = getCurrentWord(line, i); // bypass the entire name
i += name.length() - 1;
}
return i;
+315 -136
View File
@@ -11,6 +11,7 @@
#include <algorithm>
#include <fstream>
#include <set>
//-----------------------------------------------------------------------------
// astyle namespace
@@ -41,12 +42,15 @@ ASFormatter::ASFormatter()
referenceAlignment = REF_SAME_AS_PTR;
objCColonPadMode = COLON_PAD_NO_CHANGE;
lineEnd = LINEEND_DEFAULT;
squeezeEmptyLineNum = std::string::npos;
maxCodeLength = std::string::npos;
isInStruct = false;
shouldPadCommas = false;
shouldPadOperators = false;
negationPadMode = NEGATION_PAD_NO_CHANGE;
shouldPadParensOutside = false;
shouldPadFirstParen = false;
shouldPadEmptyParens = false;
shouldPadParensInside = false;
shouldPadHeader = false;
shouldStripCommentPrefix = false;
@@ -74,7 +78,7 @@ ASFormatter::ASFormatter()
shouldAttachReturnTypeDecl = false;
shouldBreakElseIfs = false;
shouldBreakLineAfterLogical = false;
shouldAddBraces = false;
shouldAddBraces = 0;
shouldAddOneLineBraces = false;
shouldRemoveBraces = false;
shouldPadMethodColon = false;
@@ -87,6 +91,8 @@ ASFormatter::ASFormatter()
shouldPadBracketsOutside = false;
shouldPadBracketsInside = false;
shouldUnPadBrackets = false;
isInMultlineStatement = false;
isInExplicitBlock = 0;
// initialize ASFormatter member std::vectors
formatterFileType = INVALID_TYPE; // reset to an invalid type
@@ -173,6 +179,7 @@ void ASFormatter::init(ASSourceIterator* si)
clearFormattedLineSplitPoints();
currentHeader = nullptr;
previousHeader = nullptr;
currentLine = "";
readyFormattedLine = "";
formattedLine = "";
@@ -201,6 +208,7 @@ void ASFormatter::init(ASSourceIterator* si)
templateDepth = 0;
squareBracketCount = 0;
parenthesesCount = 0;
closingBracesCount = 0;
squeezeEmptyLineCount = 0;
runInIndentChars = 0;
@@ -310,6 +318,8 @@ void ASFormatter::init(ASSourceIterator* si)
isInHeader = false;
isInCase = false;
isInAllocator = false;
isInMultlineStatement = false;
isInExplicitBlock = 0;
isFirstPreprocConditional = false;
processedFirstConditional = false;
@@ -410,7 +420,7 @@ void ASFormatter::fixOptionVariableConflicts()
else if (formattingStyle == STYLE_1TBS)
{
setBraceFormatMode(LINUX_MODE);
setAddBracesMode(true);
setAddBracesMode(1);
setRemoveBracesMode(false);
}
else if (formattingStyle == STYLE_GOOGLE)
@@ -448,7 +458,7 @@ void ASFormatter::fixOptionVariableConflicts()
// only shouldAddBraces should be set to true
if (shouldAddOneLineBraces)
{
shouldAddBraces = true;
shouldAddBraces = 1;
shouldAddOneLineBraces = false;
}
}
@@ -854,7 +864,9 @@ std::string ASFormatter::nextLine()
}
else
{
isInLineBreak = true;
// GH16 only break if header is present
if (currentHeader)
isInLineBreak = true;
}
}
@@ -864,6 +876,7 @@ std::string ASFormatter::nextLine()
if (passedSemicolon) // need to break the formattedLine
{
isInAllocator = false; // GH16
isInMultlineStatement = false;
passedSemicolon = false;
if (parenStack->back() == 0 && !isCharImmediatelyPostComment && currentChar != ';') // allow ;;
{
@@ -1039,7 +1052,6 @@ std::string ASFormatter::nextLine()
squareBracketCount = 0;
objCColonAlign = 0;
}
}
// GH16 break
@@ -1052,9 +1064,12 @@ std::string ASFormatter::nextLine()
}
}
// handle braces
if (currentChar == '{' || currentChar == '}')
{
// if appendOpeningBrace this was already done for the original brace
if (currentChar == '{' && !appendOpeningBrace)
{
@@ -1079,6 +1094,9 @@ std::string ASFormatter::nextLine()
needHeaderOpeningBrace = false;
shouldKeepLineUnbroken = false;
returnTypeChecked = false;
isInExplicitBlock++;
objCColonAlign = 0;
methodBreakCharNum = std::string::npos;
@@ -1117,6 +1135,8 @@ std::string ASFormatter::nextLine()
shouldKeepLineUnbroken = false;
squareBracketCount = 0;
isInAllocator = false;
isInMultlineStatement = false;
isInExplicitBlock--;
if (braceTypeStack->size() > 1)
{
@@ -1132,6 +1152,7 @@ std::string ASFormatter::nextLine()
if (!preBraceHeaderStack->empty())
{
previousHeader = currentHeader;
currentHeader = preBraceHeaderStack->back();
preBraceHeaderStack->pop_back();
}
@@ -1177,6 +1198,19 @@ std::string ASFormatter::nextLine()
continue;
}
// #126
if ( currentChar == '*' && shouldPadOperators &&
pointerAlignment != PTR_ALIGN_TYPE && // SF 557
( currentHeader == &AS_IF || currentHeader == &AS_WHILE || currentHeader == &AS_DO || currentHeader == &AS_FOR)
&& ( previousChar == ')' || std::isalpha(previousChar) )
&& !isOperatorPaddingDisabled() ) {
appendSpacePad();
appendOperator(AS_MULT);
goForward(0);
appendSpaceAfter();
continue;
}
if ((((previousCommandChar == '{' && isPreviousBraceBlockRelated)
|| ((previousCommandChar == '}'
&& !isImmediatelyPostEmptyBlock
@@ -1305,7 +1339,7 @@ std::string ASFormatter::nextLine()
isAppendPostBlockEmptyLineRequested = false;
}
const std::string* previousHeader = currentHeader;
previousHeader = currentHeader;
currentHeader = newHeader;
needHeaderOpeningBrace = true;
@@ -1391,6 +1425,7 @@ std::string ASFormatter::nextLine()
}
}
// #569
if (shouldBreakBlocks
&& isOkToBreakBlock(braceTypeStack->back())
&& !isHeaderInMultiStatementLine)
@@ -1475,7 +1510,7 @@ std::string ASFormatter::nextLine()
if (previousNonWSChar == '}' || currentChar == ';')
{
if (currentChar == ';')
if (currentChar == ';' && !isInAsmBlock)
{
squareBracketCount = 0;
//assert(methodBreakCharNum == std::string::npos); // comment out
@@ -1501,7 +1536,7 @@ std::string ASFormatter::nextLine()
passedSemicolon = true;
}
//is set in struct case? #518
//is set in struct case? #518 #569
if (shouldBreakBlocks
&& currentHeader != nullptr
&& currentHeader != &AS_CASE
@@ -1584,8 +1619,9 @@ std::string ASFormatter::nextLine()
if (isPotentialHeader && !isInTemplate)
{
if (findKeyword(currentLine, charNum, AS_NEW)
|| findKeyword(currentLine, charNum, AS_DELETE))
//GL30
if (!isGHCStyle() && (findKeyword(currentLine, charNum, AS_NEW)
|| findKeyword(currentLine, charNum, AS_DELETE)))
{
isInPotentialCalculation = false;
isImmediatelyPostNewDelete = true;
@@ -1718,14 +1754,14 @@ std::string ASFormatter::nextLine()
isSharpDelegate = true;
// append the entire name
std::string name = getCurrentWord(currentLine, charNum);
std::string_view name = getCurrentWord(currentLine, charNum);
// must pad the 'and' and 'or' operators if required
if (name == "and" || name == "or")
{
if (shouldPadOperators && previousNonWSChar != ':')
{
appendSpacePad();
appendOperator(name);
appendOperator(std::string(name));
goForward(name.length() - 1);
if (!isBeforeAnyComment()
&& !(currentLine.compare(charNum + 1, 1, AS_SEMICOLON) == 0)
@@ -1734,13 +1770,13 @@ std::string ASFormatter::nextLine()
}
else
{
appendOperator(name);
appendOperator(std::string(name));
goForward(name.length() - 1);
}
}
else
{
appendSequence(name);
appendSequence(std::string(name));
goForward(name.length() - 1);
}
@@ -1861,7 +1897,7 @@ std::string ASFormatter::nextLine()
continue;
}
if (shouldPadOperators && newHeader != nullptr && !isOperatorPaddingDisabled())
if ((shouldPadOperators || negationPadMode!=NEGATION_PAD_NO_CHANGE) && newHeader != nullptr && !isOperatorPaddingDisabled())
{
padOperators(newHeader);
continue;
@@ -1941,7 +1977,9 @@ std::string ASFormatter::nextLine()
continue;
}
if ((currentChar == '[' || currentChar == ']' ) && (shouldPadBracketsOutside || shouldPadBracketsInside || shouldUnPadBrackets) )
//GL31
bool isDoubleOpenBrackets = isGHCStyle() && currentChar=='[' && peekNextChar() == '[';
if ((currentChar == '[' || currentChar == ']' ) && (shouldPadBracketsOutside || shouldPadBracketsInside || shouldUnPadBrackets) && !isDoubleOpenBrackets)
{
padParensOrBrackets('[', ']', shouldPadBracketsOutside, shouldPadBracketsInside, shouldUnPadBrackets, false);
continue;
@@ -2039,12 +2077,13 @@ void ASFormatter::setFormattingStyle(FormatStyle style)
/**
* set the add braces mode.
* options:
* true braces added to headers for single line statements.
* false braces NOT added to headers for single line statements.
* 2 braces added to headers for (nested) single line statements.
* 1 braces added to headers for single line statements.
* 0 braces NOT added to headers for single line statements.
*
* @param state the add braces state.
*/
void ASFormatter::setAddBracesMode(bool state)
void ASFormatter::setAddBracesMode(int state)
{
shouldAddBraces = state;
}
@@ -2059,7 +2098,7 @@ void ASFormatter::setAddBracesMode(bool state)
*/
void ASFormatter::setAddOneLineBracesMode(bool state)
{
shouldAddBraces = state;
shouldAddBraces = state ? 1 : 0;
shouldAddOneLineBraces = state;
}
@@ -2192,6 +2231,15 @@ void ASFormatter::setOperatorPaddingMode(bool state)
shouldPadOperators = state;
}
/**
* set negation padding mode.
* @param state the padding mode.
*/
void ASFormatter::setNegationPaddingMode(NegationPaddingMode mode)
{
negationPadMode = mode;
}
/**
* set parenthesis outside padding mode.
* options:
@@ -2257,6 +2305,19 @@ void ASFormatter::setParensFirstPaddingMode(bool state)
shouldPadFirstParen = state;
}
/**
* set padding mode for empty parentheses.
* options:
* true padding will be applied
* false no padding (default)
*
* @param state the padding mode.
*/
void ASFormatter::setEmptyParensPaddingMode(bool state)
{
shouldPadEmptyParens = state;
}
/**
* set header padding mode.
* options:
@@ -2768,6 +2829,12 @@ bool ASFormatter::getNextLine(bool emptyLineWasDeleted /*false*/)
if (currentLine.length() == 0)
{
//#574 avoid deletion of empüty lines after continuation
if (!isInComment && previousNonWSChar == '\\')
{
return false;
}
isInContinuedPreProc = false;
currentLine = std::string(" "); // a null is inserted if this is not done
}
@@ -2993,7 +3060,7 @@ void ASFormatter::appendChar(char ch, bool canBreakLine)
* @param sequence the sequence to append.
* @param canBreakLine if true, a registered line-break
*/
void ASFormatter::appendSequence(const std::string& sequence, bool canBreakLine)
void ASFormatter::appendSequence(std::string_view sequence, bool canBreakLine)
{
if (canBreakLine && isInLineBreak)
breakLine();
@@ -3009,7 +3076,7 @@ void ASFormatter::appendSequence(const std::string& sequence, bool canBreakLine)
* @param sequence the sequence to append.
* @param canBreakLine if true, a registered line-break
*/
void ASFormatter::appendOperator(const std::string& sequence, bool canBreakLine)
void ASFormatter::appendOperator(std::string_view sequence, bool canBreakLine)
{
if (canBreakLine && isInLineBreak)
breakLine();
@@ -3136,6 +3203,7 @@ BraceType ASFormatter::getBraceType()
returnVal = (BraceType)(ARRAY_TYPE | ENUM_TYPE);
}
else if (isSharpStyle() &&
!isOneLineBlockReached(currentLine, charNum) &&
(currentHeader == &AS_IF || currentHeader == &AS_WHILE
|| currentHeader == &AS_USING || currentHeader == &AS_WHILE
|| currentHeader == &AS_FOR || currentHeader == &AS_FOREACH) ) { // GH16
@@ -3203,7 +3271,7 @@ BraceType ASFormatter::getBraceType()
return returnVal;
}
bool ASFormatter::isNumericVariable(const std::string& word) const
bool ASFormatter::isNumericVariable(std::string_view word) const
{
if (word == "bool"
|| word == "int"
@@ -3215,11 +3283,7 @@ bool ASFormatter::isNumericVariable(const std::string& word) const
|| word == "float"
|| (word.length() >= 4 // check end of word for _t
&& word.compare(word.length() - 2, 2, "_t") == 0)
// removed release 3.1
// || word == "Int32"
// || word == "UInt32"
// || word == "Int64"
// || word == "UInt64"
|| word == "BOOL"
|| word == "DWORD"
|| word == "HWND"
@@ -3246,19 +3310,10 @@ bool ASFormatter::isClassInitializer() const
// this should be similar to ASBeautifier::parseCurrentLine()
bool foundClassInitializer = false;
if (foundQuestionMark)
if (foundQuestionMark || parenStack->back() > 0 || isInEnum)
{
// do nothing special
}
else if (parenStack->back() > 0)
{
// found a 'for' loop or an objective-C statement
// so do nothing special
}
else if (isInEnum)
{
// found an enum with a base-type
}
else if (isCStyle()
&& !isInCase
&& (previousCommandChar == ')' || foundPreCommandHeader))
@@ -3274,7 +3329,7 @@ bool ASFormatter::isClassInitializer() const
*
* @return whether line is empty
*/
bool ASFormatter::isEmptyLine(const std::string& line) const
bool ASFormatter::isEmptyLine(std::string_view line) const
{
return line.find_first_not_of(" \t") == std::string::npos;
}
@@ -3341,8 +3396,14 @@ bool ASFormatter::isPointerOrReference() const
return false;
if ((foundCastOperator && nextChar == '>')
|| isPointerOrReferenceVariable(lastWord))
|| isPointerOrReferenceVariable(lastWord)) {
return true;
}
if (pointerAlignment == PTR_ALIGN_TYPE
&& !isPointerOrReferenceVariable(lastWord)) {
return false;
}
if (isInClassInitializer
&& previousNonWSChar != '('
@@ -3370,6 +3431,7 @@ bool ASFormatter::isPointerOrReference() const
return false;
return true;
}
if (nextChar == '*'
|| previousNonWSChar == '='
|| previousNonWSChar == '('
@@ -3379,8 +3441,10 @@ bool ASFormatter::isPointerOrReference() const
|| isCharImmediatelyPostTemplate
|| currentHeader == &AS_CATCH
|| currentHeader == &AS_FOREACH
|| currentHeader == &AS_QFOREACH)
|| currentHeader == &AS_QFOREACH) {
return true;
}
if (isBraceType(braceTypeStack->back(), ARRAY_TYPE)
&& isLegalNameChar(lastWord[0])
@@ -3403,8 +3467,10 @@ bool ASFormatter::isPointerOrReference() const
&& followingOperator != &AS_MULT
&& followingOperator != &AS_BIT_AND)
{
if (followingOperator == &AS_ASSIGN || followingOperator == &AS_COLON)
if (followingOperator == &AS_ASSIGN || followingOperator == &AS_COLON) {
return true;
}
return false;
}
@@ -3415,14 +3481,11 @@ bool ASFormatter::isPointerOrReference() const
}
// checks on operators in parens with following '('
std::set<char> disallowedChars = {',', '(', '!', '&', '*', '|'};
if (parenStack->back() > 0
&& nextChar == '('
&& previousNonWSChar != ','
&& previousNonWSChar != '('
&& previousNonWSChar != '!'
&& previousNonWSChar != '&'
&& previousNonWSChar != '*'
&& previousNonWSChar != '|')
&& disallowedChars.find(previousNonWSChar) == disallowedChars.end())
return false;
if (nextChar == '-'
@@ -3474,13 +3537,10 @@ bool ASFormatter::isDereferenceOrAddressOf() const
return false;
}
if (previousNonWSChar == '='
std::set<char> allowedChars = {'=', '.', '{', '>', '<', '?'};
if ( allowedChars.find(previousNonWSChar) != allowedChars.end()
|| (previousNonWSChar == ',' && currentChar == '&') // #537, #552
|| previousNonWSChar == '.'
|| previousNonWSChar == '{'
|| previousNonWSChar == '>'
|| previousNonWSChar == '<'
|| previousNonWSChar == '?'
|| isCharImmediatelyPostLineComment
|| isCharImmediatelyPostComment
|| isCharImmediatelyPostReturn)
@@ -3505,6 +3565,10 @@ bool ASFormatter::isDereferenceOrAddressOf() const
return false;
}
if (previousNonWSChar == '(' && currentChar == '&' && pointerAlignment == PTR_ALIGN_TYPE) {
return true;
}
// check first char on the line
if (charNum == (int) currentLine.find_first_not_of(" \t")
&& (isBraceType(braceTypeStack->back(), COMMAND_TYPE)
@@ -3531,12 +3595,12 @@ bool ASFormatter::isDereferenceOrAddressOf() const
std::string lastWord = getPreviousWord(currentLine, charNum);
if (lastWord == "else" || lastWord == "delete")
return true;
if (isPointerOrReferenceVariable(lastWord))
return false;
bool isDA = (!(isLegalNameChar(previousNonWSChar) || previousNonWSChar == '>') // TODO GH14
|| (nextText.length() > 0 && !isLegalNameChar(nextText[0]) && nextText[0] != '/')
|| (ispunct((unsigned char)previousNonWSChar) && previousNonWSChar != '.') // TODO GH14
|| isCharImmediatelyPostReturn);
|| isCharImmediatelyPostReturn
|| !isPointerOrReferenceVariable(lastWord));
return isDA;
}
@@ -3593,21 +3657,31 @@ bool ASFormatter::isPointerOrReferenceCentered() const
*
* @return whether word is a pointer or reference variable.
*/
bool ASFormatter::isPointerOrReferenceVariable(const std::string& word) const
bool ASFormatter::isPointerOrReferenceVariable(std::string_view word) const
{
assert(currentChar == '*' || currentChar == '&' || currentChar == '^');
bool retval = false;
if (word == "char"
|| word == "std::string"
|| word == "String"
|| word == "NSString"
|| word == "int"
|| word == "void"
|| (word.length() >= 6 // check end of word for _t
&& word.compare(word.length() - 2, 2, "_t") == 0)
|| word == "INT"
|| word == "VOID")
retval = true;
// to avoid problem with multiplications - we need LSP
for (char c: word){
if (isLegalNameChar(c)) {
retval = true;
break;
}
}
if (currentChar == '&' &&
(currentHeader == &AS_IF
|| currentHeader == &AS_ELSE
|| currentHeader == &AS_FOR
|| currentHeader == &AS_WHILE
|| currentHeader == &AS_DO)) {
retval = false;
}
if (pointerAlignment == PTR_ALIGN_TYPE) {
return retval;
}
// check for C# object type "x is std::string"
if (retval && isSharpStyle())
@@ -3620,6 +3694,7 @@ bool ASFormatter::isPointerOrReferenceVariable(const std::string& word) const
if (prevWord == "is")
retval = false;
}
return retval;
}
@@ -3628,7 +3703,7 @@ bool ASFormatter::isPointerOrReferenceVariable(const std::string& word) const
*
* @return true if a pointer *.
*/
bool ASFormatter::isPointerToPointer(const std::string& line, int currPos) const
bool ASFormatter::isPointerToPointer(std::string_view line, int currPos) const
{
assert(line[currPos] == '*' && peekNextChar() == '*');
if ((int) line.length() > currPos + 1 && line[currPos + 1] == '*')
@@ -3707,13 +3782,19 @@ bool ASFormatter::isInSwitchStatement() const
bool ASFormatter::isInExponent() const
{
assert(currentChar == '+' || currentChar == '-');
std::string prevWord = getPreviousWord(currentLine, charNum, true);
if (charNum >= 2)
if (charNum && isDigit(prevWord[0])) {
return prevWord.find_first_not_of("0123456789.") != std::string::npos;
}
if (charNum > 2 && prevWord.size()>=2 && prevWord[0]=='0' && (prevWord[1]=='x' || prevWord[1]=='X'))
{
char prevPrevFormattedChar = currentLine[charNum - 2];
char prevFormattedChar = currentLine[charNum - 1];
return ((prevFormattedChar == 'e' || prevFormattedChar == 'E')
&& (prevPrevFormattedChar == '.' || isDigit(prevPrevFormattedChar)));
// double x = 0x1.23ffp-11;
return ((prevFormattedChar == 'e' || prevFormattedChar == 'E' || prevFormattedChar == 'p' || prevFormattedChar == 'P')
&& (prevPrevFormattedChar == '.' || std::isxdigit(prevPrevFormattedChar)));
}
return false;
}
@@ -3755,7 +3836,7 @@ bool ASFormatter::isNonInStatementArrayBrace() const
* 2 = one-line block has been reached and is followed by a comma.
* 3 = one-line block has been reached and is an empty block.
*/
int ASFormatter::isOneLineBlockReached(const std::string& line, int startChar) const
int ASFormatter::isOneLineBlockReached(std::string_view line, int startChar) const
{
assert(line[startChar] == '{');
@@ -4007,13 +4088,13 @@ bool ASFormatter::isMultiStatementLine() const
* @param firstLine the first line to check
* @return the next non-whitespace substd::string.
*/
std::string ASFormatter::peekNextText(const std::string& firstLine,
std::string ASFormatter::peekNextText(std::string_view firstLine,
bool endOnEmptyLine /*false*/,
const std::shared_ptr<ASPeekStream>& streamArg /*nullptr*/) const
{
assert(sourceIterator->getPeekStart() == 0 || streamArg != nullptr); // Borland may need != 0
bool isFirstLine = true;
std::string nextLine_ = firstLine;
std::string nextLine_(firstLine);
size_t firstChar = std::string::npos;
std::shared_ptr<ASPeekStream> stream = streamArg;
if (stream == nullptr) // Borland may need == 0
@@ -4166,14 +4247,17 @@ void ASFormatter::appendCharInsideComments()
*/
void ASFormatter::padOperators(const std::string* newOperator)
{
assert(shouldPadOperators);
assert(shouldPadOperators || negationPadMode != NEGATION_PAD_NO_CHANGE);
assert(newOperator != nullptr);
char nextNonWSChar = ASBase::peekNextChar(currentLine, charNum);
std::set<char> allowedChars = {'(', '[', '=', ',', ':', '{'};
// #566
bool shouldPad = (newOperator != &AS_SCOPE_RESOLUTION
&& newOperator != &AS_PLUS_PLUS
&& newOperator != &AS_MINUS_MINUS
&& newOperator != &AS_NOT
&& (newOperator != &AS_NOT || negationPadMode != NEGATION_PAD_NO_CHANGE) // TODO 571
&& newOperator != &AS_BIT_NOT
&& newOperator != &AS_ARROW
&& !(newOperator == &AS_COLON && !foundQuestionMark // objC methods
@@ -4183,12 +4267,7 @@ void ASFormatter::padOperators(const std::string* newOperator)
&& !(newOperator == &AS_PLUS && isInExponent())
&& !(newOperator == &AS_GR && previousChar == '-') //https://sourceforge.net/p/astyle/bugs/544/
&& !((newOperator == &AS_PLUS || newOperator == &AS_MINUS) // check for unary plus or minus
&& (previousNonWSChar == '('
|| previousNonWSChar == '['
|| previousNonWSChar == '='
|| previousNonWSChar == ','
|| previousNonWSChar == ':'
|| previousNonWSChar == '{'))
&& (allowedChars.find(previousNonWSChar) != allowedChars.end()))
&& !(newOperator == &AS_MULT
&& (previousNonWSChar == '.'
|| previousNonWSChar == '>')) // check for ->
@@ -4216,6 +4295,7 @@ void ASFormatter::padOperators(const std::string* newOperator)
// pad before operator
if (shouldPad
&& (newOperator != &AS_NOT || (newOperator == &AS_NOT && negationPadMode == NEGATION_PAD_BEFORE ) )
&& !(newOperator == &AS_COLON
&& (!foundQuestionMark && !isInEnum) && currentHeader != &AS_FOR)
&& !(newOperator == &AS_QUESTION && isSharpStyle() // check for C# nullable type (e.g. int?)
@@ -4354,7 +4434,7 @@ void ASFormatter::formatPointerOrReferenceToType()
}
// https://sourceforge.net/p/astyle/bugs/537/
if (previousNonWSChar == ',' && currentChar != ' ')
if ((previousNonWSChar == ',' || previousNonWSChar == '[') && currentChar != ' ')
appendSpacePad();
formattedLine.append(sequenceToInsert);
@@ -4402,6 +4482,7 @@ void ASFormatter::formatPointerOrReferenceToMiddle()
else
wsBefore = charNum - wsBefore - 1;
std::string sequenceToInsert(1, currentChar);
if (currentChar == peekNextChar())
{
for (size_t i = charNum + 1; currentLine.length() > i; i++)
@@ -4417,6 +4498,7 @@ void ASFormatter::formatPointerOrReferenceToMiddle()
}
// if reference to a pointer check for conflicting alignment
else if (currentChar == '*' && peekNextChar() == '&'
&& ASBeautifier::peekNextChar(currentLine, charNum + 1) != '&'
&& (referenceAlignment == REF_ALIGN_TYPE
|| referenceAlignment == REF_ALIGN_MIDDLE
|| referenceAlignment == REF_SAME_AS_PTR))
@@ -4542,7 +4624,7 @@ void ASFormatter::formatPointerOrReferenceToName()
// if reference to a pointer align both to name
else if (currentChar == '*' && peekNextChar() == '&')
else if (currentChar == '*' && peekNextChar() == '&' && ASBeautifier::peekNextChar(currentLine, charNum + 1) != '&')
{
sequenceToInsert = "*&";
goForward(1);
@@ -4791,11 +4873,12 @@ void ASFormatter::padParensOrBrackets(char openDelim, char closeDelim, bool shou
// pad open paren outside
char peekedCharOutside = peekNextChar();
if (shouldPadFirstParen && previousChar != openDelim && peekedCharOutside != closeDelim)
if (shouldPadFirstParen && ( (previousChar != openDelim && peekedCharOutside != closeDelim) || shouldPadEmptyParens ) )
appendSpacePad();
else if (shouldPadParensOutside)
{
if (!(currentChar == openDelim && peekedCharOutside == closeDelim))
// GH19
if (!(currentChar == openDelim && peekedCharOutside == closeDelim) || shouldPadEmptyParens)
appendSpacePad();
}
@@ -5073,6 +5156,8 @@ void ASFormatter::formatOpeningBrace(BraceType braceType)
bool breakBrace = isCurrentBraceBroken();
//478
if (breakBrace)
{
if (isBeforeAnyComment() && isOkToBreakBlock(braceType) && sourceIterator->hasMoreLines())
@@ -5268,8 +5353,15 @@ void ASFormatter::formatClosingBrace(BraceType braceType)
&& nextText.substr(0, 5) != "break")
isAppendPostBlockEmptyLineRequested = true;
}
else
isAppendPostBlockEmptyLineRequested = true;
else {
// GH18
// #569
isAppendPostBlockEmptyLineRequested = !(shouldBreakBlocks && shouldAttachClosingWhile)
|| currentHeader != &AS_DO;
}
} else {
isAppendPostBlockEmptyLineRequested = !currentHeader && shouldBreakBlocks;
}
}
@@ -5293,12 +5385,13 @@ void ASFormatter::formatArrayBraces(BraceType braceType, bool isOpeningArrayBrac
// is this the first opening brace in the array?
if (isOpeningArrayBrace)
{
if (braceFormatMode == ATTACH_MODE
|| braceFormatMode == LINUX_MODE)
if (braceFormatMode == ATTACH_MODE || braceFormatMode == LINUX_MODE)
{
// break an enum if mozilla
if (isBraceType(braceType, ENUM_TYPE)
&& formattingStyle == STYLE_MOZILLA)
&& formattingStyle == STYLE_MOZILLA
&& !(!shouldBreakOneLineBlocks && formattedLine.find('}' != std::string::npos) ) // GL38
)
{
isInLineBreak = true;
appendCurrentChar(); // don't attach
@@ -5741,7 +5834,7 @@ bool ASFormatter::isSharpStyleWithParen(const std::string* header) const
* firstLine must contain the start of the comment.
* return value is a pointer to the header or nullptr.
*/
const std::string* ASFormatter::checkForHeaderFollowingComment(const std::string& firstLine) const
const std::string* ASFormatter::checkForHeaderFollowingComment(std::string_view firstLine) const
{
assert(isInComment || isInLineComment);
assert(shouldBreakElseIfs || shouldBreakBlocks || isInSwitchStatement());
@@ -6371,7 +6464,9 @@ void ASFormatter::formatQuoteOpener()
isInQuote = true;
quoteChar = currentChar;
if (isCStyle() && previousChar == 'R')
char prevPrevCh = charNum > 2 ? currentLine[charNum - 2] : ' '; // GL39
if (isCStyle() && previousChar == 'R' && !isalpha(prevPrevCh))
{
int parenPos = currentLine.find('(', charNum);
if (parenPos != -1)
@@ -6465,7 +6560,7 @@ int ASFormatter::getCurrentLineCommentAdjustment()
*
* @return is the previous word or an empty std::string if none found.
*/
std::string ASFormatter::getPreviousWord(const std::string& line, int currPos) const
std::string ASFormatter::getPreviousWord(const std::string& line, int currPos, bool allowDots) const
{
// get the last legal word (may be a number)
if (currPos == 0)
@@ -6478,7 +6573,7 @@ std::string ASFormatter::getPreviousWord(const std::string& line, int currPos) c
int start; // start of the previous word
for (start = end; start > -1; start--)
{
if (!isLegalNameChar(line[start]) || line[start] == '.')
if (!isLegalNameChar(line[start]) || (!allowDots && line[start] == '.') )
break;
}
start++;
@@ -6556,7 +6651,7 @@ void ASFormatter::appendClosingHeader()
if (firstBrace != std::string::npos)
previousLineIsOneLineBlock = isOneLineBlockReached(formattedLine, firstBrace);
if (!previousLineIsEmpty
&& previousLineIsOneLineBlock == 0)
&& previousLineIsOneLineBlock == 0)
{
isInLineBreak = false;
appendSpacePad();
@@ -6574,14 +6669,14 @@ bool ASFormatter::addBracesToStatement()
assert(isImmediatelyPostHeader);
if (currentHeader != &AS_IF
&& currentHeader != &AS_ELSE
&& currentHeader != &AS_FOR
&& currentHeader != &AS_WHILE
&& currentHeader != &AS_DO
&& currentHeader != &AS_FOREACH
&& currentHeader != &AS_QFOREACH
&& currentHeader != &AS_QFOREVER
&& currentHeader != &AS_FOREVER)
&& currentHeader != &AS_ELSE
&& currentHeader != &AS_FOR
&& currentHeader != &AS_WHILE
&& currentHeader != &AS_DO
&& currentHeader != &AS_FOREACH
&& currentHeader != &AS_QFOREACH
&& currentHeader != &AS_QFOREVER
&& currentHeader != &AS_FOREVER)
return false;
if (currentHeader == &AS_WHILE && foundClosingHeader) // do-while
@@ -6591,23 +6686,105 @@ bool ASFormatter::addBracesToStatement()
if (currentChar == ';')
return false;
// do not add if a header follows
if (isCharPotentialHeader(currentLine, charNum))
if (findHeader(headers) != nullptr)
bool isLastElseBranch = shouldAddBraces == 2 && (previousHeader == &AS_IF && currentHeader == &AS_ELSE);
// old behavior
if (shouldAddBraces==1 || isLastElseBranch) {
// do not add if a header follows
if (isCharPotentialHeader(currentLine, charNum))
if (findHeader(headers) != nullptr)
return false;
// find the next semi-colon
size_t nextSemiColon = charNum;
if (currentChar != ';')
nextSemiColon = findNextChar(currentLine, ';', charNum + 1);
if (nextSemiColon == std::string::npos)
return false;
// find the next semi-colon
size_t nextSemiColon = charNum;
if (currentChar != ';')
nextSemiColon = findNextChar(currentLine, ';', charNum + 1);
if (nextSemiColon == std::string::npos)
return false;
// add closing brace before changing the line length
if (nextSemiColon == currentLine.length() - 1)
currentLine.append(" }");
else
currentLine.insert(nextSemiColon + 1, " }");
} else { // nested single line statements
if (isInExplicitBlock > 1 && !closingBracesCount) {
return false;
}
// find the next semi-colon
size_t nextSemiColon = charNum;
if (currentChar != ';')
nextSemiColon = findNextChar(currentLine, ';', charNum + 1);
bool currentIsForHeader = false;
if (nextSemiColon != std::string::npos) {
if (isCharPotentialHeader(currentLine, (int) currentLine.find_first_not_of(" \t") )) {
if (findHeader(headers) == &AS_FOR) {
currentIsForHeader = true;
--closingBracesCount;
}
}
// add closing brace before changing the line length
++closingBracesCount;
if (!currentIsForHeader)
while (closingBracesCount--) {
if (nextSemiColon == currentLine.length() - 1)
currentLine.append(" }");
else
currentLine.insert(nextSemiColon + 1, " }");
}
}
++closingBracesCount;
nextSemiColon = currentLine.find('{');
if (nextSemiColon != std::string::npos){
--closingBracesCount;
return false;
} else {
ASPeekStream stream(sourceIterator);
// loop until { or other symbol is found
while (stream.hasMoreLines()) {
std::string nextLine = ASBeautifier::trim(stream.peekNextLine());
if (nextLine.empty())
continue;
if (nextLine[0] == '{' || nextLine[nextLine.size()-1] == '{') {
--closingBracesCount;
return false;
}
if (isCharPotentialHeader(nextLine, 0) && ASBase::findHeader(nextLine, 0, headers) != nullptr ) {
break;
}
// this breaks normal if else blocks
if (nextLine[nextLine.size()-1] != ';' && nextLine[nextLine.size()-1] != '}') {
isInMultlineStatement = true;
continue;
}
if (isInMultlineStatement) {
--closingBracesCount;
return false;
}
break;
}
}
}
// add closing brace before changing the line length
if (nextSemiColon == currentLine.length() - 1)
currentLine.append(" }");
else
currentLine.insert(nextSemiColon + 1, " }");
// add opening brace
currentLine.insert(charNum, "{ ");
assert(computeChecksumIn("{}"));
@@ -6717,7 +6894,7 @@ bool ASFormatter::removeBracesFromStatement()
* @param searchStart the start position on the line (default is 0).
* @return the position on the line or std::string::npos if not found.
*/
size_t ASFormatter::findNextChar(const std::string& line, char searchChar, int searchStart /*0*/) const
size_t ASFormatter::findNextChar(std::string_view line, char searchChar, int searchStart /*0*/) const
{
// find the next searchChar
size_t i;
@@ -7132,7 +7309,7 @@ bool ASFormatter::isStructAccessModified(const std::string& firstLine, size_t in
|| findKeyword(nextLine_, i, AS_PRIVATE)
|| findKeyword(nextLine_, i, AS_PROTECTED))
return true;
std::string name = getCurrentWord(nextLine_, i);
std::string_view name = getCurrentWord(nextLine_, i);
i += name.length() - 1;
}
} // end of for loop
@@ -7302,7 +7479,7 @@ EndOfWhileLoop:
return isInIndentableBlock;
}
bool ASFormatter::isNDefPreprocStatement(const std::string& nextLine_, const std::string& preproc) const
bool ASFormatter::isNDefPreprocStatement(std::string_view nextLine_, std::string_view preproc) const
{
if (preproc == "ifndef")
return true;
@@ -7326,14 +7503,14 @@ bool ASFormatter::isNDefPreprocStatement(const std::string& nextLine_, const std
* @param index the current line index.
* @return true if the statement is EXEC SQL.
*/
bool ASFormatter::isExecSQL(const std::string& line, size_t index) const
bool ASFormatter::isExecSQL(std::string_view line, size_t index) const
{
if (line[index] != 'e' && line[index] != 'E') // quick check to reject most
return false;
std::string word;
std::string_view word;
if (isCharPotentialHeader(line, index))
word = getCurrentWord(line, index);
for (char& character : word)
for (char character : word)
character = (char) toupper(character);
if (word != "EXEC")
return false;
@@ -7341,12 +7518,14 @@ bool ASFormatter::isExecSQL(const std::string& line, size_t index) const
index2 = line.find_first_not_of(" \t", index2);
if (index2 == std::string::npos)
return false;
word.erase();
std::string_view word2;
if (isCharPotentialHeader(line, index2))
word = getCurrentWord(line, index2);
for (char& character : word)
word2 = getCurrentWord(line, index2);
for (char character : word2)
character = (char) toupper(character);
if (word != "SQL")
if (word2 != "SQL")
return false;
return true;
}
@@ -7591,7 +7770,7 @@ void ASFormatter::checkIfTemplateOpener()
templateDepth = 0;
return;
}
std::string name = getCurrentWord(nextLine_, i);
std::string_view name = getCurrentWord(nextLine_, i);
i += name.length() - 1;
} // end for loop
} // end while loop
@@ -7701,7 +7880,7 @@ void ASFormatter::updateFormattedLineSplitPoints(char appendedChar)
}
}
void ASFormatter::updateFormattedLineSplitPointsOperator(const std::string& sequence)
void ASFormatter::updateFormattedLineSplitPointsOperator(std::string_view sequence)
{
assert(maxCodeLength != std::string::npos);
assert(formattedLine.length() > 0);
@@ -8023,9 +8202,9 @@ bool ASFormatter::pointerSymbolFollows() const
* Compute the input checksum.
* This is called as an assert so it for is debug config only
*/
bool ASFormatter::computeChecksumIn(const std::string& currentLine_)
bool ASFormatter::computeChecksumIn(std::string_view currentLine_)
{
for (const char& character : currentLine_)
for (const char character : currentLine_)
if (!isWhiteSpace(character))
checksumIn += character;
return true;
@@ -8055,9 +8234,9 @@ size_t ASFormatter::getChecksumIn() const
* Compute the output checksum.
* This is called as an assert so it is for debug config only
*/
bool ASFormatter::computeChecksumOut(const std::string& beautifiedLine)
bool ASFormatter::computeChecksumOut(std::string_view beautifiedLine)
{
for (const char& character : beautifiedLine)
for (const char character : beautifiedLine)
if (!isWhiteSpace(character))
checksumOut += character;
return true;
+17 -16
View File
@@ -159,6 +159,7 @@ const std::string ASResource::AS_BIT_XOR = std::string("^");
const std::string ASResource::AS_QUESTION = std::string("?");
const std::string ASResource::AS_COLON = std::string(":");
const std::string ASResource::AS_COMMA = std::string(",");
const std::string ASResource::AS_DOT = std::string(".");
const std::string ASResource::AS_SEMICOLON = std::string(";");
@@ -314,8 +315,6 @@ void ASResource::buildHeaders(std::vector<const std::string*>* headers, int file
void ASResource::buildIndentableHeaders(std::vector<const std::string*>* indentableHeaders)
{
indentableHeaders->emplace_back(&AS_RETURN);
// sort(indentableHeaders->begin(), indentableHeaders->end(), sortOnName);
}
/**
@@ -357,7 +356,7 @@ void ASResource::buildIndentableMacros(std::vector<const std::pair<const std::st
*/
void ASResource::buildNonAssignmentOperators(std::vector<const std::string*>* nonAssignmentOperators)
{
const size_t elements = 15;
const size_t elements = 16;
nonAssignmentOperators->reserve(elements);
nonAssignmentOperators->emplace_back(&AS_EQUAL);
@@ -374,6 +373,7 @@ void ASResource::buildNonAssignmentOperators(std::vector<const std::string*>* no
nonAssignmentOperators->emplace_back(&AS_AND);
nonAssignmentOperators->emplace_back(&AS_OR);
nonAssignmentOperators->emplace_back(&AS_LAMBDA);
nonAssignmentOperators->emplace_back(&AS_DOT);
assert(nonAssignmentOperators->size() < elements);
sort(nonAssignmentOperators->begin(), nonAssignmentOperators->end(), sortOnLength);
@@ -631,7 +631,7 @@ void ASResource::buildPreDefinitionHeaders(std::vector<const std::string*>* preD
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// check if a specific line position contains a header.
const std::string* ASBase::findHeader(const std::string& line, int i,
const std::string* ASBase::findHeader(std::string_view line, int i,
const std::vector<const std::string*>* possibleHeaders) const
{
assert(isCharPotentialHeader(line, i));
@@ -663,7 +663,7 @@ const std::string* ASBase::findHeader(const std::string& line, int i,
if ((header == &AS_GET
|| header == &AS_SET
|| header == &AS_DEFAULT)
&& (peekChar == ';' || peekChar == '(' || peekChar == '='))
&& (peekChar == '.' || peekChar == ';' || peekChar == '(' || peekChar == '='))
break;
return header;
}
@@ -671,9 +671,8 @@ const std::string* ASBase::findHeader(const std::string& line, int i,
}
// check if a specific line position contains a keyword.
bool ASBase::findKeyword(const std::string& line, int i, const std::string& keyword) const
bool ASBase::findKeyword(std::string_view line, int i, std::string_view keyword) const
{
//std::cerr << "findKeyword "<< i << " "<< line << " -< "<< keyword << "\n";
assert(isCharPotentialHeader(line, i));
// check the word
const size_t keywordLength = keyword.length();
@@ -701,7 +700,7 @@ bool ASBase::findKeyword(const std::string& line, int i, const std::string& keyw
}
// check if a specific line position contains an operator.
const std::string* ASBase::findOperator(const std::string& line, int i,
const std::string* ASBase::findOperator(std::string_view line, int i,
const std::vector<const std::string*>* possibleOperators) const
{
assert(isCharPotentialOperator(line[i]));
@@ -722,14 +721,16 @@ const std::string* ASBase::findOperator(const std::string& line, int i,
// get the current word on a line
// index must point to the beginning of the word
std::string ASBase::getCurrentWord(const std::string& line, size_t index) const
std::string_view ASBase::getCurrentWord(std::string_view line, size_t index) const
{
assert(isCharPotentialHeader(line, index));
//assert(isCharPotentialHeader(line, index));
size_t lineLength = line.length();
size_t i;
for (i = index; i < lineLength; i++)
{
if (!isLegalNameChar(line[i]))
if (!isLegalNameChar(line[i])
|| ( (isCStyle() || isJavaStyle()) && i > index && line[i]=='.')
)
break;
}
return line.substr(index, i - index);
@@ -743,14 +744,14 @@ bool ASBase::isLegalNameChar(char ch) const
if ((unsigned char) ch > 127)
return false;
return (isalnum((unsigned char) ch)
|| (!isSharpStyle() && ch == '.')
|| ch == '_'
|| ch == '_'
|| (!isSharpStyle() && ch == '.' )
|| (isJavaStyle() && ch == '$')
|| (isSharpStyle() && ch == '@')); // may be used as a prefix
}
// check if a specific character can be part of a header
bool ASBase::isCharPotentialHeader(const std::string& line, size_t i) const
bool ASBase::isCharPotentialHeader(std::string_view line, size_t i) const
{
assert(!isWhiteSpace(line[i]));
char prevCh = ' ';
@@ -786,7 +787,7 @@ bool ASBase::isDigit(char ch) const
}
// check if a specific character is a digit separator
bool ASBase::isDigitSeparator(const std::string& line, int i) const
bool ASBase::isDigitSeparator(std::string_view line, int i) const
{
assert(line[i] == '\'');
// casting to (unsigned char) eliminates negative characters
@@ -799,7 +800,7 @@ bool ASBase::isDigitSeparator(const std::string& line, int i) const
}
// peek at the next unread character.
char ASBase::peekNextChar(const std::string& line, int i) const
char ASBase::peekNextChar(std::string_view line, int i) const
{
char ch = ' ';
size_t peekNum = line.find_first_not_of(" \t", i + 1);
+94 -61
View File
@@ -21,6 +21,7 @@
#include <iostream> // for cout
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#ifdef __GNUC__
@@ -52,6 +53,8 @@
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
#define ASTYLE_VERSION "3.5"
//-----------------------------------------------------------------------------
// astyle namespace
//-----------------------------------------------------------------------------
@@ -62,7 +65,7 @@ namespace astyle {
// definitions
//----------------------------------------------------------------------------
enum FileType { C_TYPE = 0, JAVA_TYPE = 1, SHARP_TYPE = 2, JS_TYPE = 3, OBJC_TYPE = 4, INVALID_TYPE = -1 };
enum FileType { C_TYPE = 0, JAVA_TYPE = 1, SHARP_TYPE = 2, JS_TYPE = 3, OBJC_TYPE = 4, GHC_TYPE = 5, INVALID_TYPE = -1 };
/* The enums below are not recognized by 'vectors' in Microsoft Visual C++
V5 when they are part of a namespace!!! Use Visual C++ V6 or higher.
@@ -173,6 +176,13 @@ enum LineEndFormat
LINEEND_CR = LINEEND_MACOLD
};
enum NegationPaddingMode
{
NEGATION_PAD_NO_CHANGE,
NEGATION_PAD_AFTER,
NEGATION_PAD_BEFORE
};
//-----------------------------------------------------------------------------
// Class ASSourceIterator
// A pure virtual class is used by ASFormatter and ASBeautifier instead of
@@ -277,7 +287,7 @@ public:
static const std::string AS_SCOPE_RESOLUTION;
static const std::string AS_PLUS, AS_MINUS, AS_MULT, AS_DIV, AS_MOD, AS_GR, AS_LS;
static const std::string AS_NOT, AS_BIT_XOR, AS_BIT_OR, AS_BIT_AND, AS_BIT_NOT;
static const std::string AS_QUESTION, AS_COLON, AS_SEMICOLON, AS_COMMA;
static const std::string AS_QUESTION, AS_COLON, AS_SEMICOLON, AS_COMMA, AS_DOT;
static const std::string AS_ASM, AS__ASM__, AS_MS_ASM, AS_MS__ASM;
static const std::string AS_QFOREACH, AS_QFOREVER, AS_FOREVER;
static const std::string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED;
@@ -303,28 +313,28 @@ protected:
protected: // inline functions
void init(int fileTypeArg) { baseFileType = fileTypeArg; }
bool isCStyle() const { return baseFileType == C_TYPE || baseFileType == OBJC_TYPE; }
bool isCStyle() const { return baseFileType == C_TYPE || baseFileType == OBJC_TYPE || baseFileType == GHC_TYPE; }
bool isJavaStyle() const { return baseFileType == JAVA_TYPE; }
bool isSharpStyle() const { return baseFileType == SHARP_TYPE; }
bool isJSStyle() const { return baseFileType == JS_TYPE; }
bool isObjCStyle() const { return baseFileType == OBJC_TYPE; }
bool isGHCStyle() const { return baseFileType == GHC_TYPE; }
bool isWhiteSpace(char ch) const { return (ch == ' ' || ch == '\t'); }
protected: // functions definitions are at the end of ASResource.cpp
const std::string* findHeader(const std::string& line, int i,
const std::string* findHeader(std::string_view line, int i,
const std::vector<const std::string*>* possibleHeaders) const;
bool findKeyword(const std::string& line, int i, const std::string& keyword) const;
const std::string* findOperator(const std::string& line, int i,
bool findKeyword(std::string_view line, int i, std::string_view keyword) const;
const std::string* findOperator(std::string_view line, int i,
const std::vector<const std::string*>* possibleOperators) const;
std::string getCurrentWord(const std::string& line, size_t index) const;
std::string_view getCurrentWord(std::string_view, size_t index) const;
bool isDigit(char ch) const;
bool isLegalNameChar(char ch) const;
bool isCharPotentialHeader(const std::string& line, size_t i) const;
bool isCharPotentialHeader(std::string_view line, size_t i) const;
bool isCharPotentialOperator(char ch) const;
bool isDigitSeparator(const std::string& line, int i) const;
char peekNextChar(const std::string& line, int i) const;
bool isDigitSeparator(std::string_view line, int i) const;
char peekNextChar(std::string_view line, int i) const;
}; // Class ASBase
//-----------------------------------------------------------------------------
@@ -355,6 +365,8 @@ public:
void setJSStyle();
void setObjCStyle();
void setSharpStyle();
void setGHCStyle();
void setLabelIndent(bool state);
void setMaxContinuationIndentLength(int max);
@@ -393,14 +405,14 @@ public:
protected:
void deleteBeautifierVectors();
int getNextProgramCharDistance(const std::string& line, int i) const;
int getNextProgramCharDistance(std::string_view line, int i) const;
int indexOf(const std::vector<const std::string*>& container, const std::string* element) const;
void setBlockIndent(bool state);
void setBraceIndent(bool state);
void setBraceIndentVtk(bool state);
std::string extractPreprocessorStatement(const std::string& line) const;
std::string trim(const std::string& str) const;
std::string rtrim(const std::string& str) const;
std::string extractPreprocessorStatement(std::string_view line) const;
std::string trim(std::string_view str) const;
std::string rtrim(std::string_view str) const;
// variables set by ASFormatter - must be updated in activeBeautifierStack
int inLineNumber;
@@ -421,16 +433,16 @@ protected:
private: // functions
void adjustObjCMethodDefinitionIndentation(const std::string& line_);
void adjustObjCMethodCallIndentation(const std::string& line_);
void adjustObjCMethodDefinitionIndentation(std::string_view line_);
void adjustObjCMethodCallIndentation(std::string_view line_);
void adjustParsedLineIndentation(size_t iPrelim, bool isInExtraHeaderIndent);
void computePreliminaryIndentation();
void parseCurrentLine(const std::string& line);
void computePreliminaryIndentation(std::string_view line);
void parseCurrentLine(std::string_view line);
void popLastContinuationIndent();
void processPreprocessor(const std::string& preproc, const std::string& line);
void registerContinuationIndent(const std::string& line, int i, int spaceIndentCount_,
void processPreprocessor(std::string_view preproc, std::string_view line);
void registerContinuationIndent(std::string_view line, int i, int spaceIndentCount_,
int tabIncrementIn, int minIndent, bool updateParenStack);
void registerContinuationIndentColon(const std::string& line, int i, int tabIncrementIn);
void registerContinuationIndentColon(std::string_view line, int i, int tabIncrementIn);
void initVectors();
void initTempStacksContainer(std::vector<std::vector<const std::string*>*>*& container,
std::vector<std::vector<const std::string*>*>* value);
@@ -438,20 +450,20 @@ private: // functions
void deleteBeautifierContainer(std::vector<ASBeautifier*>*& container);
void deleteTempStacksContainer(std::vector<std::vector<const std::string*>*>*& container);
int adjustIndentCountForBreakElseIfComments() const;
int computeObjCColonAlignment(const std::string& line, int colonAlignPosition) const;
int computeObjCColonAlignment(std::string_view line, int colonAlignPosition) const;
int convertTabToSpaces(int i, int tabIncrementIn) const;
int findObjCColonAlignment(const std::string& line) const;
int getContinuationIndentAssign(const std::string& line, size_t currPos) const;
int getContinuationIndentComma(const std::string& line, size_t currPos) const;
int getObjCFollowingKeyword(const std::string& line, int bracePos) const;
bool isIndentedPreprocessor(const std::string& line, size_t currPos) const;
bool isLineEndComment(const std::string& line, int startPos) const;
bool isPreprocessorConditionalCplusplus(const std::string& line) const;
bool isInPreprocessorUnterminatedComment(const std::string& line);
int findObjCColonAlignment(std::string_view line) const;
int getContinuationIndentAssign(std::string_view line, size_t currPos) const;
int getContinuationIndentComma(std::string_view line, size_t currPos) const;
int getObjCFollowingKeyword(std::string_view line, int bracePos) const;
bool isIndentedPreprocessor(std::string_view line, size_t currPos) const;
bool isLineEndComment(std::string_view line, int startPos) const;
bool isPreprocessorConditionalCplusplus(std::string_view line) const;
bool isInPreprocessorUnterminatedComment(std::string_view line);
bool isTopLevel() const;
bool statementEndsWithComma(const std::string& line, int index) const;
const std::string& getIndentedLineReturn(const std::string& newLine, const std::string& originalLine) const;
std::string getIndentedSpaceEquivalent(const std::string& line_) const;
bool statementEndsWithComma(std::string_view line, int index) const;
std::string getIndentedSpaceEquivalent(std::string_view line_) const;
std::string preLineWS(int lineIndentCount, int lineSpaceIndentCount) const;
template<typename T> void deleteContainer(T& container);
template<typename T> void initContainer(T& container, T value);
@@ -559,6 +571,11 @@ private: // variables
bool shouldIndentPreprocConditional;
bool squeezeWhitespace;
bool attemptLambdaIndentation;
bool isInAssignment;
bool isInInitializerList;
bool isInMultiLineString;
int indentCount;
int spaceIndentCount;
int spaceIndentObjCMethodAlignment;
@@ -593,6 +610,8 @@ private: // variables
// Class ASEnhancer
//-----------------------------------------------------------------------------
// TODO rewrite methods to return altered stings
class ASEnhancer : protected ASBase
{
public: // functions
@@ -604,11 +623,11 @@ public: // functions
private: // functions
void convertForceTabIndentToSpaces(std::string& line) const;
void convertSpaceIndentToForceTab(std::string& line) const;
size_t findCaseColon(const std::string& line, size_t caseIndex) const;
size_t findCaseColon(std::string_view line, size_t caseIndex) const;
int indentLine(std::string& line, int indent) const;
bool isBeginDeclareSectionSQL(const std::string& line, size_t index) const;
bool isEndDeclareSectionSQL(const std::string& line, size_t index) const;
bool isOneLineBlockReached(const std::string& line, int startChar) const;
bool isBeginDeclareSectionSQL(std::string_view line, size_t index) const;
bool isEndDeclareSectionSQL(std::string_view line, size_t index) const;
bool isOneLineBlockReached(std::string_view line, int startChar) const;
void parseCurrentLine(std::string& line, bool isInPreprocessor, bool isInSQL);
size_t processSwitchBlock(std::string& line, size_t index);
int unindentLine(std::string& line, int unindent) const;
@@ -683,7 +702,7 @@ public: // functions
LineEndFormat getLineEndFormat() const;
bool getIsLineReady() const;
void setFormattingStyle(FormatStyle style);
void setAddBracesMode(bool state);
void setAddBracesMode(int state);
void setAddOneLineBracesMode(bool state);
void setRemoveBracesMode(bool state);
void setAttachClass(bool state);
@@ -718,8 +737,13 @@ public: // functions
void setMaxCodeLength(int max);
void setObjCColonPaddingMode(ObjCColonPad mode);
void setOperatorPaddingMode(bool state);
void setNegationPaddingMode(NegationPaddingMode mode);
void setParensOutsidePaddingMode(bool state);
void setParensFirstPaddingMode(bool state);
void setEmptyParensPaddingMode(bool state);
void setParensInsidePaddingMode(bool state);
void setParensHeaderPaddingMode(bool state);
void setParensUnPaddingMode(bool state);
@@ -752,8 +776,8 @@ private: // functions
char peekNextChar() const;
BraceType getBraceType();
bool adjustChecksumIn(int adjustment);
bool computeChecksumIn(const std::string& currentLine_);
bool computeChecksumOut(const std::string& beautifiedLine);
bool computeChecksumIn(std::string_view currentLine_);
bool computeChecksumOut(std::string_view beautifiedLine);
bool addBracesToStatement();
bool removeBracesFromStatement();
bool commentAndHeaderFollows();
@@ -769,22 +793,22 @@ private: // functions
bool isClosingHeader(const std::string* header) const;
bool isCurrentBraceBroken() const;
bool isDereferenceOrAddressOf() const;
bool isExecSQL(const std::string& line, size_t index) const;
bool isEmptyLine(const std::string& line) const;
bool isExecSQL(std::string_view line, size_t index) const;
bool isEmptyLine(std::string_view line) const;
bool isExternC() const;
bool isMultiStatementLine() const;
bool isNextWordSharpNonParenHeader(int startChar) const;
bool isNonInStatementArrayBrace() const;
bool isNumericVariable(const std::string& word) const;
bool isNumericVariable(std::string_view word) const;
bool isOkToSplitFormattedLine();
bool isPointerOrReference() const;
bool isPointerOrReferenceCentered() const;
bool isPointerOrReferenceVariable(const std::string& word) const;
bool isPointerToPointer(const std::string& line, int currPos) const;
bool isPointerOrReferenceVariable(std::string_view word) const;
bool isPointerToPointer(std::string_view line, int currPos) const;
bool isSharpStyleWithParen(const std::string* header) const;
bool isStructAccessModified(const std::string& firstLine, size_t index) const;
bool isIndentablePreprocessorBlock(const std::string& firstLine, size_t index);
bool isNDefPreprocStatement(const std::string& nextLine_, const std::string& preproc) const;
bool isNDefPreprocStatement(std::string_view nextLine_, std::string_view preproc) const;
bool isUnaryOperator() const;
bool isUniformInitializerBrace() const;
bool isImmediatelyPostCast() const;
@@ -797,19 +821,19 @@ private: // functions
int findObjCColonAlignment() const;
int getCurrentLineCommentAdjustment();
int getNextLineCommentAdjustment();
int isOneLineBlockReached(const std::string& line, int startChar) const;
int isOneLineBlockReached(std::string_view line, int startChar) const;
void adjustComments();
void appendChar(char ch, bool canBreakLine);
void appendCharInsideComments();
void appendClosingHeader();
void appendOperator(const std::string& sequence, bool canBreakLine = true);
void appendSequence(const std::string& sequence, bool canBreakLine = true);
void appendOperator(std::string_view sequence, bool canBreakLine = true);
void appendSequence(std::string_view sequence, bool canBreakLine = true);
void appendSpacePad();
void appendSpaceAfter();
void breakLine(bool isSplitLine = false);
void buildLanguageVectors();
void updateFormattedLineSplitPoints(char appendedChar);
void updateFormattedLineSplitPointsOperator(const std::string& sequence);
void updateFormattedLineSplitPointsOperator(std::string_view sequence);
void checkIfTemplateOpener();
void clearFormattedLineSplitPoints();
void convertTabToSpaces();
@@ -851,11 +875,11 @@ private: // functions
void trimContinuationLine();
void updateFormattedLineSplitPointsPointerOrReference(size_t index);
size_t findFormattedLineSplitPoint() const;
size_t findNextChar(const std::string& line, char searchChar, int searchStart = 0) const;
const std::string* checkForHeaderFollowingComment(const std::string& firstLine) const;
size_t findNextChar(std::string_view line, char searchChar, int searchStart = 0) const;
const std::string* checkForHeaderFollowingComment(std::string_view firstLine) const;
const std::string* getFollowingOperator() const;
std::string getPreviousWord(const std::string& line, int currPos) const;
std::string peekNextText(const std::string& firstLine,
std::string getPreviousWord(const std::string& line, int currPos, bool allowDots = false) const;
std::string peekNextText(std::string_view firstLine,
bool endOnEmptyLine = false,
const std::shared_ptr<ASPeekStream>& streamArg = nullptr) const;
@@ -884,6 +908,7 @@ private: // variables
std::string readyFormattedLine;
std::string verbatimDelimiter;
const std::string* currentHeader;
const std::string* previousHeader;
char currentChar;
char previousChar;
char previousNonWSChar;
@@ -900,8 +925,9 @@ private: // variables
int templateDepth;
int squareBracketCount;
int parenthesesCount;
int squeezeEmptyLineNum;
int squeezeEmptyLineCount;
int closingBracesCount;
size_t squeezeEmptyLineNum;
size_t squeezeEmptyLineCount;
size_t checksumIn;
size_t checksumOut;
@@ -934,12 +960,15 @@ private: // variables
ReferenceAlign referenceAlignment;
ObjCColonPad objCColonPadMode;
LineEndFormat lineEnd;
NegationPaddingMode negationPadMode;
bool isVirgin;
bool isInVirginLine;
bool shouldPadCommas;
bool shouldPadOperators;
bool shouldPadParensOutside;
bool shouldPadFirstParen;
bool shouldPadEmptyParens;
bool shouldPadParensInside;
bool shouldPadHeader;
bool shouldStripCommentPrefix;
@@ -1032,7 +1061,7 @@ private: // variables
bool shouldBreakClosingHeaderBraces;
bool shouldBreakElseIfs;
bool shouldBreakLineAfterLogical;
bool shouldAddBraces;
int shouldAddBraces;
bool shouldAddOneLineBraces;
bool shouldRemoveBraces;
bool shouldPadMethodColon;
@@ -1085,15 +1114,19 @@ private: // variables
bool processedFirstConditional;
bool isJavaStaticConstructor;
bool isInAllocator;
bool isInMultlineStatement;
int isInExplicitBlock;
private: // inline functions
// append the CURRENT character (curentChar) to the current formatted line.
// append the CURRENT character (currentChar) to the current formatted line.
void appendCurrentChar(bool canBreakLine = true)
{ appendChar(currentChar, canBreakLine); }
// check if a specific sequence exists in the current placement of the current line
bool isSequenceReached(const char* sequence) const
{ return currentLine.compare(charNum, strlen(sequence), sequence) == 0; }
bool isSequenceReached(std::string_view sequence) const
{
return currentLine.compare(charNum, sequence.length(), sequence) == 0;
}
// call ASBase::findHeader for the current character
const std::string* findHeader(const std::vector<const std::string*>* headers_)
+69 -9
View File
@@ -34,6 +34,7 @@
//-----------------------------------------------------------------------------
#include "astyle_main.h"
#include "astyle.h"
#include <algorithm>
#include <cerrno>
@@ -94,7 +95,7 @@ namespace astyle {
jmethodID g_mid;
#endif
const char* g_version = "3.4.6";
const char* g_version = ASTYLE_VERSION;
//-----------------------------------------------------------------------------
// ASStreamIterator class
@@ -1340,6 +1341,7 @@ void ASConsole::getFileNames(const std::string& directory, const std::vector<std
{
// get file status
std::string entryFilepath = directory + g_fileSeparator + entry->d_name;
if (stat(entryFilepath.c_str(), &statbuf) != 0)
{
if (errno == EOVERFLOW) // file over 2 GB is OK
@@ -1701,8 +1703,10 @@ void ASConsole::getFilePaths(const std::string& filePath)
}
else
{
// verify a single file is not a directory (needed on Linux)
std::string entryFilepath = targetDirectory + g_fileSeparator + targetFilename;
struct stat statbuf;
if (stat(entryFilepath.c_str(), &statbuf) == 0 && (statbuf.st_mode & S_IFREG))
fileName.emplace_back(entryFilepath);
@@ -2087,6 +2091,12 @@ void ASConsole::printHelp() const
std::cout << " --pad-comma OR -xg\n";
std::cout << " Insert space padding after commas.\n";
std::cout << std::endl;
std::cout << " --pad-negation\n";
std::cout << " Insert space padding after negations.\n";
std::cout << std::endl;
std::cout << " --pad-negation=before\n";
std::cout << " Insert space padding also before negations.\n";
std::cout << std::endl;
std::cout << " --pad-paren OR -P\n";
std::cout << " Insert space padding around parenthesis on both the outside\n";
std::cout << " and the inside.\n";
@@ -2101,6 +2111,10 @@ void ASConsole::printHelp() const
std::cout << " --pad-paren-in OR -D\n";
std::cout << " Insert space padding around parenthesis on the inside only.\n";
std::cout << std::endl;
std::cout << " --pad-empty-paren OR -xo\n";
std::cout << " Apply padding to empty pairs of parentheses; combine with other\n";
std::cout << " parenthesis padding options.\n";
std::cout << std::endl;
std::cout << " --pad-header OR -H\n";
std::cout << " Insert space padding after paren headers (e.g. 'if', 'for'...).\n";
std::cout << std::endl;
@@ -2111,10 +2125,16 @@ void ASConsole::printHelp() const
std::cout << " --pad-brackets\n";
std::cout << " Insert space padding around square brackets on both the outside\n";
std::cout << " and the inside (experimental).\n";
std::cout << " and the inside.\n";
std::cout << std::endl;
std::cout << " --pad-brackets-in\n";
std::cout << " Insert space padding around square brackets on the inside only.\n";
std::cout << std::endl;
std::cout << " --pad-brackets-out\n";
std::cout << " Insert space padding around square brackets on the outside only.\n";
std::cout << std::endl;
std::cout << " --unpad-brackets\n";
std::cout << " Remove unnecessary space padding around square brackets (experimental).\n";
std::cout << " Remove unnecessary space padding around square brackets.\n";
std::cout << std::endl;
std::cout << " --delete-empty-lines OR -xe\n";
@@ -2126,10 +2146,10 @@ void ASConsole::printHelp() const
std::cout << " previous lines.\n";
std::cout << std::endl;
std::cout << " --squeeze-lines=#\n";
std::cout << " Remove superfluous empty lines exceeding the given number (experimental).\n";
std::cout << " Remove superfluous empty lines exceeding the given number.\n";
std::cout << std::endl;
std::cout << " --squeeze-ws\n";
std::cout << " Remove superfluous whitespace (experimental).\n";
std::cout << " Remove superfluous whitespace.\n";
std::cout << std::endl;
std::cout << " --align-pointer=type OR -k1\n";
std::cout << " --align-pointer=middle OR -k2\n";
@@ -2161,6 +2181,7 @@ void ASConsole::printHelp() const
std::cout << " statement residing on the same line.\n";
std::cout << std::endl;
std::cout << " --add-braces OR -j\n";
std::cout << " --add-braces=nested (experimental)\n";
std::cout << " Add braces to unbraced one line conditional statements.\n";
std::cout << std::endl;
std::cout << " --add-one-line-braces OR -J\n";
@@ -2221,6 +2242,9 @@ void ASConsole::printHelp() const
std::cout << " --mode=js\n";
std::cout << " Indent a JavaScript source file (experimental).\n";
std::cout << std::endl;
std::cout << " --mode=ghc\n";
std::cout << " Indent a GHC source file (experimental).\n";
std::cout << std::endl;
std::cout << "Objective-C Options:\n";
std::cout << "--------------------\n";
std::cout << " --pad-method-prefix OR -xQ\n";
@@ -2364,8 +2388,11 @@ void ASConsole::processFiles()
getFilePaths(fileNameVectorName);
// loop thru fileName vector formatting the files
for (const std::string& file : fileName)
formatFile(file);
for (const std::string& file : fileName) {
if (!stringEndsWith(file, origSuffix))
formatFile(file);
}
}
// files are processed, display stats
@@ -2787,7 +2814,7 @@ void ASConsole::sleep(int seconds) const
while (clock() < endwait) {}
}
bool ASConsole::stringEndsWith(const std::string& str, const std::string& suffix) const
bool ASConsole::stringEndsWith(std::string_view str, std::string_view suffix) const
{
int strIndex = (int) str.length() - 1;
int suffixIndex = (int) suffix.length() - 1;
@@ -3135,6 +3162,7 @@ bool ASOptions::parseOptions(std::vector<std::string>& optionsVector, const std:
void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo)
{
NegationPaddingMode negationPaddingMode = NEGATION_PAD_NO_CHANGE;
if (isOption(arg, "A1", "style=allman") || isOption(arg, "style=bsd") || isOption(arg, "style=break"))
{
formatter.setFormattingStyle(STYLE_ALLMAN);
@@ -3225,6 +3253,11 @@ void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo
formatter.setObjCStyle();
formatter.setModeManuallySet(true);
}
else if (isOption(arg, "mode=ghc"))
{
formatter.setGHCStyle();
formatter.setModeManuallySet(true);
}
else if (isParamOption(arg, "t", "indent=tab="))
{
int spaceNum = 4;
@@ -3393,6 +3426,10 @@ void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo
{
formatter.setParensFirstPaddingMode(true);
}
else if (isOption(arg, "xo", "pad-empty-paren"))
{
formatter.setEmptyParensPaddingMode(true);
}
else if (isOption(arg, "D", "pad-paren-in"))
{
formatter.setParensInsidePaddingMode(true);
@@ -3409,6 +3446,14 @@ void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo
{
formatter.setOperatorPaddingMode(true);
}
else if (isOption(arg, "pad-negation"))
{
negationPaddingMode = NEGATION_PAD_AFTER;
}
else if (isOption(arg, "pad-negation=before"))
{
negationPaddingMode = NEGATION_PAD_BEFORE;
}
else if (isOption(arg, "xg", "pad-comma"))
{
formatter.setCommaPaddingMode(true);
@@ -3457,9 +3502,13 @@ void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo
{
formatter.setBreakOneLineHeadersMode(true);
}
else if (isOption(arg, "add-braces=nested"))
{
formatter.setAddBracesMode(2);
}
else if (isOption(arg, "j", "add-braces"))
{
formatter.setAddBracesMode(true);
formatter.setAddBracesMode(1);
}
else if (isOption(arg, "J", "add-one-line-braces"))
{
@@ -3606,6 +3655,9 @@ void ASOptions::parseOption(const std::string& arg, const std::string& errorInfo
{
isOptionError(arg, errorInfo);
}
formatter.setNegationPaddingMode(negationPaddingMode);
} // End of parseOption function
// Continuation of parseOption.
@@ -3759,6 +3811,14 @@ bool ASOptions::parseOptionContinued(const std::string& arg, const std::string&
formatter.setBracketsOutsidePaddingMode(true);
formatter.setBracketsInsidePaddingMode(true);
}
else if (isOption(arg, "pad-brackets-in"))
{
formatter.setBracketsInsidePaddingMode(true);
}
else if (isOption(arg, "pad-brackets-out"))
{
formatter.setBracketsOutsidePaddingMode(true);
}
else if (isOption(arg, "unpad-brackets"))
{
formatter.setBracketsUnPaddingMode(true);
+1 -1
View File
@@ -309,7 +309,7 @@ public: // functions
void setStdPathIn(const std::string& path);
void setStdPathOut(const std::string& path);
void standardizePath(std::string& path, bool removeBeginningSeparator = false) const;
bool stringEndsWith(const std::string& str, const std::string& suffix) const;
bool stringEndsWith(std::string_view str, std::string_view suffix) const;
void updateExcludeVector(const std::string& suffixParam);
std::vector<std::string> getExcludeVector() const;
std::vector<bool> getExcludeHitsVector() const;
+14 -14
View File
@@ -14,27 +14,27 @@
<h1>Artistic Style Developer Information</h1>
<h2 class="large">Objective&#8209;C on Windows and Linux</h2>
<h2 class="large"><span style="white-space: nowrap;">Objective-C</span> on Windows and Linux</h2>
<p>
&nbsp;</p>
<p class="noindent">
The best platform for developing Objective&#8209;C is Mac OS. But Objective&#8209;C programs can also be compiled
and run on Windows or Linux by using GNUstep and an Objective&#8209;C compiler. GNUstep is an object-oriented
library that provides the programmer with a range of libraries and utilities for building Objective&#8209;C
The best platform for developing <span style="white-space: nowrap;">Objective-C</span> is Mac OS. But <span style="white-space: nowrap;">Objective-C</span> programs can also be compiled
and run on Windows or Linux by using GNUstep and an <span style="white-space: nowrap;">Objective-C</span> compiler. GNUstep is an object-oriented
library that provides the programmer with a range of libraries and utilities for building <span style="white-space: nowrap;">Objective-C</span>
applications. GNUstep is generally compatible with recent developments of the MacOS (Cocoa) API.</p>
<p class="noindent">
Objective&#8209;C development environments are not readily available on Windows or Linux.
CodeBlocks can be used if additional options are set and an Objective-C compiler is used.. The Example program
<span style="white-space: nowrap;">Objective-C</span> development environments are not readily available on Windows or Linux.
CodeBlocks can be used if additional options are set and an <span style="white-space: nowrap;">Objective-C</span> compiler is used.. The Example program
can also be compiled by using a text editor with compile capability such as SciTE. Or it may be compiled from
the command line. Or scripts can be written using Python, Batch, Bash, or other scripting languages. Compile options
for each platform are included in the following descriptions.</p>
<h3>Objective&#8209;C on Windows</h3>
<h3><span style="white-space: nowrap;">Objective-C</span> on Windows</h3>
<p>
Objective&#8209;C on Windows requires the GNUstep packages and the MinGW compiler. Installing MinGW is optional
since it is included with GNUstep. If MinGW is installed separately be sure to include the Objective&#8209;C compiler
<span style="white-space: nowrap;">Objective-C</span> on Windows requires the GNUstep packages and the MinGW compiler. Installing MinGW is optional
since it is included with GNUstep. If MinGW is installed separately be sure to include the <span style="white-space: nowrap;">Objective-C</span> compiler
package. The GNUstep installation packages are available at the <a href="http://www.gnustep.org/experience/Windows.html">
GNUstep Windows Installer</a> page. For development you will need GNUstep MSYS, GNUstep Core, and GNUstep
Devel. GNUstep Cairo is optional. For now, it is best to use the "stable" packages.</p>
@@ -48,7 +48,7 @@
the menu display will be separate from the application window. This can be changed by running the "System Preferences"
program and selecting Themes &gt; WinUXThem. Most applications will then display a window with a menu at the top
as in Windows. <a href="http://www.gnustep.it/enrico/gworkspace/">GWorkspace</a> is a fairly large application
that includes source code. It can be used as a reference for Objective&#8209;C coding. The GNUstep MSYS shell
that includes source code. It can be used as a reference for <span style="white-space: nowrap;">Objective-C</span> coding. The GNUstep MSYS shell
must be used for the compile since Autoconf is used. There are INSTALL instructions in the top-level GWorkspace
directory.</p>
<p>
@@ -70,12 +70,12 @@
The compiled Example will run as any other console program. If Artistic Style is linked as a DLL it must be in
the same directory as the example, or in another system path directory.</p>
<h3>Objective&#8209;C on Linux</h3>
<h3><span style="white-space: nowrap;">Objective-C</span> on Linux</h3>
<p>
Objective&#8209;C on Linux requires the GNUstep packages and the GCC or Clang compiler. On many systems GNUstep
<span style="white-space: nowrap;">Objective-C</span> on Linux requires the GNUstep packages and the GCC or Clang compiler. On many systems GNUstep
will be available as a packaged install. For a typical installation the gobjc, gobjc++, gnustep, and
gnustep-core-devel packages are needed. The gobjc packages are the Objective&#8209;C compilers for GCC. If packages
gnustep-core-devel packages are needed. The gobjc packages are the <span style="white-space: nowrap;">Objective-C</span> compilers for GCC. If packages
are not available they can be compiled with source code available at the
<a href="http://www.gnustep.org/">GNUstep</a> website.</p>
<p>
@@ -84,7 +84,7 @@
application menu display is separate from the application window. This can NOT be changed with "System Preferences"
as on Windows. <a href="http://www.gnustep.it/enrico/gworkspace/">GWorkspace</a>
is a fairly large application that includes source code if downloaded from the website. It can be used as a reference
for Objective&#8209;C coding. There are INSTALL instructions in the top-level GWorkspace directory.</p>
for <span style="white-space: nowrap;">Objective-C</span> coding. There are INSTALL instructions in the top-level GWorkspace directory.</p>
<p>
To compile the Artistic Style Example program the GNUstep development packages must be installed. Artistic Style
should be compiled as a shared or static library for linking with the example. In the following options the "-L./"
+9 -9
View File
@@ -20,7 +20,7 @@
&nbsp;</p>
<p class="noindent">
Artistic Style has compile options for creating a shared library (DLL) or static library for use with a Graphical
User Interface (GUI). The shared library can be called from a C++, Objective&#8209;C, C#, or Python program. There
User Interface (GUI). The shared library can be called from a C++, <span style="white-space: nowrap;">Objective-C</span>, C#, or Python program. There
are also compile options for a Java Native Interface (JNI) that allows it to be called from a Java program. Information
on compiling the various configurations of Artistic Style is in the Install Information.</p>
<p class="noindent">
@@ -50,12 +50,12 @@
as a shared or static library from a C++ program. It includes a C++ sample program that can be used to test the
Artistic Style libraries.</p>
<p>
<a href="objc.html">Calling Artistic Style from an Objective-C Program</a> contains information on calling Artistic
Style as a shared or static library from an Objective-C program. It includes an Objective-C sample program that
<a href="objc.html">Calling Artistic Style from an <span style="white-space: nowrap;">Objective-C</span> Program</a> contains information on calling Artistic
Style as a shared or static library from an <span style="white-space: nowrap;">Objective-C</span> program. It includes an <span style="white-space: nowrap;">Objective-C</span> sample program that
can be used to test the Artistic Style shared libraries.</p>
<p style="margin-left: 0.5in;">
<a href="gnustep.html">Objective&#8209;C on Windows and Linux</a> contains information on compiling and running
Objective-C programs using GNUstep. It has instructions for compiling the Example program on Windows or
<a href="gnustep.html"><span style="white-space: nowrap;">Objective-C</span> on Windows and Linux</a> contains information on compiling and running
<span style="white-space: nowrap;">Objective-C</span> programs using GNUstep. It has instructions for compiling the Example program on Windows or
Linux.</p>
<p>
<a href="jni.html">Calling Artistic Style as a Java Native Interface</a> contains information on calling Artistic
@@ -99,13 +99,13 @@
<h4>
<a href="https://sourceforge.net/projects/astyle/files/OldFiles/examples/example-objc.zip" target="_blank"
title="open new window">Objective&#8209;C Example</a>
title="open new window"><span style="white-space: nowrap;">Objective-C</span> Example</a>
</h4>
<p>
The example for Objective&#8209;C contains the methods to call Artistic Style from a static or shared library
using an Objective&#8209;C program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB.
Copy the shared library to the same folder as the Objective&#8209;C Example executable. It will format files in
The example for <span style="white-space: nowrap;">Objective-C</span> contains the methods to call Artistic Style from a static or shared library
using an <span style="white-space: nowrap;">Objective-C</span> program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB.
Copy the shared library to the same folder as the <span style="white-space: nowrap;">Objective-C</span> Example executable. It will format files in
the test&#8209;data directory included in the download.</p>
<h4>
+5 -5
View File
@@ -15,20 +15,20 @@
<h1>Artistic Style Developer Information</h1>
<h2 class="large">Calling Artistic Style from an Objective&#8209;C Program</h2>
<h2 class="large">Calling Artistic Style from an <span style="white-space: nowrap;">Objective-C</span> Program</h2>
<p>
&nbsp;</p>
<p class="noindent">
Artistic Style can be compiled as a shared library (DLL) or a static library and linked with an Objective&#8209;C
program. This is usually done on a Mac OS computer. However,&nbsp; <a href="gnustep.html">Objective&#8209;C on Windows
and Linux</a> contains information on compiling and running Objective&#8209;C programs using GNUstep. It has
Artistic Style can be compiled as a shared library (DLL) or a static library and linked with an <span style="white-space: nowrap;">Objective-C</span>
program. This is usually done on a Mac OS computer. However,&nbsp; <a href="gnustep.html"><span style="white-space: nowrap;">Objective-C</span> on Windows
and Linux</a> contains information on compiling and running <span style="white-space: nowrap;">Objective-C</span> programs using GNUstep. It has
instructions for compiling the following example program on Windows or Linux.</p>
<h3>Compile Options</h3>
<p>
To compile AStyle for use with an Objective&#8209;C program the compile option ASTYLE_LIB must be defined. Then
To compile AStyle for use with an <span style="white-space: nowrap;">Objective-C</span> program the compile option ASTYLE_LIB must be defined. Then
AStyle will accept the files and options as parameters from a function call. It is the responsibility of the calling
program to read the source files and accept the options from the user via a graphical interface or other method.
These are then passed via the function call. After the source files are formatted they will be returned to the
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Creates a new test case for a single long option
# if the string begins as flag the second part is stored in OPTS
# Examples:
# ./gen_old_file.sh style_kr
# ./gen_old_file.sh flag_attach-namespaces
# Loop through the command-line arguments
for arg in "$@"; do
# Split each argument into 'name' and 'value'
IFS="_" read -r name value <<< "$arg"
dirName="$arg"
mkdir -p "$dirName"
arg="--$name=$value"
if [ "$name" = "flag" ]; then
arg="--$value"
echo "$arg" > "$dirName/OPTS"
fi
# call the astyle version here which is considered as reference for the future
astyle_ref "$arg" < tmp.cpp > "$dirName/tmp.cpp.old"
done
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
# run all test cases in the current directory
# it assumes a source file produced by a previous astyle version to compare with the output of the current
#
for dir in */
do
dir=${dir%*/} # remove the trailing "/"
# make string an array
cmd_arg=(${dir//_/ })
# default arg=val based on directory name
arg="--${cmd_arg[0]}=${cmd_arg[1]}"
# custom arguments
if [ -f "$dir/OPTS" ]; then
arg=$(<"$dir/OPTS")
fi
# call the latest astyle here
../../AStyle/build_local/astyle --squeeze-lines=1 "$arg" < tmp.cpp > "$dir/tmp.cpp.new"
diff $dir/tmp.cpp.old $dir/tmp.cpp.new
if [ $? -eq 0 ]; then
rm "$dir/tmp.cpp.new"
else
echo "${dir} -> FAILED"
exit 1
fi
done
@@ -0,0 +1,290 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,320 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{
cout << "x is positive" << endl;
}
else
{
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++)
{
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp)
{
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{
if (tp == curtab)
{
ui_ext_win_position (wp, validate);
}
else
{
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab)
{
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating)
{
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true)
{
new int *[5]; // Remove this and everything works fine
if (5 > 2)
{
abc();
for (int i = 0; i < 6; i++)
{
def();
}
}
else
{
xyz();
for (int i = 0; i < 8; i++)
{
xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,320 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{
cout << "x is positive" << endl;
}
else
{
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++)
{
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp)
{
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{
if (tp == curtab)
{
ui_ext_win_position (wp, validate);
}
else
{
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab)
{
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating)
{
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true)
{
new int *[5]; // Remove this and everything works fine
if (5 > 2)
{
abc();
for (int i = 0; i < 6; i++)
{
def();
}
}
else
{
xyz();
for (int i = 0; i < 8; i++)
{
xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,271 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display() {
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main() {
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b) {
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2)) {
int x = 1 * 2;
return;
}
int fdfd(int* t) {
return 1;
}
if (*f(xss) < mx) {
return 1;
}
if (**f(xss) < mx) {
return 1;
}
if (t * f(xss) < mx) {
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c) {
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate) {
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void) {
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path) {
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this] {
some_code(argument);
})
, member3(42)
, member4("test") {
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q) {
return;
}
int main(void) {
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn() {
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main() {
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,280 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{ cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{ // Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{ int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{ cout << "x is positive" << endl;
}
else
{ cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++)
{ cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{ func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{ someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{ x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{ return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{ int x = 1 * 2;
return;
}
int fdfd(int* t)
{ return 1;
}
if (*f(xss) < mx)
{ return 1;
}
if (**f(xss) < mx)
{ return 1;
}
if (t * f(xss) < mx)
{ return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{ int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{ FOR_ALL_TAB_WINDOWS (tp, wp)
{ if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{ if (tp == curtab)
{ ui_ext_win_position (wp, validate);
}
else
{ ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab)
{ ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{ win_T* res = lastwin;
while (res->w_floating)
{ res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{ m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{ some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{ int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{ return;
}
int main(void)
{
switch (foo)
{ case 1:
a += 1;
break;
case 2:
{ a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{ some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{ while (true)
{ new int *[5]; // Remove this and everything works fine
if (5 > 2)
{ abc();
for (int i = 0; i < 6; i++)
{ def();
}
}
else
{ xyz();
for (int i = 0; i < 8; i++)
{ xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{ uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{ uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{ uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,271 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display() {
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main() {
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b) {
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2)) {
int x = 1 * 2;
return;
}
int fdfd(int* t) {
return 1;
}
if (*f(xss) < mx) {
return 1;
}
if (**f(xss) < mx) {
return 1;
}
if (t * f(xss) < mx) {
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c) {
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate) {
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void) {
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path) {
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this] {
some_code(argument);
})
, member3(42)
, member4("test") {
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q) {
return;
}
int main(void) {
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn() {
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main() {
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,290 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,290 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,231 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display() {
cout << "MyValue: " << myValue << endl; }
private:
int myValue; };
int main() {
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl; }
else {
cout << "x is non-positive" << endl; }
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl; }
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0; } }
int x2;
do {
x2 = 1; }
while (func(foo,
bar));
return 0; }
// Function definition
int add(int a, int b) {
return a + b; }
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2)) {
int x = 1 * 2;
return; }
int fdfd(int* t) {
return 1; }
if (*f(xss) < mx) {
return 1; }
if (**f(xss) < mx) {
return 1; }
if (t * f(xss) < mx) {
return 1; }
int* p = (int*)& _mem;
void foo(int a, int c) {
int* p = (int*)& _mem; }
void win_ui_flush (bool validate) {
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate); }
else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false; } }
if (tp == curtab) {
ui_ext_win_viewport (wp); } } }
win_T* lastwin_nofloating (void) {
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev; }
return res; }
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path) {
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str(); }).share(); }
Test::Test() : member1(argument)
, member2([this] {
some_code(argument); })
, member3(42)
, member4("test") {}
struct xxxx {
int a, b, c; };
(struct xxxxx *p);
int main(int * p, int *q) {
return; }
int main(void) {
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break; } }
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0; }
mapping someData = ([
"key": "value",
]);
void fn() {
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
])); }
int main() {
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def(); } }
else {
xyz();
for (int i = 0; i < 8; i++) {
xyz(); } } }
return 0; }
struct s {
public:
inline s() :
size(x),
ia {new int [y] },
ia {new int [y] }
{} }
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void); }
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void); }
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void); }
@@ -0,0 +1,296 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,236 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{ cout << "MyValue: " << myValue << endl; }
private:
int myValue; };
int main()
{ // Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{ int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{ cout << "x is positive" << endl; }
else
{ cout << "x is non-positive" << endl; }
// Loop
for (int i = 0; i < 5; i++)
{ cout << "Iteration " << i + 1 << endl; }
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{ func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{ someVal = someVal2 =
someVal3 = someVal4 = 0; } }
int x2;
do
{ x2 = 1; }
while (func(foo,
bar));
return 0; }
// Function definition
int add(int a, int b)
{ return a + b; }
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{ int x = 1 * 2;
return; }
int fdfd(int* t)
{ return 1; }
if (*f(xss) < mx)
{ return 1; }
if (**f(xss) < mx)
{ return 1; }
if (t * f(xss) < mx)
{ return 1; }
int* p = (int*)& _mem;
void foo(int a, int c)
{ int* p = (int*)& _mem; }
void win_ui_flush (bool validate)
{ FOR_ALL_TAB_WINDOWS (tp, wp)
{ if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{ if (tp == curtab)
{ ui_ext_win_position (wp, validate); }
else
{ ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false; } }
if (tp == curtab)
{ ui_ext_win_viewport (wp); } } }
win_T* lastwin_nofloating (void)
{ win_T* res = lastwin;
while (res->w_floating)
{ res = res->w_prev; }
return res; }
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{ m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str(); }).share(); }
Test::Test() : member1(argument)
, member2([this]
{ some_code(argument); })
, member3(42)
, member4("test")
{}
struct xxxx
{ int a, b, c; };
(struct xxxxx *p);
int main(int * p, int *q)
{ return; }
int main(void)
{
switch (foo)
{ case 1:
a += 1;
break;
case 2:
{ a += 2;
break; } }
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0; }
mapping someData = ([
"key": "value",
]);
void fn()
{ some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
])); }
int main()
{ while (true)
{ new int *[5]; // Remove this and everything works fine
if (5 > 2)
{ abc();
for (int i = 0; i < 6; i++)
{ def(); } }
else
{ xyz();
for (int i = 0; i < 8; i++)
{ xyz(); } } }
return 0; }
struct s
{
public:
inline s() :
size(x),
ia {new int [y] },
ia {new int [y] }
{} }
#define MY_BITFIELD_WIDTH
typedef struct
{ uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void); }
struct
{ uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void); }
typedef struct
{ uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void); }
@@ -0,0 +1,275 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display() {
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main() {
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
}
else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b) {
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2)) {
int x = 1 * 2;
return;
}
int fdfd(int* t) {
return 1;
}
if (*f(xss) < mx) {
return 1;
}
if (**f(xss) < mx) {
return 1;
}
if (t * f(xss) < mx) {
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c) {
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate) {
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
}
else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void) {
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path) {
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this] {
some_code(argument);
})
, member3(42)
, member4("test") {
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q) {
return;
}
int main(void) {
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn() {
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main() {
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
}
else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,293 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
}
else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
}
else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
}
else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,320 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{
cout << "x is positive" << endl;
}
else
{
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++)
{
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp)
{
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{
if (tp == curtab)
{
ui_ext_win_position (wp, validate);
}
else
{
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab)
{
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating)
{
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true)
{
new int *[5]; // Remove this and everything works fine
if (5 > 2)
{
abc();
for (int i = 0; i < 6; i++)
{
def();
}
}
else
{
xyz();
for (int i = 0; i < 8; i++)
{
xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,289 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do {
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]() {
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
@@ -0,0 +1,320 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass
{
public:
MyClass (int value) : myValue (value ) {}
void display()
{
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main()
{
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct // Structure declaration
{
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0)
{
cout << "x is positive" << endl;
}
else
{
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++)
{
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c)
{
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x)
{
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{
x2 = 1;
}
while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2))
{
int x = 1 * 2;
return;
}
int fdfd(int* t)
{
return 1;
}
if (*f(xss) < mx)
{
return 1;
}
if (**f(xss) < mx)
{
return 1;
}
if (t * f(xss) < mx)
{
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp)
{
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL)
{
if (tp == curtab)
{
ui_ext_win_position (wp, validate);
}
else
{
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab)
{
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating)
{
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{
m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this]
{
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx
{
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn()
{
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main()
{
while (true)
{
new int *[5]; // Remove this and everything works fine
if (5 > 2)
{
abc();
for (int i = 0; i < 6; i++)
{
def();
}
}
else
{
xyz();
for (int i = 0; i < 8; i++)
{
xyz();
}
}
}
return 0;
}
struct s
{
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct
{
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct
{
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
+293
View File
@@ -0,0 +1,293 @@
#include "stdafx.h"
#include <emmintrin.h>
#include <iostream>
// a badly formatted file used for CI regression tests
#ifdef TEST
#endif
using namespace std;
// Function declaration
int add(int a, int b);
// Class definition
class MyClass {
public:
MyClass (int value) : myValue (value ) {}
void display() {
cout << "MyValue: " << myValue << endl;
}
private:
int myValue;
};
int main() {
// Variables and data types
int a, b, c, x, someVal, someVal2, someVal3, someVal4 = 5;
double y, foo, bar = 3.14;
char ch = 'A';
bool isTrue = true;
struct { // Structure declaration
int myNum; // Member (int variable)
string myString; // Member (string variable)
} myStructure; // Structure variable
// Arithmetic operations
int result = x + 2 * (int)y;
cout << "Result: " << result << endl;
// Conditional statement
if (x > 0) {
cout << "x is positive" << endl;
} else {
cout << "x is non-positive" << endl;
}
// Loop
for (int i = 0; i < 5; i++) {
cout << "Iteration " << i + 1 << endl;
}
// Function call
int sum = add(3, 4);
cout << "Sum: " << sum << endl;
// Object creation and method call
MyClass obj(42);
obj.display();
goto label;
label:
MyClass.setA1234( 1 )
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa()
.setB12dsadasdasdsa( 2 )
.setB12dsadasdasdsa( 2 )
.setC12dsdsds( 3 );
if (a=b=c) {
func(a==b==c);
someVal = someVal2 =
someVal3 = someVal4 = 0;
if (x) {
someVal = someVal2 =
someVal3 = someVal4 = 0;
}
}
int x2;
do
{
x2 = 1;
} while (func(foo,
bar));
return 0;
}
// Function definition
int add(int a, int b) {
return a + b;
}
// Pointer alignment
if (anotherMethod((uint8_t *)param1, (uint8_t *)param2)) {
int x = 1 * 2;
return;
}
int fdfd(int* t) {
return 1;
}
if (*f(xss) < mx) {
return 1;
}
if (**f(xss) < mx) {
return 1;
}
if (t * f(xss) < mx) {
return 1;
}
int* p = (int*)& _mem;
void foo(int a, int c)
{
int* p = (int*)& _mem;
}
void win_ui_flush (bool validate)
{
FOR_ALL_TAB_WINDOWS (tp, wp) {
if (wp->w_pos_changed && wp->w_grid_alloc.chars != NULL) {
if (tp == curtab) {
ui_ext_win_position (wp, validate);
} else {
ui_call_win_hide (wp->w_grid_alloc.handle);
wp->w_pos_changed = false;
}
}
if (tp == curtab) {
ui_ext_win_viewport (wp);
}
}
}
win_T* lastwin_nofloating (void)
{
win_T* res = lastwin;
while (res->w_floating) {
res = res->w_prev;
}
return res;
}
CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFileSourceFilter *pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
{ m_futureMIText = std::async(std::launch::async, [ = ]()
{
#if USE_STATIC_MEDIAINFO
MediaInfoLib::String filename = m_path;
MediaInfoLib::MediaInfo MI;
#else
MediaInfoDLL::String filename = m_path;
MediaInfo MI;
#endif
return MI.Inform().c_str();
}).share();
}
Test::Test() : member1(argument)
, member2([this] {
some_code(argument);
})
, member3(42)
, member4("test")
{
}
struct xxxx {
int a, b, c;
};
(struct xxxxx *p);
int main(int * p, int *q)
{
return;
}
int main(void)
{
switch (foo) {
case 1:
a += 1;
break;
case 2: {
a += 2;
break;
}
}
struct xxxx *p;
printf("sizeof p: %d\n", sizeof p);
int * p, *q;
return 0;
}
mapping someData = ([
"key": "value",
]);
void fn() {
some_fn(([
"key1": "/path/to/file1.c",
"key2": "/path/to/file2.c",
]));
}
int main() {
while (true) {
new int *[5]; // Remove this and everything works fine
if (5 > 2) {
abc();
for (int i = 0; i < 6; i++) {
def();
}
} else {
xyz();
for (int i = 0; i < 8; i++) {
xyz();
}
}
}
return 0;
}
struct s {
public:
inline s() :
size(x),
ia {new int [y]},
ia {new int [y]}
{}
}
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func) (void);
}
typedef struct {
uint32_t member_1 : 8;
uint32_t member_1 : 2;
uint32_t member_2 : 3;
bool (*func) (void);
}
+3 -3
View File
@@ -1,9 +1,9 @@
= Artistic Style
Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.
Written in C++, it can be used from the command line or incorporated as a library in another program.
Artistic Style is a source code indenter, formatter, and beautifier for the C, pass:[C++], pass:[C++]/CLI, Objective‑C, C# and Java programming languages.
Written in pass:[C++], it can be used from the command line or incorporated as a library in another program.
Options can be entered from the command line or from an option file.
The library version can be called from programs written in languages other that C++.
The library version can be called from programs written in languages other than pass:[C++].
== Repositories