l0_string_escape.py
Module: l0_string_escape
Source: compiler/stage1_py/l0_string_escape.py Language: Python
Symbols
Namespace l0_string_escape
Variable l0_string_escape._HEX_CHARS
1
str l0_string_escape._HEX_CHARS
Variable l0_string_escape._OCT_CHARS
1
str l0_string_escape._OCT_CHARS
Variable l0_string_escape._TRIGRAPH_THIRD_BYTES
1
l0_string_escape._TRIGRAPH_THIRD_BYTES
Variable l0_string_escape._SIMPLE_ESCAPES
1
dict l0_string_escape._SIMPLE_ESCAPES
Function l0_string_escape.decode_l0_string_token
1
bytes l0_string_escape.decode_l0_string_token(str text)
Decode an L0 string literal payload to raw bytes.
Processes C-style escape sequences including hex, octal, and Unicode.
Parameters:
text: The string literal content (without surrounding quotes).
Returns: The decoded bytes.
Function l0_string_escape.encode_c_string_bytes
1
str l0_string_escape.encode_c_string_bytes(bytes data)
Encode raw bytes into a C-safe string literal body.
Uses standard escapes for common control characters and fixed-width octal escapes for other non-printable bytes to avoid ambiguity in C.
Parameters:
data: The raw bytes to encode.
Returns: A string containing the encoded C literal content (without quotes).
Class l0_string_escape::EscapeDecodeError
Raised when an invalid escape sequence is encountered during decoding.
Member Data l0_string_escape.EscapeDecodeError.code
1
str code
Member Data l0_string_escape.EscapeDecodeError.details
1
str details