format token and SourcePosition structs
refactor scanner.ensureBuffer()