summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/src/punctuators.h
blob: ed4c3fa50e8fd1424afaf3ae16901e7609842230 (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
/**
 * @file punctuators.h
 */

#ifndef PUNCTUATORS_H_INCLUDED
#define PUNCTUATORS_H_INCLUDED

#include "uncrustify_types.h"


struct lookup_entry_t
{
   char              ch;
   char              left_in_group;
   UINT16            next_idx;
   const chunk_tag_t *tag;

   struct comperator
   {
      static char get_char(const lookup_entry_t &v)
      {
         return(v.ch);
      }


      static char get_char(char t)
      {
         return(t);
      }

      template<typename T1, typename T2>
      bool operator()(T1 const &t1, T2 const &t2)
      {
         return(get_char(t1) < get_char(t2));
      }
   };
};


/**
 * Checks if the first max. 6 chars of a given string match a punctuator
 *
 * @param str         string that will be checked, can be shorter than 6 chars
 * @param lang_flags  specifies from which language punctuators will be considered
 *
 * @retval            chunk tag of the found punctuator
 * @retval            nullptr if nothing found
 */
const chunk_tag_t *find_punctuator(const char *str, int lang_flags);


#endif /* PUNCTUATORS_H_INCLUDED */