blob: c23670d63447fe61e1bd0e20cbfc96ac79093558 (
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
|
/*
SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com>
SPDX-License-Identifier: MIT
*/
#ifndef KSYNTAXHIGHLIGHTING_WORDDELIMITERS_P_H
#define KSYNTAXHIGHLIGHTING_WORDDELIMITERS_P_H
#include <QString>
#include <bitset>
namespace KSyntaxHighlighting
{
/**
* Represents a list of character that separates 2 words.
*
* Default delimiters are .():!+*,-<=>%&/;?[]^{|}~\, space (' ') and tabulator ('\t').
*
* @see Rule
* @since 5.74
*/
class WordDelimiters
{
public:
WordDelimiters();
/**
* Initialize with a default delimiters.
*/
explicit WordDelimiters(QStringView str);
/**
* Returns @c true if @p c is a word delimiter; otherwise returns @c false.
*/
bool contains(QChar c) const;
/**
* Appends each character of @p s to word delimiters.
*/
void append(QStringView s);
/**
* Removes each character of @p s from word delimiters.
*/
void remove(QStringView c);
private:
/**
* An array which represents ascii characters for very fast lookup.
* The character is used as an index and the value @c true indicates a word delimiter.
*/
std::bitset<128> asciiDelimiters;
/**
* Contains characters that are not ascii and is empty for most syntax definition.
*/
QString notAsciiDelimiters;
};
}
#endif
|