summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/combine_skip.h
blob: 8bd9134e8474fa521018083bb8fc2c9f8b5ab2b7 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
 * @file combine_skip.h
 *
 * @author  Guy Maurel
 * @license GPL v2+
 * extract from combine.cpp
 */

#ifndef COMBINE_SKIP_H_INCLUDED
#define COMBINE_SKIP_H_INCLUDED

#include "chunk.h"


/**
 * Skips the D 'align()' statement and the colon, if present.
 *    align(2) int foo;  -- returns 'int'
 *    align(4):          -- returns 'int'
 *    int bar;
 */
Chunk *skip_align(Chunk *start);


/**
 * Skips chunks in the forward direction and attempts to find the
 * chunk associated with the end of the current expression; returns
 * the first chunk to satisfy one of the following:
 * 1) Chunk is a comma or semicolon at the level of the starting chunk
 * 2) Preceding chunk is at higher template nest level relative to the
 *    current chunk under test
 */
Chunk *skip_expression(Chunk *pc);


/**
 * Skips chunks in the reverse direction and attempts to find the
 * chunk associated with the start of the current expression; returns
 * the first chunk to satisfy one of the following:
 * 1) Chunk is a comma or semicolon at the level of the starting chunk
 * 2) Preceding chunk is at lower template nest level relative to the
 *    current chunk under test
 */
Chunk *skip_expression_rev(Chunk *pc);


/**
 * Skips chunks in the forward direction and attempts to find the
 * chunk associated with the end of the current expression; specifically,
 * the function returns that which immediately precedes a chunk
 * satisfying one of the following:
 * 1) Next chunk is a comma or semicolon at the level of the starting chunk
 * 2) Preceding chunk is at a higher template nest level relative to the
 *    subsequent chunk
 */
Chunk *skip_to_expression_end(Chunk *pc);


/**
 * Skips chunks in the reverse direction and attempts to find the chunk
 * associated with the start of the current expression; specifically,
 * the function returns that which immediately follows a chunk
 * satisfying one of the following:
 * 1) Prior chunk is a comma or semicolon at the level of the starting chunk
 * 2) Preceding chunk is at a lower template nest level relative to the
 *    subsequent chunk
 */
Chunk *skip_to_expression_start(Chunk *pc);


/**
 * Skips over the rest of the template if ang_open is indeed a CT_ANGLE_OPEN.
 * Points to the chunk after the CT_ANGLE_CLOSE.
 * If the chunk isn't an CT_ANGLE_OPEN, then it is returned.
 */
Chunk *skip_template_next(Chunk *ang_open);


/**
 * Skips over the rest of the template if ang_close is indeed a CT_ANGLE_CLOSE.
 * Points to the chunk before the CT_ANGLE_OPEN
 * If the chunk isn't an CT_ANGLE_CLOSE, then it is returned.
 */
Chunk *skip_template_prev(Chunk *ang_close);


//! Skips to the start of the next statement.
Chunk *skip_to_next_statement(Chunk *pc);


/**
 * Skips the rest of the array definitions if ary_def is indeed a
 * CT_TSQUARE or CT_SQUARE_OPEN
 */
Chunk *skip_tsquare_next(Chunk *ary_def);


/**
 * If pc is CT_ATTRIBUTE, then skip it and everything preceding the closing
 * paren; return the chunk marked CT_FPAREN_CLOSE
 * If the chunk isn't a CT_ATTRIBUTE, then it is returned.
 */
Chunk *skip_attribute(Chunk *attr);


/**
 * If attr is CT_ATTRIBUTE, then skip it and the parens and return the chunk
 * after the CT_FPAREN_CLOSE.
 * If the chunk isn't an CT_ATTRIBUTE, then it is returned.
 */
Chunk *skip_attribute_next(Chunk *attr);


/**
 * If fp_close is a CT_FPAREN_CLOSE with a parent of CT_ATTRIBUTE, then skip it
 * and the '__attribute__' thingy and return the chunk before CT_ATTRIBUTE.
 * Otherwise return fp_close.
 */
Chunk *skip_attribute_prev(Chunk *fp_close);


/**
 * If pc is CT_DECLSPEC, then skip it and everything preceding the closing
 * paren; return the chunk marked CT_FPAREN_CLOSE
 * If the chunk isn't a CT_DECLSPEC, then it is returned.
 */
Chunk *skip_declspec(Chunk *pc);


/**
 * If pc is CT_DECLSPEC, then skip it and the parens and return the chunk
 * after the CT_FPAREN_CLOSE.
 * If the chunk isn't a CT_DECLSPEC, then it is returned.
 */
Chunk *skip_declspec_next(Chunk *pc);


#endif /* COMBINE_SKIP_H_INCLUDED */