ScanResult

struct ScanResult

The partial products of one deterministic scanner pass.

Comments are deliberately separate from parser tokens so ordinary parsing pays no trivia cost. On error, tokens contains the valid prefix and error_pos points where scanning stopped; callers may still parse that prefix.

Properties

let tokens: [Token]

Non-comment tokens in source order.

let comments: [Comment]

Line-comment spans in source order.

let error: String?

The scanner error message, when tokenization stopped early.

let error_pos: Int

The scan cursor when the error was detected (line/col derive from it); meaningless without an error.