Scanner-level source-position utilities. Defines the character-level line/col model used by the tokenizer and grouper. Only \n advances the line counter — \r is a regular character that occupies a column. This matches sadvance! in the tokenizer.
Note: this is the scanner line model, not a universal line definition. The error display module (beme.alpha.errors/source-context) uses str/split-lines which has different line-ending semantics (splits on both \n and \r\n). The two models agree for LF sources but diverge for CRLF. See format-error for how the bridge is handled.
Scanner-level source-position utilities. Defines the character-level line/col model used by the tokenizer and grouper. Only \n advances the line counter — \r is a regular character that occupies a column. This matches sadvance! in the tokenizer. Note: this is the *scanner* line model, not a universal line definition. The error display module (beme.alpha.errors/source-context) uses str/split-lines which has different line-ending semantics (splits on both \n and \r\n). The two models agree for LF sources but diverge for CRLF. See format-error for how the bridge is handled.
(line-col->offset source line col)Convert 1-indexed line/col to a 0-indexed character offset in source. Uses the scanner line model: only \n is a line break, \r occupies a column. Returns (count source) if the target position is past the end of source. Callers that use the result for slicing should verify the offset is in bounds.
Convert 1-indexed line/col to a 0-indexed character offset in source. Uses the scanner line model: only \n is a line break, \r occupies a column. Returns (count source) if the target position is past the end of source. Callers that use the result for slicing should verify the offset is in bounds.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |