Skip to content

Commit 0835250

Browse files
committed
writing-addons.md: small tweaks
1 parent b6a364e commit 0835250

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

man/writing-addons.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ Output:
4545
b
4646
;
4747

48+
The `cfg.tokenlist` does not always match the raw input code exactly. For instance:
49+
* The `cfg.tokenlist` is preprocessed.
50+
* There is no typedefs in `cfg.tokenlist`.
51+
* C++ templates are instantiated when possible in `cfg.tokenlist`.
52+
* Variable declarations are sometimes splitted up.
53+
* If you don't write {} around the body for a if/else/while/for etc then those are inserted in the `cfg.tokenlist`.
54+
* ...
55+
4856
There are various properties in the `Token` class and some of those will be discussed below.
4957

5058

@@ -249,8 +257,8 @@ Output:
249257

250258
### Special tokenlist tweaks and else if
251259

252-
The cfg.tokenlist has some tweaks. In C/C++ code it is optional to use `{` and `}` around the conditional code,
253-
if the conditional code is only a single statement. However Cppcheck adds "{" and "}" tokens if those are missing.
260+
The `cfg.tokenlist` has some tweaks. In C/C++ code it is optional to use `{` and `}` around the if/else/for/while body,
261+
if the body is only a single statement. However Cppcheck adds "{" and "}" tokens if those are missing.
254262

255263
One more tweak is that in cfg.tokenlist there is no "else if" scope.
256264

@@ -264,7 +272,7 @@ Example C code:
264272
++x;
265273
}
266274

267-
The tokens in the cfg.tokenlist will look like this:
275+
The tokens in the `cfg.tokenlist` will look like this:
268276

269277
void foo(int x)
270278
{

0 commit comments

Comments
 (0)