summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/combine_tools.h
blob: e18fe92a1e96cd7c146ddfb78dc22c51442717d6 (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
/**
 * @file combine_tools.h
 *
 * @author  Guy Maurel
 * @license GPL v2+
 * extract from combine.cpp
 */

#ifndef COMBINE_TOOLS_H_INCLUDED
#define COMBINE_TOOLS_H_INCLUDED

#include "chunk.h"
#include "ChunkStack.h"

/**
 * Checks to see if a series of chunks could be a C++ parameter
 * FOO foo(5, &val);
 *
 * WORD means CT_WORD or CT_TYPE
 *
 * "WORD WORD"          ==> true
 * "QUALIFIER ??"       ==> true
 * "TYPE"               ==> true
 * "WORD"               ==> true
 * "WORD.WORD"          ==> true
 * "WORD::WORD"         ==> true
 * "WORD * WORD"        ==> true
 * "WORD & WORD"        ==> true
 * "NUMBER"             ==> false
 * "STRING"             ==> false
 * "OPEN PAREN"         ==> false
 *
 * @param start  the first chunk to look at
 * @param end    the chunk after the last one to look at
 */
bool can_be_full_param(Chunk *start, Chunk *end);


//! Scan backwards to see if we might be on a type declaration
bool chunk_ends_type(Chunk *start);


bool chunkstack_match(ChunkStack &cs, Chunk *pc);


///**
// * Simply change any STAR to PTR_TYPE and WORD to TYPE
// *
// * @param start  points to the open paren
// */
void fix_fcn_def_params(Chunk *pc);


void flag_series(Chunk *start, Chunk *end, T_PcfFlags set_flags, T_PcfFlags clr_flags = {}, E_Scope nav = E_Scope::ALL);


/*
 * Checks whether or not a given chunk has a parent cpp template,
 * and if so returns the associated angle bracket nest level
 * with respect to the root parent template; returns 0 if
 * the chunk is not part of a template parameter list
 */
size_t get_cpp_template_angle_nest_level(Chunk *pc);


/**
 * Parse off the types in the D template args, adds to cs
 * returns the close_paren
 */
Chunk *get_d_template_types(ChunkStack &cs, Chunk *open_paren);


//! help function for mark_variable_definition...
bool go_on(Chunk *pc, Chunk *start);


bool is_ucase_str(const char *str, size_t len);


void make_type(Chunk *pc);

Chunk *set_paren_parent(Chunk *start, E_Token parent);


#endif /* COMBINE_TOOLS_H_INCLUDED */