import type { Token } from './Token.ts' export function tokenizeInput(input: string): Array { const tokens = new Array() let idx = 0 while (idx < input.length) { const idxOfNextNewLine = input.indexOf('\n', idx) const start = idx const end = idxOfNextNewLine === -1 ? input.length : idxOfNextNewLine const str = input.slice(start, end) tokens.push({ idx, str, }) idx = end + 1 // Skip \n character } return tokens }