forked from uncrustify/uncrustify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalign_stack.h
More file actions
61 lines (51 loc) · 1.32 KB
/
align_stack.h
File metadata and controls
61 lines (51 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* @file align_stack.h
* Manages a align stack, which is just a pair of chunk stacks with a few
* fancy functions.
*
* @author Ben Gardner
* @license GPL v2+
*/
#include "ChunkStack.h"
class AlignStack
{
public:
enum StarStyle
{
SS_IGNORE, // don't look for prev stars
SS_INCLUDE, // include prev * before add
SS_DANGLE // include prev * after add
};
ChunkStack m_aligned; /* contains the token that is aligned */
ChunkStack m_skipped; /* contains the tokens sent to Add() */
int m_max_col;
int m_min_col;
int m_span;
int m_thresh;
int m_seqnum;
int m_nl_seqnum;
int m_gap;
bool m_right_align;
StarStyle m_star_style;
StarStyle m_amp_style;
AlignStack() :
m_max_col(0), m_min_col(0), m_span(0), m_thresh(0), m_seqnum(0),
m_nl_seqnum(0), m_gap(0), m_right_align(false),
m_star_style(SS_IGNORE), m_amp_style(SS_IGNORE),
m_last_added(0)
{
}
~AlignStack()
{
}
void Start(int span, int threshold = 0);
void Add(chunk_t *pc, int seqnum = 0);
void NewLines(int cnt);
void Flush();
void Reset();
void End();
protected:
int m_last_added; /* 0=none, 1=aligned, 2=skipped */
void ReAddSkipped();
ChunkStack m_scratch; /* used in ReAddSkipped() */
};