diff options
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.78.1/src/align_add.cpp')
-rw-r--r-- | debian/uncrustify-trinity/uncrustify-trinity-0.78.1/src/align_add.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/src/align_add.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/src/align_add.cpp new file mode 100644 index 00000000..ae8460d2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/src/align_add.cpp @@ -0,0 +1,58 @@ +/** + * @file align_add.cpp + * + * @author Guy Maurel + * split from align.cpp + * @author Ben Gardner + * @license GPL v2+ + */ + +#include "align_add.h" +#include "uncrustify.h" + + +void align_add(ChunkStack &cs, Chunk *pc, size_t &max_col) +{ + LOG_FUNC_ENTRY(); + + size_t min_col; + Chunk *prev = Chunk::NullChunkPtr; + + if (pc->IsNotNullChunk()) + { + prev = pc->GetPrev(); + } + + if ( prev->IsNullChunk() + || prev->IsNewline()) + { + min_col = 1; + LOG_FMT(LALADD, "%s(%d): pc orig line=%zu, pc->col=%zu max_col=%zu min_col=%zu\n", + __func__, __LINE__, pc->GetOrigLine(), pc->GetColumn(), max_col, min_col); + } + else + { + if (prev->Is(CT_COMMENT_MULTI)) + { + min_col = prev->GetOrigColEnd() + 1; + } + else + { + min_col = prev->GetColumn() + prev->Len() + 1; + } + LOG_FMT(LALADD, "%s(%d): pc orig line=%zu, pc->col=%zu max_col=%zu min_col=%zu multi:%s prev->col=%zu prev->Len()=%zu %s\n", + __func__, __LINE__, pc->GetOrigLine(), pc->GetColumn(), max_col, min_col, (prev->Is(CT_COMMENT_MULTI)) ? "Y" : "N", + (prev->Is(CT_COMMENT_MULTI)) ? prev->GetOrigColEnd() : (UINT32)prev->GetColumn(), prev->Len(), get_token_name(prev->GetType())); + } + + if (cs.Empty()) + { + max_col = 0; + } + cs.Push_Back(pc); + + if (min_col > max_col) + { + max_col = min_col; + } +} // align_add |