forked from rperlste/UniversalCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacterSet.h
74 lines (70 loc) · 1.37 KB
/
CharacterSet.h
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
#ifndef _characterSet
#define _characterSet
namespace CharacterSet {
static enum CharacterSet {
Letter,
Digit,
Blank,
Plus,
Minus,
Equals,
Colon,
Comma,
SemiColon,
LParen,
RParen,
Underscore,
Hash,
Tab,
EOL,
Other
};
static CharacterSet getCharacterSetValue( const char& characterValue ){
// Letter
if( ( characterValue >= 'a' && characterValue <= 'z' )
|| ( characterValue >= 'A' && characterValue <= 'Z' ))
return Letter;
// Digit
else if( characterValue >= '0' && characterValue <= '9' )
return Digit;
// Blank
else if( characterValue == ' ' || characterValue == 32 )
return Blank;
// Plus
else if( characterValue == '+' )
return Plus;
// Minus
else if( characterValue == '-' )
return Minus;
// Equals
else if( characterValue == '=' )
return Equals;
// Colon
else if( characterValue == ':' )
return Colon;
// Comma
else if( characterValue == ',' )
return Comma;
// Semicolon
else if( characterValue == ';' )
return SemiColon;
// LParen
else if( characterValue == '(' )
return LParen;
// RParen
else if( characterValue == ')' )
return RParen;
// Underscore
else if( characterValue == '_' )
return Underscore;
// Tab
else if( characterValue == '\t' )
return Tab;
// EOL
else if( characterValue == '\n' )
return EOL;
else
return Other;
}
}
#endif