-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
21 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
inline DefaultScript to Script | ||
|
||
尝试用 node:test 而不用 test-runner | ||
|
||
- 因为每次开启 node 解释器有严重的 overhead。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import { createErrorReport } from "../lang/errors" | ||
import { executeStmts } from "../lang/execute" | ||
import type { Mod } from "../lang/mod" | ||
import { parseStmts } from "../lang/syntax" | ||
|
||
export abstract class Script { | ||
abstract mod: Mod | ||
abstract text: string | ||
abstract run(): void | ||
export class Script { | ||
constructor( | ||
public mod: Mod, | ||
public text: string, | ||
) {} | ||
|
||
run(): void { | ||
try { | ||
const stmts = parseStmts(this.text) | ||
executeStmts(this.mod, stmts) | ||
} catch (error) { | ||
throw createErrorReport(error, this.text) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.