source.precompile   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5

1 Function

Rating   Name   Duplication   Size   Complexity  
A precompile() 0 19 5
1
from source.__config__ import PREUDOMSTRUCTION
2
3
4
def precompile(source: str):
5
6
    lines = source.split('\n')
7
    # Location Counter
8
    LC = 0
9
    symbols_address = dict()
10
11
    for line in lines:
12
        strings = line.split()
13
        if strings[0][-1] == ',':
14
            symbol = strings[0][:-1]
15
            symbols_address[symbol] = str(LC)
16
        elif strings[0] == PREUDOMSTRUCTION[0]:
17
            LC = int(strings[1]) - 1
18
        elif strings[0] == PREUDOMSTRUCTION[3]:
19
            break
20
        LC += 1
21
22
    return symbols_address
23