From 0835250d7fdc1a1a1cb9965d04f8db2742352bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 19 Jun 2022 19:18:52 +0200 Subject: [PATCH] writing-addons.md: small tweaks --- man/writing-addons.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/man/writing-addons.md b/man/writing-addons.md index 23194f204..a89370530 100644 --- a/man/writing-addons.md +++ b/man/writing-addons.md @@ -45,6 +45,14 @@ Output: b ; +The `cfg.tokenlist` does not always match the raw input code exactly. For instance: + * The `cfg.tokenlist` is preprocessed. + * There is no typedefs in `cfg.tokenlist`. + * C++ templates are instantiated when possible in `cfg.tokenlist`. + * Variable declarations are sometimes splitted up. + * If you don't write {} around the body for a if/else/while/for etc then those are inserted in the `cfg.tokenlist`. + * ... + There are various properties in the `Token` class and some of those will be discussed below. @@ -249,8 +257,8 @@ Output: ### Special tokenlist tweaks and else if -The cfg.tokenlist has some tweaks. In C/C++ code it is optional to use `{` and `}` around the conditional code, -if the conditional code is only a single statement. However Cppcheck adds "{" and "}" tokens if those are missing. +The `cfg.tokenlist` has some tweaks. In C/C++ code it is optional to use `{` and `}` around the if/else/for/while body, +if the body is only a single statement. However Cppcheck adds "{" and "}" tokens if those are missing. One more tweak is that in cfg.tokenlist there is no "else if" scope. @@ -264,7 +272,7 @@ Example C code: ++x; } -The tokens in the cfg.tokenlist will look like this: +The tokens in the `cfg.tokenlist` will look like this: void foo(int x) {