Path:
strictdoc/backend/sdoc_source_code/grammar.py
Lines:
49
Non-empty lines:
40
Non-empty lines covered with requirements:
40 / 40 (100.0%)
Functions:
0
Functions covered by requirements:
0 / 0 (0.0%)
1
REGEX_ROLE = r"[^)]+"
2
3
SOURCE_FILE_GRAMMAR = f"""
4
SourceFileTraceabilityInfo[noskipws]:5
g_parts += Part6
;7
8
Part[noskipws]:9
// The EmptyLine is needed in addition to the SingleLineString because10
// otherwise textX's get_location() ignores the whitespaces.11
// TODO: Maybe there is a trick to disable that and only use SingleLineString.12
EmptyLine | RangeMarker | LineMarker | LanguageItemMarker | SingleLineString13
;14
15
EmptyLine[noskipws]:16
'\n'
17
;18
19
RangeMarker[noskipws]:20
// It is a hard-won result: it is important that the "@relation" is within the21
// regex. Putting it next to the regex as "@relation" does not work.22
// TODO: It would be great to check this with the TextX developers.23
/^.*?@relation/24
'('25
(reqs_objs += Req[', ']) ', scope=' scope=/(range_start|range_end)/ (", role=" role=/{REGEX_ROLE}/)? ')' '\n'?
26
;27
28
LanguageItemMarker[noskipws]:29
/^.*?@relation/30
"(" (reqs_objs += Req[', ']) ', scope=' scope="file" (", role=" role=/{REGEX_ROLE}/)? ')' '\n'?
31
;32
33
LineMarker[noskipws]:34
// It is a hard-won result: it is important that the "@relation" is within the35
// regex. Putting it next to the regex as "@relation" does not work.36
// TODO: It would be great to check this with the TextX developers.37
38
/^.*?@relation/39
"(" (reqs_objs += Req[', ']) ', scope=line' (", role=" role=/{REGEX_ROLE}/)? ")" '\n'?
40
;41
42
Req[noskipws]:43
uid = /(?!scope=)[A-Za-z][A-Za-z0-9\\-\\_]+/
44
;45
46
SingleLineString[noskipws]:47
!RangeMarker /.+/ '\n'?
48
;49
"""