File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 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\t if x {\n\t\t return\n\t }\n }" ;
910 export let codeC = " void main() {\n\t if (x) {\n\t\t return;\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 ;
2528 case " Go" :
2629 code = codeGo ;
2730 break ;
31+ case " Python" :
32+ code = codePython ;
33+ break ;
2834 }
2935 }
3036
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 >
You can’t perform that action at this time.
0 commit comments