API reference
python:arxjit:arxjit.locations.char_column
function char_column
char_column(line: str, byte_offset: int) -> int
Source: packages/arxjit/src/arxjit/locations.py:20
Convert a zero-based UTF-8 byte offset to a one-based column.
ast column offsets are zero-based UTF-8 byte offsets into their source line, but Diagnostic.column is documented as a one-based Unicode character column. Decoding the byte prefix back to text and measuring its length performs the conversion exactly, including when multi-byte characters appear before the target column.
Parameters
-
line — Type: str; The real source line the offset was reported against.
-
byte_offset — Type: int
Returns
Type: int