Skip to content

Commit 49de287

Browse files
committed
Added Python to the live demo
1 parent 238036c commit 49de287

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bun.lockb

0 Bytes
Binary file not shown.

src/frontend/src/lib/Demo.svelte

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
import CodeMirror from "svelte-codemirror-editor";
33
import { go } from "@codemirror/lang-go";
44
import { cpp } from "@codemirror/lang-cpp";
5+
import { python } from "@codemirror/lang-python";
56
import Graph from "./Graph.svelte";
67
import type { Language } from "../../../control-flow/cfg";
78
89
export let codeGo = "func Example() {\n\tif x {\n\t\treturn\n\t}\n}";
910
export let codeC = "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}";
11+
export let codePython = "def example():\n if x:\n return";
1012
1113
let languages: {
1214
language: Language;
1315
text: string;
1416
}[] = [
1517
{ language: "Go" as Language, text: "Go" },
1618
{ language: "C" as Language, text: "C" },
19+
{ language: "Python" as Language, text: "Python (experimental)" },
1720
];
1821
let selection = languages[0];
1922
let code = codeGo;
@@ -25,6 +28,9 @@
2528
case "Go":
2629
code = codeGo;
2730
break;
31+
case "Python":
32+
code = codePython;
33+
break;
2834
}
2935
}
3036
@@ -61,13 +67,20 @@
6167
tabSize={4}
6268
lineWrapping={true}
6369
/>
64-
{:else}
70+
{:else if selection.language === "C"}
6571
<CodeMirror
6672
bind:value={codeC}
6773
lang={cpp()}
6874
tabSize={4}
6975
lineWrapping={true}
7076
/>
77+
{:else if selection.language === "Python"}
78+
<CodeMirror
79+
bind:value={codePython}
80+
lang={python()}
81+
tabSize={4}
82+
lineWrapping={true}
83+
/>
7184
{/if}
7285
</div>
7386
</div>

0 commit comments

Comments
 (0)