]>
Commit | Line | Data |
---|---|---|
1 | const ext_table = { | |
2 | 'c' : 'C', | |
3 | ||
4 | 'cc' : 'CPP', | |
5 | 'cpp' : 'CPP', | |
6 | 'cxx' : 'CPP', | |
7 | 'C' : 'CPP', | |
8 | ||
9 | 'd' : 'D', | |
10 | ||
11 | 'go' : 'GOLANG', | |
12 | ||
13 | 'gs' : 'GOLFSCRIPT', | |
14 | ||
15 | 'hs' : 'HASKELL', | |
16 | 'lhs' : 'HASKELL', | |
17 | ||
18 | 'm' : 'OBERON', | |
19 | ||
20 | 'ml' : 'OCAML', | |
21 | ||
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 | ||
33 | 'php' : 'PHP', | |
34 | ||
35 | 'py' : 'PYTHON', | |
36 | ||
37 | 'rb' : 'RUBY' | |
38 | } | |
39 | ||
40 | function divine_format() { | |
41 | const filename = q('#prog').value; | |
42 | const ext = /\.([^.]*)$/.exec(filename)[1]; | |
43 | ||
44 | if(ext_table[ext]) | |
45 | q('#prog_format').value = ext_table[ext]; | |
46 | } | |
47 | ||
48 | $(() => $('#prog').on('change', divine_format)); |