2026-02-10 04:15:33 +00:00
|
|
|
import {Command, ParseContext, unwrapString} from "./command.js";
|
2025-11-12 03:37:32 +00:00
|
|
|
import {LexInput} from "../lexer.js";
|
2026-02-10 04:15:33 +00:00
|
|
|
import {StrVM} from "../vm.js";
|
|
|
|
|
import {Awaitable} from "../../util/types.js";
|
2025-11-12 03:37:32 +00:00
|
|
|
|
2026-02-10 05:49:30 +00:00
|
|
|
export class Lines extends Command<{}> {
|
|
|
|
|
attemptParse(context: ParseContext): {} {
|
2026-02-10 04:15:33 +00:00
|
|
|
return {}
|
2025-11-12 03:37:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDisplayName(): string {
|
|
|
|
|
return 'lines'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isParseCandidate(token: LexInput): boolean {
|
|
|
|
|
return this.isKeyword(token, 'lines')
|
|
|
|
|
}
|
2026-02-10 04:15:33 +00:00
|
|
|
|
2026-02-10 05:49:30 +00:00
|
|
|
execute(vm: StrVM): Awaitable<StrVM> {
|
|
|
|
|
return vm.replaceContextMatchingTerm({
|
|
|
|
|
destructure: sub => {
|
|
|
|
|
return sub.split('\n')
|
|
|
|
|
.map((line, idx) => ({
|
|
|
|
|
prefix: idx ? '\n' : undefined,
|
|
|
|
|
value: line,
|
|
|
|
|
}))
|
|
|
|
|
},
|
|
|
|
|
})
|
2026-02-10 04:15:33 +00:00
|
|
|
}
|
2025-11-12 03:37:32 +00:00
|
|
|
}
|