Debian Codegraph @

mesonbuild/interpreterbase/operator.py

raw
1 # SPDX-License-Identifier: Apache-2.0
2
3 from enum import Enum
4 import typing as T
5
6 class MesonOperator(Enum):
7 # Arithmetic
8 PLUS = '+'
9 MINUS = '-'
10 TIMES = '*'
11 DIV = '/'
12 MOD = '%'
13
14 UMINUS = 'uminus'
15
16 # Logic
17 NOT = 'not'
18
19 # Should return the boolsche interpretation of the value (`'' == false` for instance)
20 BOOL = 'bool()'
21
22 # Comparison
23 EQUALS = '=='
24 NOT_EQUALS = '!='
25 GREATER = '>'
26 LESS = '<'
27 GREATER_EQUALS = '>='
28 LESS_EQUALS = '<='
29
30 # Container
31 IN = 'in'
32 NOT_IN = 'not in'
33 INDEX = '[]'
34
35 # Accessing this directly is about 9x faster than calling MesonOperator(s),
36 # and about 3 times faster than a staticmethod
37 MAPPING: T.Mapping[str, MesonOperator] = {x.value: x for x in MesonOperator}