Changeset View
Changeset View
Standalone View
Standalone View
autotests/folding/highlight.cpp.fold
1 | #pragma once | 1 | #pragma once | ||
---|---|---|---|---|---|
2 | 2 | | |||
3 | #include <cassert> | 3 | #include <cassert> | ||
4 | #include <assert.h> | 4 | #include <assert.h> | ||
5 | #include "assert.h" | 5 | #include "assert.h" | ||
6 | #include "assert.hpp" | 6 | #include "assert.hpp" // abc | ||
7 | #include "path/assert.hpp" | 7 | #include "path/assert.hpp" | ||
8 | #include "assert.h"a | ||||
9 | #include "assert.h" a | ||||
10 | #include <cassert>a | ||||
11 | #include <cassert> a | ||||
12 | #include FOO() error | ||||
13 | #include_next <cassert> a | ||||
14 | #include_next <cassert> <beginfold id='2'>/*</beginfold id='2'> a | ||||
15 | <endfold id='2'>*/</endfold id='2'> b | ||||
16 | #include PATH_IN_MACRO | ||||
8 | #include PATH_IN_MACRO() | 17 | #include PATH_IN_MACRO() | ||
18 | #include PATH_IN_MACRO(a, b) | ||||
9 | 19 | | |||
10 | #define SOME_VAR 1 | 20 | #define SOME_VAR 1 | ||
11 | <beginfold id='1'>#ifdef</beginfold id='1'> SOME_VAR | 21 | #<beginfold id='4'>ifdef</beginfold id='4'> SOME_VAR | ||
12 | 22 | | |||
13 | #define MULTILINE_MACRO one \ | 23 | #define MULTILINE_MACRO one \ | ||
14 | two \ | 24 | two \ | ||
15 | three | 25 | three | ||
16 | 26 | | |||
17 | # define MULTILINE_MACRO_TEXT \ | 27 | # define MULTILINE_MACRO_TEXT \ | ||
18 | /* NOTE The contents of macro is too green :D */ \ | 28 | <beginfold id='2'>/*</beginfold id='2'> NOTE The contents of macro is too green :D <endfold id='2'>*/</endfold id='2'> \ | ||
19 | char const s[] = "a\\b" \ | 29 | char const s[] = "a\\b" \ | ||
20 | "c\nd" | 30 | "c\nd" | ||
21 | 31 | | |||
32 | # define VARIADIC(a, ...) \ | ||||
33 | f(a##a) \ | ||||
34 | f(__VA_ARGS__) \ | ||||
35 | f(#__VA_ARGS__) \ | ||||
36 | f(__VA_ARGS__) \ | ||||
37 | f(0 __VA_OPT__(,) __VA_ARGS__) \ | ||||
38 | x __VA_OPT__(= { __VA_ARGS__ }) | ||||
39 | | ||||
40 | # define MACRO() BAD \ ESCAPED | ||||
41 | | ||||
22 | # error dds | 42 | # error dds | ||
23 | # warning dds | 43 | # warning dds | ||
24 | # line 2 "file.cpp" | 44 | # line 2 "file.cpp" | ||
25 | # define A(x, y) x##y x#y | 45 | # define A(x, y) x##y x#y | ||
26 | // OK(L, a) -> L"a" | 46 | // OK(L, a) -> L"a" | ||
27 | # define OK(x, y) x###y | 47 | # define OK(x, y) x###y | ||
28 | # define BAD(x, y) x####y | 48 | # define BAD(x, y) x####y | ||
49 | # define A <beginfold id='2'>/*</beginfold id='2'> multi line | ||||
50 | with comment <endfold id='2'>*/</endfold id='2'> expr | ||||
51 | # define A <beginfold id='2'>/*</beginfold id='2'> multi line | ||||
52 | with comment <endfold id='2'>*/</endfold id='2'> | ||||
53 | 23 | ||||
54 | #<endfold id='4'>else</endfold id='4'> // x<beginfold id='4'>else</beginfold id='4'> // x | ||||
55 | #42 // gcc extension = #line 42 | ||||
56 | | ||||
57 | // error | ||||
58 | #wrong | ||||
59 | # wrong | ||||
60 | #<endfold id='4'>endif</endfold id='4'> x | ||||
61 | #<beginfold id='4'>if</beginfold id='4'> DS() | ||||
62 | #<endfold id='4'>else</endfold id='4'> x<beginfold id='4'>else</beginfold id='4'> x | ||||
63 | #<endfold id='4'>else</endfold id='4'> /* */x<beginfold id='4'>else</beginfold id='4'> <beginfold id='2'>/*</beginfold id='2'> <endfold id='2'>*/</endfold id='2'>x | ||||
64 | #<endfold id='4'>else</endfold id='4'> /* x<beginfold id='4'>else</beginfold id='4'> <beginfold id='2'>/*</beginfold id='2'> x | ||||
65 | y <endfold id='2'>*/</endfold id='2'> z | ||||
66 | #<endfold id='4'>endif</endfold id='4'> | ||||
29 | 67 | | |||
30 | static int g_global; | 68 | static int g_global; | ||
31 | 69 | | |||
32 | template<class T, typename U, template<class> class = std::is_pointer> | 70 | template<class T, typename U, template<class> class = std::is_pointer> | ||
33 | struct class1 | 71 | struct class1 | ||
34 | : private std::vector<T>, public U | 72 | : private std::vector<T>, public U | ||
35 | <beginfold id='4'>{</beginfold id='4'> | 73 | <beginfold id='1'>{</beginfold id='1'> | ||
36 | class1() | 74 | class1() | ||
37 | try | 75 | try | ||
38 | : _member1(xxx) | 76 | : _member1(xxx) | ||
39 | <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'> | 77 | <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'> | ||
40 | catch(...) | 78 | catch(...) | ||
41 | <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'> | 79 | <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'> | ||
80 | | ||||
81 | class1(class1&&) = default; | ||||
42 | 82 | | |||
43 | ~class1() | 83 | ~class1() | ||
44 | <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'> | 84 | <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'> | ||
45 | 85 | | |||
46 | void foo() <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 86 | void foo() <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
47 | void foo() const <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 87 | void foo() const <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
48 | void foo() noexcept <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 88 | void foo() noexcept <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
49 | void foo() const noexcept <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 89 | void foo() const noexcept <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
50 | virtual void foo() const noexcept <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 90 | virtual void foo() const noexcept <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
51 | static void foo() <beginfold id='4'>{</beginfold id='4'> return; <endfold id='4'>}</endfold id='4'> | 91 | static void foo() <beginfold id='1'>{</beginfold id='1'> return; <endfold id='1'>}</endfold id='1'> | ||
52 | constexpr static void foo() const | 92 | constexpr static void foo() const | ||
53 | noexcept(noexcept(std::is_pointer<U>::value)) override | 93 | noexcept(noexcept(std::is_pointer<U>::value)) override | ||
54 | <beginfold id='4'>{</beginfold id='4'> | 94 | <beginfold id='1'>{</beginfold id='1'> | ||
55 | xxx::template ttt<U>::type <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>; | 95 | xxx::template ttt<U>::type <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'>; | ||
56 | xxx.template get<U>(); | 96 | xxx.template get<U>(); | ||
57 | xxx.std::rdbuf(); | 97 | xxx.std::rdbuf(); | ||
58 | auto x = C<'a'> + y; | 98 | auto x = C<'a'> + y; | ||
59 | <endfold id='4'>}</endfold id='4'> | 99 | <endfold id='1'>}</endfold id='1'> | ||
60 | 100 | | |||
61 | int operator->*(T (C::*m)(int)); | 101 | int operator->*(T (C::*m)(int)); | ||
62 | operator value_t (); | 102 | operator value_t (); | ||
63 | 103 | | |||
64 | private: | 104 | private: | ||
65 | protected: | 105 | protected: | ||
66 | public: | 106 | public: | ||
67 | value_type _member1; // NOTE internal ? | 107 | value_type _member1; // NOTE internal ? | ||
68 | value_type __internal; | 108 | value_type __internal; | ||
69 | value_type internal__; | 109 | value_type internal__; | ||
70 | value_type _M_internal; | 110 | value_type _M_internal; | ||
71 | value_t member2_; | 111 | value_t member2_; | ||
72 | value_type m_member3; | 112 | value_type m_member3; | ||
73 | 113 | | |||
74 | static int s_static; | 114 | static int s_static; | ||
75 | <endfold id='4'>}</endfold id='4'>; | 115 | static constexpr int s_static; | ||
116 | static inline int s_static; | ||||
117 | static inline constexpr int s_static; | ||||
118 | <endfold id='1'>}</endfold id='1'>; | ||||
76 | 119 | | |||
77 | constexpr struct : xyz | 120 | constexpr struct : xyz | ||
78 | <beginfold id='4'>{</beginfold id='4'> | 121 | <beginfold id='1'>{</beginfold id='1'> | ||
79 | using xyz::xyz; | 122 | using xyz::xyz; | ||
80 | using xyz::operator=; | 123 | using xyz::operator=; | ||
81 | 124 | | |||
82 | int a : 1; | 125 | int a : 1; | ||
83 | int b : 7; | 126 | int b : 7; | ||
84 | <endfold id='4'>}</endfold id='4'> x <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>; | 127 | <endfold id='1'>}</endfold id='1'> x <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'>; | ||
85 | 128 | | |||
86 | template<class T> | 129 | template<class T> | ||
87 | using is_pointer = std::is_pointer<T>::type; | 130 | using is_pointer = std::is_pointer<T>::type; | ||
88 | 131 | | |||
89 | template<class T> | 132 | template<class T> | ||
90 | constexpr auto is_pointer_v = std::is_pointer<T>::value; | 133 | constexpr auto is_pointer_v = std::is_pointer<T>::value; | ||
91 | 134 | | |||
92 | uint64_t namespaces() | 135 | uint64_t namespaces() | ||
93 | <beginfold id='4'>{</beginfold id='4'> | 136 | <beginfold id='1'>{</beginfold id='1'> | ||
94 | std::vector<T>; | 137 | std::vector<T>; | ||
95 | boost::vector<T>; | 138 | boost::vector<T>; | ||
96 | detail::vector<T>; | 139 | detail::vector<T>; | ||
97 | details::vector<T>; | 140 | details::vector<T>; | ||
98 | aux::vector<T>; | 141 | aux::vector<T>; | ||
99 | internals::vector<T>; | 142 | internals::vector<T>; | ||
100 | other::vector<T>; | 143 | other::vector<T>; | ||
101 | <endfold id='4'>}</endfold id='4'> | 144 | <endfold id='1'>}</endfold id='1'> | ||
145 | | ||||
146 | #<beginfold id='4'>if</beginfold id='4'> 1 | ||||
147 | double foo(const A); | ||||
148 | <endfold id='4'>#else</endfold id='4'> // else<beginfold id='4'>#else</beginfold id='4'> // else | ||||
149 | double foo(const A); | ||||
150 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
151 | | ||||
152 | #<beginfold id='4'>if</beginfold id='4'> 0 | ||||
153 | double foo(const A); | ||||
154 | <endfold id='4'>#else</endfold id='4'> // else<beginfold id='4'>#else</beginfold id='4'> // else | ||||
155 | double foo(const A); | ||||
156 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
157 | | ||||
158 | #<beginfold id='4'>if</beginfold id='4'> 1 | ||||
159 | double foo(const A); | ||||
160 | <endfold id='4'>#elif</endfold id='4'> 1<beginfold id='4'>#elif</beginfold id='4'> 1 | ||||
161 | double foo(const A); | ||||
162 | #elif 0 | ||||
163 | double foo(const A); | ||||
164 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
165 | | ||||
166 | #<beginfold id='4'>if</beginfold id='4'> 0 | ||||
167 | double foo(const A); | ||||
168 | <endfold id='4'>#elif 1</endfold id='4'><beginfold id='4'>#elif 1</beginfold id='4'> | ||||
169 | double foo(const A); | ||||
170 | <endfold id='4'>#elif</endfold id='4'> 0<beginfold id='4'>#elif</beginfold id='4'> 0 | ||||
171 | double foo(const A); | ||||
172 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
173 | | ||||
174 | #<beginfold id='4'>if</beginfold id='4'> 0 | ||||
175 | double foo(const A); | ||||
176 | <endfold id='4'>#elif</endfold id='4'> a<beginfold id='4'>#elif</beginfold id='4'> a | ||||
177 | double foo(const A); | ||||
178 | #<endfold id='4'>elif</endfold id='4'> 0<beginfold id='4'>elif</beginfold id='4'> 0 | ||||
179 | double foo(const A); | ||||
180 | <endfold id='4'>#elif</endfold id='4'> a<beginfold id='4'>#elif</beginfold id='4'> a | ||||
181 | double foo(const A); | ||||
182 | #<endfold id='4'>else</endfold id='4'> // else<beginfold id='4'>else</beginfold id='4'> // else | ||||
183 | double foo(const A); | ||||
184 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
185 | | ||||
186 | #<beginfold id='4'>if</beginfold id='4'> 0 // blah blah | ||||
187 | double foo(const A); | ||||
188 | <endfold id='4'>#elif 1 </endfold id='4'>// blah blah<beginfold id='4'>#elif 1 </beginfold id='4'>// blah blah | ||||
189 | double foo(const A); | ||||
190 | <endfold id='4'>#else</endfold id='4'> // else<beginfold id='4'>#else</beginfold id='4'> // else | ||||
191 | double foo(const A); | ||||
192 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
193 | | ||||
194 | #<beginfold id='4'>if</beginfold id='4'> 0 || a | ||||
195 | double foo(const A); | ||||
196 | #<endfold id='4'>else</endfold id='4'> // else<beginfold id='4'>else</beginfold id='4'> // else | ||||
197 | double foo(const A); | ||||
198 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
199 | | ||||
200 | #<beginfold id='4'>if</beginfold id='4'> 1 || a | ||||
201 | double foo(const A); | ||||
202 | <endfold id='4'>#else</endfold id='4'> // else<beginfold id='4'>#else</beginfold id='4'> // else | ||||
203 | double foo(const A); | ||||
204 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
205 | | ||||
206 | #<beginfold id='4'>if</beginfold id='4'> 0 && a | ||||
207 | double foo(const A); | ||||
208 | #<endfold id='4'>else</endfold id='4'> // else<beginfold id='4'>else</beginfold id='4'> // else | ||||
209 | double foo(const A); | ||||
210 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
211 | | ||||
212 | #<beginfold id='4'>if</beginfold id='4'> 1 && a | ||||
213 | double foo(const A); | ||||
214 | #<endfold id='4'>else</endfold id='4'> // else<beginfold id='4'>else</beginfold id='4'> // else | ||||
215 | double foo(const A); | ||||
216 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
217 | | ||||
218 | #<beginfold id='4'>if</beginfold id='4'> a | ||||
219 | double foo(const A); | ||||
220 | #<endfold id='4'>elif</endfold id='4'> 0<beginfold id='4'>elif</beginfold id='4'> 0 | ||||
221 | double foo(const A); | ||||
222 | <endfold id='4'>#endif</endfold id='4'> // end | ||||
102 | 223 | | |||
103 | <beginfold id='1'>#if 1</beginfold id='1'> | 224 | #<beginfold id='4'>if</beginfold id='4'> a | ||
104 | double foo(const A); | 225 | double foo(const A); | ||
105 | #else | 226 | #<endfold id='4'>elif</endfold id='4'> 1<beginfold id='4'>elif</beginfold id='4'> 1 | ||
106 | double foo(const A); | 227 | double foo(const A); | ||
107 | <endfold id='1'>#endif</endfold id='1'> | 228 | <endfold id='4'>#endif</endfold id='4'> // end | ||
108 | 229 | | |||
109 | <beginfold id='1'>#if 0</beginfold id='1'> | 230 | #<beginfold id='4'>if</beginfold id='4'> a | ||
110 | double foo(const A); | 231 | double foo(const A); | ||
111 | #else | 232 | #<endfold id='4'>elif</endfold id='4'> a<beginfold id='4'>elif</beginfold id='4'> a | ||
112 | double foo(const A); | 233 | double foo(const A); | ||
113 | <endfold id='1'>#endif</endfold id='1'> | 234 | #<endfold id='4'>endif</endfold id='4'> // end | ||
114 | 235 | | |||
115 | int bar(void*p, void * pp) | 236 | int bar(void*p, void * pp) | ||
116 | <beginfold id='4'>{</beginfold id='4'> | 237 | <beginfold id='1'>{</beginfold id='1'> | ||
117 | <beginfold id='1'># if 0</beginfold id='1'> | 238 | # <beginfold id='4'>if</beginfold id='4'> 0 | ||
239 | double foo(); | ||||
240 | <endfold id='4'># else</endfold id='4'> // else<beginfold id='4'># else</beginfold id='4'> // else | ||||
241 | double foo(); | ||||
242 | <endfold id='4'># endif</endfold id='4'> // end | ||||
243 | <endfold id='1'>}</endfold id='1'> | ||||
244 | | ||||
245 | #<beginfold id='4'>if</beginfold id='4'> abc 0 | ||||
118 | double foo(); | 246 | double foo(); | ||
119 | # else | 247 | #<endfold id='4'>endif</endfold id='4'> // end | ||
248 | | ||||
249 | #<beginfold id='4'>if</beginfold id='4'> xxx | ||||
250 | double foo(); | ||||
251 | #<endfold id='4'>else</endfold id='4'><beginfold id='4'>else</beginfold id='4'> | ||||
252 | double foo(); | ||||
253 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
254 | | ||||
255 | #<beginfold id='4'>if</beginfold id='4'> xxx | ||||
120 | double foo(); | 256 | double foo(); | ||
121 | <endfold id='1'># endif</endfold id='1'> | 257 | #<endfold id='4'>elif</endfold id='4'> xxx // elseif<beginfold id='4'>elif</beginfold id='4'> xxx // elseif | ||
122 | <endfold id='4'>}</endfold id='4'> | 258 | double foo(); | ||
259 | #<endfold id='4'>elif</endfold id='4'> xxx // elseif<beginfold id='4'>elif</beginfold id='4'> xxx // elseif | ||||
260 | double foo(); | ||||
261 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
262 | | ||||
263 | // error | ||||
264 | # | ||||
265 | #d | ||||
266 | # d | ||||
267 | #<beginfold id='4'>if</beginfold id='4'> | ||||
268 | #<endfold id='4'>elif</endfold id='4'><beginfold id='4'>elif</beginfold id='4'> | ||||
269 | #<endfold id='4'>endif</endfold id='4'> | ||||
270 | #<beginfold id='4'>ifndef</beginfold id='4'> | ||||
271 | #<endfold id='4'>endif</endfold id='4'> | ||||
272 | #<beginfold id='4'>ifdef</beginfold id='4'> 0 | ||||
273 | #<endfold id='4'>endif</endfold id='4'> // end | ||||
123 | 274 | | |||
124 | static uint64_t intWithSuffix = 42ull; | 275 | static uint64_t intWithSuffix = 42ull; | ||
125 | static long intWithSuffixAndPrefix = 0b0101L; | 276 | static long intWithSuffixAndPrefix = 0b0101L; | ||
126 | static int octNum = 07232; | 277 | static int octNum = 07232; | ||
127 | static int invalidOctNum = 09231; | 278 | static int invalidOctNum = 09231; | ||
128 | static uint64_t hexNum = 0xDEADBEEF42; | 279 | static uint64_t hexNum = 0xDEADBEEF42; | ||
129 | static uint64_t invalidHexNum = 0xGLDFKG; | 280 | static uint64_t invalidHexNum = 0xGLDFKG; | ||
130 | static char binNum = 0b0101010; | 281 | static char binNum = 0b0101010; | ||
131 | 282 | | |||
132 | static int64_t intWithSuffix = -42LL; | 283 | static int64_t intWithSuffix = -42LL; | ||
133 | static long intWithSuffixAndPrefix = -0b0101L; // BUG | 284 | static long intWithSuffixAndPrefix = -0b0101L; | ||
134 | static int octNum = -07232; | 285 | static int octNum = -07232; | ||
135 | static int invalidOctNum = -09231; | 286 | static int invalidOctNum = -09231; | ||
136 | static int64_t hexNum = -0xDEADBEEF42; | 287 | static int64_t hexNum = -0xDEADBEEF42; | ||
137 | static int64_t invalidHexNum = -0xGLDFKG; | 288 | static int64_t invalidHexNum = -0xGLDFKG; | ||
138 | static char binNum = -0b0101010; | 289 | static char binNum = -0b0101010; | ||
139 | 290 | | |||
140 | static uint64_t intWithSuffixWithSep = 4'2ull; | 291 | static uint64_t intWithSuffixWithSep = 4'2ull; | ||
141 | static long intWithSuffixAndPrefixWithSep = 0b0'10'1L; | 292 | static long intWithSuffixAndPrefixWithSep = 0b0'10'1L; | ||
142 | static int octNumWithSep = 07'232; | 293 | static int octNumWithSep = 07'232; | ||
143 | static int invalidOctNumWithSep = 09'23'1; | 294 | static int invalidOctNumWithSep = 09'23'1; | ||
144 | static uint64_t hexNumWithSep = 0xD'EAD'BE'EF'42; | 295 | static uint64_t hexNumWithSep = 0xD'EAD'BE'EF'42; | ||
145 | static uint64_t invalidHexNumWithSep = 0xGLD'FKG; | 296 | static uint64_t invalidHexNumWithSep = 0xGLD'FKG; | ||
146 | static char binNumWithSep = 0b0'1010'10; | 297 | static char binNumWithSep = 0b0'1010'10; | ||
147 | 298 | | |||
299 | static uint64_t invalidSep = 42'ull; | ||||
300 | static uint64_t invalidSep = 42'; | ||||
301 | | ||||
148 | static double d1 = 42.; | 302 | static double d1 = 42.; | ||
149 | static double d2 = .42; | 303 | static double d2 = .42; | ||
150 | static double d2a = -0.49; | 304 | static double d2a = -0.49; | ||
151 | static double d2b = -0.09; | 305 | static double d2b = -0.09; | ||
152 | static double d3 = 42.3e1; | 306 | static double d3 = 42.3e1; | ||
153 | static double d4 = .2e-12; | 307 | static double d4 = .2e-12; | ||
154 | static double d5 = 32.e+12; | 308 | static double d5 = 32.e+12; | ||
155 | static double invalidD1 = 32.e+a12; | 309 | static double invalidD1 = 32.e+a12; | ||
156 | static float floatQualifier = 23.123f; | 310 | static float floatQualifier = 23.123f; | ||
157 | // TODO c++17 | 311 | // Hexadecimal floating point (c++17) | ||
158 | static double d6 = 0x1ffp10; | 312 | static double d6 = 0x1ffp10; | ||
159 | static double d7 = 0X0p-1; | 313 | static double d7 = 0X0p-1; | ||
160 | static double d8 = 0x1.p0; | 314 | static double d8 = 0x1.p0; | ||
161 | static double d9 = 0xf.p-1; | 315 | static double d9 = 0xf.p-1L; | ||
162 | static double d10 = 0x0.123p-1; | 316 | static double d10 = 0x0.123p-1; | ||
163 | static double d11 = 0xa.bp10l; | 317 | static double d11 = 0xa.bp10l; | ||
164 | static double invalidD2 = 0x0.123p-a; | 318 | static double invalidD2 = 0x0.123p-a; | ||
165 | static float floatQualifier = 0xf.p-1f; | 319 | static float floatQualifier = 0xf.p-1f; | ||
166 | 320 | | |||
321 | 60min; // c++17 | ||||
322 | 23._f | ||||
323 | 23._fd | ||||
324 | 2.3_f | ||||
325 | 2.3_fd | ||||
326 | 2._f | ||||
327 | 2._fd | ||||
328 | 2e4_f | ||||
329 | 2e4_fd | ||||
330 | | ||||
331 | // error | ||||
332 | 23.fd | ||||
333 | 2e_fd | ||||
334 | 2e | ||||
335 | 1.y | ||||
336 | 1.0_E+2.0 | ||||
337 | 1.0_E +2.0 // ok | ||||
338 | 1_p+2 | ||||
339 | 1_p +2 // ok | ||||
340 | 4s.count() | ||||
341 | 4s. count() | ||||
342 | 4s .count() // ok | ||||
343 | | ||||
167 | static bool yes = true; | 344 | static bool yes = true; | ||
168 | static bool no = false; | 345 | static bool no = false; | ||
169 | 346 | | |||
170 | 347 | // *char* | |||
171 | static const char c1 = 'c'; | 348 | static const char c1 = 'c'; | ||
172 | static const char c1a = u8'c'; // TODO c++17 | 349 | static const char c1a = u8'c'; // utf-8 char (c++17) | ||
173 | static const char16_t c1b = u'c'; | 350 | static const char16_t c1b = u'c'; | ||
174 | static const char32_t c1c = U'c'; | 351 | static const char32_t c1c = U'c'; | ||
175 | static const wchar_t c1d = L'c'; | 352 | static const wchar_t c1d = L'c'; | ||
176 | static const char c2 = '\n'; | 353 | static const char c2 = '\n'; | ||
177 | static const char c2a = '\120'; // octal | 354 | static const char c2a = '\120'; // octal | ||
178 | static const char c2b = '\x1f'; // hex | 355 | static const char c2b = '\x1f'; // hex | ||
179 | static const char c2c = '\''; | 356 | static const char c2c = '\''; | ||
180 | static const char c2d = '\\'; | 357 | static const char c2d = '\\'; | ||
358 | static const wchar_t c2e = L'\x1ff'; // hex | ||||
359 | static const wchar_t c2e = U'\x1fffffff'; // hex | ||||
360 | // error | ||||
361 | '\x123'; | ||||
362 | '\u1234'; | ||||
363 | '\U12345678'; | ||||
364 | U'\u12345'; | ||||
365 | u'\u123'; | ||||
366 | U'\U1234567'; | ||||
367 | U'\U123456789'; | ||||
368 | U'\x123456789'; | ||||
369 | | ||||
370 | // string | ||||
181 | static const char* c3 = "string"; | 371 | static const char* c3 = "string"; | ||
182 | static const char* c4 = "\"string\n\t\012\x12\""; | 372 | static const char* c4 = "\"string\n\t\012\x12\""; | ||
183 | static const char* c5 = "multiline \ | 373 | static const char* c5 = "multiline \ | ||
184 | string"; | 374 | string"; | ||
185 | static const char* c6 = "multifragment" "other""string"; | 375 | static const char* c6 = "multifragment" "other""string"; | ||
186 | static const char* c6a = u8"string"; | 376 | static const char* c6a = u8"string"; | ||
187 | static const char16_t* c6b = u"string"; | 377 | static const char16_t* c6b = u"string"; | ||
188 | static const char32_t* c6c = U"string"; | 378 | static const char32_t* c6c = U"string"; | ||
189 | static const wchar_t* c6d = L"string"; | 379 | static const wchar_t* c6d = L"string"; | ||
190 | static const char* rawString1 = R"(string)"; | 380 | static const char* rawString1 = R"(string)"; | ||
191 | static const char* rawString1a = u8R"(string)"; | 381 | static const char* rawString1a = u8R"(string)"; | ||
192 | static const char16_t* rawString1b = uR"(string)"; | 382 | static const char16_t* rawString1b = uR"(string)"; | ||
193 | static const char32_t* rawString1c = UR"(string)"; | 383 | static const char32_t* rawString1c = UR"(string)"; | ||
194 | static const wchar_t* rawString1d = LR"(string\nstring)"; | 384 | static const wchar_t* rawString1d = LR"(string\nstring)"; | ||
195 | static const char* rawString2 = R"ab(string\nstring)ab"; | 385 | static const char* rawString2 = R"ab(string\nstring)ab"; | ||
196 | static const char* rawString3 = R"ab(string | 386 | static const char* rawString3 = R"ab(string | ||
197 | string)ab"; | 387 | string)ab"; | ||
388 | " %d %df fd" U"ds %d" R"(a%d)"; | ||||
389 | "\x123xsk"; | ||||
390 | u"\x123xsk"; | ||||
391 | // error | ||||
392 | u8"\x123xsk"; | ||||
198 | 393 | | |||
199 | // UDL (c++11) | 394 | // UDL (c++11) | ||
200 | 395 | | |||
201 | operator""_a(const char*); // BUG operator not colorized | 396 | operator""_a(const char*); | ||
202 | operator ""_a(const char*); // BUG colorized or | 397 | operator ""_a(const char*); | ||
203 | operator "" _a(const char*); // BUG or not colorized | 398 | operator "" _a(const char*); | ||
399 | // invalid suffix | ||||
400 | operator "" a(const char*); | ||||
401 | operator ""a(const char*); | ||||
204 | operator "" a(const char*); | 402 | operator""a(const char*); | ||
205 | operator ""a(const char*); // BUG | | |||
206 | operator""a(const char*); // BUG | | |||
207 | 403 | | |||
208 | "string"_s; // BUG colorized or | 404 | "string"_s; // user | ||
209 | "string"s; // BUG or not colorized | 405 | "string"s; // standard | ||
210 | "string"_s-b; // -b is not part of the string | 406 | "string"_s-b; // -b is not part of the string | ||
211 | 407 | | |||
212 | // Macro | 408 | // Macro | ||
213 | 409 | | |||
214 | MY_XXX; | 410 | MY_XXX; | ||
215 | BOOST_XXX; | 411 | BOOST_XXX; | ||
216 | __STDC_VERSION__; | 412 | __STDC_VERSION__; | ||
217 | __TIME__; | 413 | __TIME__; | ||
218 | __cplusplus; | 414 | __cplusplus; | ||
219 | 415 | | |||
220 | // Attributes | 416 | // Attributes | ||
221 | 417 | | |||
222 | [[noreturn]] void foo(); | 418 | [[noreturn]] void foo(); | ||
223 | [[deprecated]] void foo(); | 419 | [[deprecated]] void foo(); | ||
224 | [[deprecated("because")]] void foo(); | 420 | [[deprecated("because")]] void foo(); | ||
225 | void foo([[carries_dependency]] int); | 421 | void foo([[carries_dependency]] int); | ||
226 | 422 | | |||
227 | [[opt(1), debug]] | 423 | [[opt(1), debug]] | ||
228 | [[using CC: opt(1), debug]] // c++17 | 424 | [[using CC: opt(1), debug]] // c++17 | ||
229 | [[using CC: CC::opt(1)]] // c++17 | 425 | [[using CC: CC::opt(1)]] // c++17 | ||
230 | 426 | | |||
427 | [[gnu::assume_aligned(3'2l,2)]] void* f(); | ||||
428 | [[using gnu: assume_aligned(3)]] | ||||
429 | [[clang::assume_aligned(3)]] | ||||
430 | | ||||
231 | void f([[maybe_unused]] int val) | 431 | void f([[maybe_unused]] int val) | ||
232 | <beginfold id='4'>{</beginfold id='4'> | 432 | <beginfold id='1'>{</beginfold id='1'> | ||
233 | [[maybe_unused]] int x; | 433 | [[maybe_unused]] int x; | ||
234 | switch (x = foo(); x) <beginfold id='4'>{</beginfold id='4'> | 434 | switch (x = foo(); x) <beginfold id='1'>{</beginfold id='1'> | ||
235 | case 1: | 435 | case 1: | ||
236 | [[fallthrough]]; | 436 | [[fallthrough]]; | ||
237 | case XXX: | 437 | case XXX: | ||
238 | case Class::foo(): | 438 | case Class::foo(): | ||
239 | [[fallthrough]]; | 439 | [[fallthrough]]; | ||
240 | default: | 440 | default: | ||
241 | ; | 441 | ; | ||
242 | <endfold id='4'>}</endfold id='4'> | 442 | <endfold id='1'>}</endfold id='1'> | ||
243 | 443 | | |||
244 | // c++17: fold expression | 444 | // c++17: fold expression | ||
245 | (args + ... + (1 * 2)); | 445 | (args + ... + (1 * 2)); | ||
246 | (v.push_back(args), ...); | 446 | (v.push_back(args), ...); | ||
247 | 447 | | |||
248 | [[omp::parallel]] for (auto&& x : v) | 448 | [[omp::parallel]] for (auto&& x : v) | ||
249 | x; | 449 | x; | ||
250 | for (auto&& [first,second] : mymap) <beginfold id='4'>{</beginfold id='4'> | 450 | for (auto&& [first,second] : mymap) <beginfold id='1'>{</beginfold id='1'> | ||
251 | <endfold id='4'>}</endfold id='4'> | 451 | <endfold id='1'>}</endfold id='1'> | ||
252 | 452 | | |||
253 | auto [x, y] = foo(); | 453 | auto [x, y] = foo(); | ||
254 | 454 | | |||
255 | [x = 1, =y]()<beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>; | 455 | [x = 1, =y]()<beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'>; | ||
256 | 456 | | |||
257 | decltype((auto)) x = foo(); | 457 | decltype((auto)) x = foo(); | ||
258 | <endfold id='4'>}</endfold id='4'> | 458 | <endfold id='1'>}</endfold id='1'> | ||
259 | 459 | | |||
260 | auto f() -> decltype(foo()); | 460 | auto f() -> decltype(foo()); | ||
261 | 461 | | |||
262 | __attribute__((pure)) void f(); | 462 | __attribute__((pure)) void f(); | ||
263 | 463 | | |||
264 | label: | 464 | label: | ||
265 | goto label; | 465 | goto label; | ||
266 | 466 | | |||
267 | 467 | | |||
268 | <beginfold id='2'>//BEGIN</beginfold id='2'> region | 468 | <beginfold id='3'>//BEGIN</beginfold id='3'> region | ||
269 | // TODO comment FIXME comment ### comment BUG comment | 469 | // TODO comment FIXME comment ### comment BUG comment | ||
270 | <endfold id='2'>//END</endfold id='2'> region | 470 | <endfold id='3'>//END</endfold id='3'> region | ||
271 | | ||||
272 | #wrong | | |||
273 | 471 | | |||
274 | // \brief blah blah | 472 | // \brief blah blah | ||
275 | /// \brief blah blah | 473 | /// \brief blah blah | ||
276 | 474 | | |||
277 | <beginfold id='6'>/**</beginfold id='6'> | 475 | <beginfold id='5'>/**</beginfold id='5'> | ||
278 | * Doxygen | 476 | * Doxygen | ||
279 | * @param p1 text | 477 | * @param p1 text | ||
280 | * \brief <b>bold text</b> | 478 | * \brief <b>bold text</b> | ||
281 | * <beginfold id='13'>\dot</beginfold id='13'> | 479 | * <beginfold id='12'>\dot</beginfold id='12'> | ||
282 | * a -> b | 480 | * a -> b | ||
283 | * <endfold id='13'>\enddot</endfold id='13'> | 481 | * <endfold id='12'>\enddot</endfold id='12'> | ||
284 | * | 482 | * | ||
285 | * <beginfold id='10'>\verbatim</beginfold id='10'> | 483 | * <beginfold id='9'>\verbatim</beginfold id='9'> | ||
286 | * <dummy> | 484 | * <dummy> | ||
287 | * <endfold id='10'>\endverbatim</endfold id='10'> | 485 | * <endfold id='9'>\endverbatim</endfold id='9'> | ||
288 | * <html>text</html> | 486 | * <html>text</html> | ||
289 | <endfold id='6'>*/</endfold id='6'> | 487 | <endfold id='5'>*/</endfold id='5'> | ||
290 | 488 | | |||
291 | <endfold id='1'>#endif</endfold id='1'> | 489 | #<endfold id='4'>endif</endfold id='4'> | ||
292 | 490 | | |||
293 | // Some GNU macros, cross-referenced from gcc.xml to isocpp.xml | 491 | // Some GNU macros, cross-referenced from gcc.xml to isocpp.xml | ||
294 | __GCC_ATOMIC_CHAR16_T_LOCK_FREE | 492 | __GCC_ATOMIC_CHAR16_T_LOCK_FREE | ||
295 | __GNUC__ | 493 | __GNUC__ | ||
296 | __linux__ | 494 | __linux__ |