MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isHexEscapeSequence

Function isHexEscapeSequence

addons/misra.py:1194–1204  ·  view source on GitHub ↗

Checks that given symbols are valid hex escape sequence. hexadecimal-escape-sequence: \\x hexadecimal-digit hexadecimal-escape-sequence hexadecimal-digit Reference: n1570 6.4.4.4

(symbols)

Source from the content-addressed store, hash-verified

1192
1193
1194def isHexEscapeSequence(symbols):
1195 """Checks that given symbols are valid hex escape sequence.
1196
1197 hexadecimal-escape-sequence:
1198 \\x hexadecimal-digit
1199 hexadecimal-escape-sequence hexadecimal-digit
1200
1201 Reference: n1570 6.4.4.4"""
1202 if len(symbols) < 3 or symbols[:2] != '\\x':
1203 return False
1204 return all([s in string.hexdigits for s in symbols[2:]])
1205
1206
1207def isOctalEscapeSequence(symbols):

Callers 1

misra_4_1Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected