blob: 2dd4b230bccc94360fcb41cda78edcc603b086d2 (
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
|
# Copyright (c) Pelagicore AB 2016
"""
A profile is a set of features describing a qface language profile.
The language profile tells the parser which language aspects are
supported for the particular choosen profile.
from profile import get_features, EProfile, EFeature
features = get_features(EProfile.ADVANCED)
if EFeature.CONST_OPERATION in features:
# parse this aspect of the language
"""
from enum import Enum
class EFeature(Enum):
CONST_OPERATION = 'const_operation'
EXTEND_INTERFACE = 'extend_interface'
IMPORT = 'import'
MAPS = 'maps'
DEFAULT_VALUES = 'default_values'
class EProfile(Enum):
MICRO = 'micro'
ADVANCED = 'advanced'
FULL = 'full'
_profiles = {
EProfile.MICRO: set(),
EProfile.ADVANCED: set([
EFeature.EXTEND_INTERFACE,
EFeature.IMPORT,
EFeature.MAPS,
EFeature.DEFAULT_VALUES
]),
EProfile.FULL: set(EFeature)
}
def get_features(name):
return _profiles.get(name, set())
|