Add Rust, Julia, Brainfuck, PHP, OCaml and D
[gruntmaster-page.git] / js / 90-divine-format.js
1 const ext_table = {
2 'bf' : 'BRAINFUCK',
3
4 'c' : 'C',
5
6 'd' : 'D',
7
8 'cc' : 'CPP',
9 'cpp' : 'CPP',
10 'cxx' : 'CPP',
11 'C' : 'CPP',
12
13 'go' : 'GOLANG',
14
15 'gs' : 'GOLFSCRIPT',
16
17 'hs' : 'HASKELL',
18 'lhs' : 'HASKELL',
19
20 'lisp': 'SBCL',
21 'lsp' : 'SBCL',
22 'cl' : 'SBCL',
23 'l' : 'SBCL',
24
25 'java': 'JAVA',
26
27 'jl' : 'JULIA',
28
29 'ml' : 'OCAML',
30
31 'pas' : 'PASCAL',
32
33 'pl' : 'PERL',
34
35 'php' : 'PHP',
36
37 'py' : 'PYTHON',
38
39 'rb' : 'RUBY',
40
41 'rs' : 'RUST'
42 }
43
44 function divine_format() {
45 const filename = q('#prog').value;
46 const ext = /\.([^.]*)$/.exec(filename)[1];
47
48 if(ext_table[ext])
49 q('#prog_format').value = ext_table[ext];
50 }
51
52 $(() => $('#prog').on('change', divine_format));
This page took 0.023194 seconds and 4 git commands to generate.