File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Editor } from "./editor/index.js" ;
2
2
import { Interpreter } from "./interpreter/index.js" ;
3
+ import { Runner } from "./runner/index.js" ;
3
4
import { UI } from "./ui/index.js" ;
4
5
5
6
const C4C = {
6
7
Editor : Editor ,
7
8
Interpreter : Interpreter ,
9
+ Runner : Runner ,
8
10
UI : UI ,
9
11
} ;
10
12
Original file line number Diff line number Diff line change @@ -65,4 +65,4 @@ const Interpreter = {
65
65
stepRunInNamespace : stepRunInNamespace ,
66
66
} ;
67
67
68
- export { Interpreter } ;
68
+ export { Interpreter , stepRun } ;
Original file line number Diff line number Diff line change
1
+ import { ProgramRunner } from "./runner.js" ;
2
+
3
+ function createRunner ( ) {
4
+ return new ProgramRunner ( ) ;
5
+ }
6
+
7
+ const Runner = {
8
+ createRunner : createRunner ,
9
+ } ;
10
+
11
+ export { Runner } ;
Original file line number Diff line number Diff line change
1
+ // import Phaser from "phaser";
2
+ import { stepRun } from "../interpreter/index.js" ;
3
+
4
+ class ProgramRunner {
5
+ constructor ( config ) {
6
+ this . programText = "" ;
7
+ this . location = [ ] ;
8
+ this . result = null ;
9
+ }
10
+
11
+ setProgram ( t ) {
12
+ this . programText = t ;
13
+ }
14
+
15
+ reset ( ) {
16
+ this . location = [ ] ;
17
+ }
18
+
19
+ step ( ) {
20
+ let [ result , loc ] = stepRun ( this . programText , this . location ) ;
21
+ this . result = result ;
22
+ this . location = loc ;
23
+ }
24
+ }
25
+
26
+ export { ProgramRunner } ;
You can’t perform that action at this time.
0 commit comments