]>
Commit | Line | Data |
---|---|---|
65d5cb3b | 1 | const ext_table = { |
502d9da0 MG |
2 | 'c' : 'C', |
3 | ||
4 | 'cc' : 'CPP', | |
5 | 'cpp' : 'CPP', | |
6 | 'cxx' : 'CPP', | |
7 | 'C' : 'CPP', | |
8 | ||
6a946025 MG |
9 | 'd' : 'D', |
10 | ||
502d9da0 MG |
11 | 'go' : 'GOLANG', |
12 | ||
13 | 'gs' : 'GOLFSCRIPT', | |
14 | ||
15 | 'hs' : 'HASKELL', | |
16 | 'lhs' : 'HASKELL', | |
17 | ||
bf660b84 MG |
18 | 'm' : 'OBERON', |
19 | ||
6a946025 MG |
20 | 'ml' : 'OCAML', |
21 | ||
502d9da0 MG |
22 | 'lisp': 'SBCL', |
23 | 'lsp' : 'SBCL', | |
24 | 'cl' : 'SBCL', | |
25 | 'l' : 'SBCL', | |
26 | ||
27 | 'java': 'JAVA', | |
28 | ||
29 | 'pas' : 'PASCAL', | |
30 | ||
31 | 'pl' : 'PERL', | |
32 | ||
6a946025 MG |
33 | 'php' : 'PHP', |
34 | ||
502d9da0 MG |
35 | 'py' : 'PYTHON', |
36 | ||
37 | 'rb' : 'RUBY' | |
38 | } | |
39 | ||
7093e9ba | 40 | function divine_format() { |
dee46c5b | 41 | const filename = q('#prog').value; |
65d5cb3b | 42 | const ext = /\.([^.]*)$/.exec(filename)[1]; |
502d9da0 MG |
43 | |
44 | if(ext_table[ext]) | |
dee46c5b | 45 | q('#prog_format').value = ext_table[ext]; |
7093e9ba MG |
46 | } |
47 | ||
8345760a | 48 | $(() => $('#prog').on('change', divine_format)); |