diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-12-04 19:16:43 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-12-04 19:38:30 +0900 |
commit | fdcd72088371b3d8dfd31f2a5159861ce0be5535 (patch) | |
tree | 06c160cc34157344f62b6c19af297858a0e57157 /debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp | |
parent | a5d7db3b2c6171ea9e76b84155d2dfb66c243e5a (diff) | |
download | extra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.tar.gz extra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.zip |
uncrustify-trinity: updated based on upstream version 0.76.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp')
-rw-r--r-- | debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp new file mode 100644 index 00000000..b97d9ddf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/align_typedefs.cpp @@ -0,0 +1,65 @@ +/** + * @file align_typedefs.cpp + * + * @author Guy Maurel + * split from align.cpp + * @author Ben Gardner + * @license GPL v2+ + */ + +#include "align_typedefs.h" + +#include "align_stack.h" +#include "log_rules.h" + +constexpr static auto LCURRENT = LALTD; + +using namespace uncrustify; + + +void align_typedefs(size_t span) +{ + LOG_FUNC_ENTRY(); + + AlignStack as; + + as.Start(span); + log_rule_B("align_typedef_gap"); + as.m_gap = options::align_typedef_gap(); + log_rule_B("align_typedef_star_style"); + as.m_star_style = static_cast<AlignStack::StarStyle>(options::align_typedef_star_style()); + log_rule_B("align_typedef_amp_style"); + as.m_amp_style = static_cast<AlignStack::StarStyle>(options::align_typedef_amp_style()); + + Chunk *c_typedef = Chunk::NullChunkPtr; + Chunk *pc = Chunk::GetHead(); + + while (pc->IsNotNullChunk()) + { + if (pc->IsNewline()) + { + as.NewLines(pc->GetNlCount()); + c_typedef = Chunk::NullChunkPtr; + } + else if (c_typedef->IsNotNullChunk()) + { + if (pc->TestFlags(PCF_ANCHOR)) + { + as.Add(pc); + LOG_FMT(LALTD, "%s(%d): typedef @ %zu:%zu, tag '%s' @ %zu:%zu\n", + __func__, __LINE__, c_typedef->GetOrigLine(), c_typedef->GetOrigCol(), + pc->Text(), pc->GetOrigLine(), pc->GetOrigCol()); + c_typedef = Chunk::NullChunkPtr; + } + } + else + { + if (pc->Is(CT_TYPEDEF)) + { + c_typedef = pc; + } + } + pc = pc->GetNext(); + } + as.End(); +} // align_typedefs |