diff options
author | RabsRincon <rubrinbla@gmail.com> | 2018-02-07 23:58:21 +0100 |
---|---|---|
committer | RabsRincon <rubrinbla@gmail.com> | 2018-02-07 23:58:21 +0100 |
commit | 62e68304e9c05bc045feacc5446ed81243f5bb91 (patch) | |
tree | b3ab9503373d7b3e658947c14ef9d97c3f86b942 | |
parent | 24d530498dae0991748099694be03b3753d2a7f2 (diff) | |
download | compiler-explorer-62e68304e9c05bc045feacc5446ed81243f5bb91.tar.gz compiler-explorer-62e68304e9c05bc045feacc5446ed81243f5bb91.zip |
Format files
-rwxr-xr-x | app.js | 5 | ||||
-rw-r--r-- | lib/cfg.js | 28 | ||||
-rw-r--r-- | lib/cl-support.js | 31 | ||||
-rw-r--r-- | lib/csp.js | 2 | ||||
-rw-r--r-- | lib/google.js | 1 | ||||
-rw-r--r-- | lib/pascal-support.js | 24 | ||||
-rw-r--r-- | lib/symbol-store.js | 8 | ||||
-rw-r--r-- | lib/utils.js | 2 | ||||
-rw-r--r-- | static/alert.js | 2 | ||||
-rw-r--r-- | static/analytics.js | 8 | ||||
-rw-r--r-- | static/ansi-to-html.js | 4 | ||||
-rw-r--r-- | static/cfg-view.js | 19 | ||||
-rw-r--r-- | static/changelog.html | 59 | ||||
-rw-r--r-- | static/colours.css | 2 | ||||
-rw-r--r-- | static/components.js | 2 | ||||
-rw-r--r-- | static/conformance-view.js | 4 | ||||
-rw-r--r-- | static/d-mode.js | 30 | ||||
-rw-r--r-- | static/diff.js | 4 | ||||
-rw-r--r-- | static/editor.js | 10 | ||||
-rw-r--r-- | static/explorer.css | 1 | ||||
-rw-r--r-- | static/fontscale.js | 4 | ||||
-rw-r--r-- | static/haskell-mode.js | 542 | ||||
-rw-r--r-- | static/main.js | 304 | ||||
-rw-r--r-- | static/monaco-loader.js | 6 | ||||
-rw-r--r-- | static/monaco.js | 1 | ||||
-rw-r--r-- | static/options.js | 4 | ||||
-rw-r--r-- | static/output.js | 4 | ||||
-rw-r--r-- | static/pascal-mode.js | 244 | ||||
-rw-r--r-- | static/rust-mode.js | 6 | ||||
-rw-r--r-- | static/sharing.js | 210 | ||||
-rw-r--r-- | static/themes/contrast-theme.css | 2 | ||||
-rw-r--r-- | static/toggles.js | 92 | ||||
-rw-r--r-- | static/url.js | 2 |
33 files changed, 865 insertions, 802 deletions
@@ -91,7 +91,6 @@ let gitReleaseName = ""; const wantedLanguage = opts.language || null; - const webpackConfig = require('./webpack.config.js')[1], webpackCompiler = require('webpack')(webpackConfig), manifestName = 'manifest.json', @@ -594,10 +593,10 @@ Promise.all([findCompilers(), aws.initConfig(awsProps)]) //this will break assets in dev mode for now return '/dist/' + path; } - if(staticManifest.hasOwnProperty(path)) { + if (staticManifest.hasOwnProperty(path)) { return "dist/" + staticManifest[path]; } - if(assetManifest.hasOwnProperty(path)) { + if (assetManifest.hasOwnProperty(path)) { return "dist/assets/" + assetManifest[path]; } logger.warn("Requested an asset I don't know about"); diff --git a/lib/cfg.js b/lib/cfg.js index 8ffa82838..08a069bd6 100644 --- a/lib/cfg.js +++ b/lib/cfg.js @@ -92,7 +92,7 @@ const clangX86 = { isJmpInstruction: x => x.trim()[0] === 'j' }; -function splitToFunctions (asmArr, isEnd) { +function splitToFunctions(asmArr, isEnd) { if (asmArr.length === 0) return []; const result = []; let first = 1; @@ -112,7 +112,7 @@ function splitToFunctions (asmArr, isEnd) { return result; } -function splitToBasicBlocks (asmArr, range, isEnd, isJmp) { +function splitToBasicBlocks(asmArr, range, isEnd, isJmp) { let first = range.start; const last = range.end; if (first === last) return []; @@ -145,7 +145,7 @@ function splitToBasicBlocks (asmArr, range, isEnd, isJmp) { return result; } -function splitToCanonicalBasicBlock (basicBlock) { +function splitToCanonicalBasicBlock(basicBlock) { const actionPos = basicBlock.actionPos; let actPosSz = actionPos.length; if (actionPos[actPosSz - 1] + 1 === basicBlock.end) { @@ -186,23 +186,25 @@ function splitToCanonicalBasicBlock (basicBlock) { } } -function concatInstructions (asmArr, first, last) { +function concatInstructions(asmArr, first, last) { return _.chain(asmArr.slice(first, last)) .map(x => x.text.substr(0, 50)) .value() .join('\n'); } -function makeNodes (asmArr, arrOfCanonicalBasicBlock) { - return _.map(arrOfCanonicalBasicBlock, e => {return { - id: e.nameId, - label: `${e.nameId}${e.nameId.indexOf(':') !== -1 ? '' : ':'}\n${concatInstructions(asmArr, e.start, e.end)}`, - color: '#99ccff', - shape: 'box' - };}); +function makeNodes(asmArr, arrOfCanonicalBasicBlock) { + return _.map(arrOfCanonicalBasicBlock, e => { + return { + id: e.nameId, + label: `${e.nameId}${e.nameId.indexOf(':') !== -1 ? '' : ':'}\n${concatInstructions(asmArr, e.start, e.end)}`, + color: '#99ccff', + shape: 'box' + }; + }); } -function makeEdges (asmArr, arrOfCanonicalBasicBlock, rules) { +function makeEdges(asmArr, arrOfCanonicalBasicBlock, rules) { const edge = {}; const edges = []; @@ -272,7 +274,7 @@ function makeEdges (asmArr, arrOfCanonicalBasicBlock, rules) { } -function generateCfgStructure (version, asmArr) { +function generateCfgStructure(version, asmArr) { const rules = version.includes('clang') ? clangX86 : gccX86; const code = rules.filterData(asmArr); const funcs = splitToFunctions(code, rules.isFunctionEnd); diff --git a/lib/cl-support.js b/lib/cl-support.js index 15fcc04ce..e84ec60df 100644 --- a/lib/cl-support.js +++ b/lib/cl-support.js @@ -24,46 +24,43 @@ "use strict"; -var fs = require('fs-extra'), +const fs = require('fs-extra'), path = require('path'), _ = require('underscore-node'), utils = require('./utils'); function OverwriteAsmLines(result, demangleOutput) { - var lines = utils.splitLines(demangleOutput); - for (var i = 0; i < result.asm.length; ++i) + const lines = utils.splitLines(demangleOutput); + for (let i = 0; i < result.asm.length; ++i) result.asm[i].text = lines[i]; return result; } function RunCLDemangler(compiler, result) { if (!result.okToCache) return result; - var demangler = compiler.compiler.demangler; + let demangler = compiler.compiler.demangler; if (!demangler) return result; - var asmFileContent = _.pluck(result.asm, 'text').join("\n"); + const asmFileContent = _.pluck(result.asm, 'text').join("\n"); if (demangler.toLowerCase().endsWith("undname.exe")) { - return compiler.newTempDir().then(function (tmpDir) { - var tmpfile = path.join(tmpDir, "output.s"); + return compiler.newTempDir().then(tmpDir => { + const tmpfile = path.join(tmpDir, "output.s"); fs.writeFileSync(tmpfile, asmFileContent); - var tmpFileAsArgument = compiler.filename(tmpfile); + const tmpFileAsArgument = compiler.filename(tmpfile); return compiler.exec(demangler, [tmpFileAsArgument], compiler.getDefaultExecOptions()) - .then(function (demangleResult) { - fs.unlink(tmpfile, function() { - fs.remove(tmpDir, function() {}); + .then(demangleResult => { + fs.unlink(tmpfile, () => { + fs.remove(tmpDir, () => {}); + }); + return OverwriteAsmLines(result, demangleResult.stdout); }); - - return OverwriteAsmLines(result, demangleResult.stdout); - }); }); } else { return compiler.exec(demangler, [], {input: asmFileContent}) - .then(function (demangleResult) { - return OverwriteAsmLines(result, demangleResult.stdout); - }); + .then(demangleResult => OverwriteAsmLines(result, demangleResult.stdout)); } } diff --git a/lib/csp.js b/lib/csp.js index 7a068425b..c632126c9 100644 --- a/lib/csp.js +++ b/lib/csp.js @@ -30,7 +30,7 @@ const data = { 'style-src': ["'self'", "'unsafe-inline'", "'report-sample'", 'https://*.godbolt.org', 'localhost:*'], 'script-src': ["'self'", "'unsafe-inline'", "'report-sample'", 'data:', 'https://*.godbolt.org', 'localhost:*', 'https://*.twitter.com', 'https://www.fullstory.com', 'https://www.google-analytics.com', 'https://apis.google.com', 'https://ssl.google-analytics.com'], - 'img-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'data:', 'https://www.google-analytics.com/' , 'https://syndication.twitter.com', + 'img-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'data:', 'https://www.google-analytics.com/', 'https://syndication.twitter.com', 'https://ssl.google-analytics.com', 'https://csi.gstatic.com'], 'font-src': ["'self'", 'data:', 'https://*.godbolt.org', 'localhost:*', 'https://fonts.gstatic.com', 'https://themes.googleusercontent.com'], 'frame-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'https://www.google-analytics.com', 'https://accounts.google.com/', diff --git a/lib/google.js b/lib/google.js index 8801cab61..432fc304e 100644 --- a/lib/google.js +++ b/lib/google.js @@ -22,7 +22,6 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. const https = require('https'), - logger = require('./logger').logger, API_BASE = 'https://www.googleapis.com/urlshortener/v1/url'; class ShortLinkResolver { diff --git a/lib/pascal-support.js b/lib/pascal-support.js index 6de4fc80e..0b331510b 100644 --- a/lib/pascal-support.js +++ b/lib/pascal-support.js @@ -23,7 +23,7 @@ // POSSIBILITY OF SUCH DAMAGE. "use strict"; -var SymbolStore = require("./symbol-store").SymbolStore; +const SymbolStore = require("./symbol-store").SymbolStore; class PascalDemangler { constructor() { @@ -38,7 +38,7 @@ class PascalDemangler { this.fixedsymbols.OUTPUT_$$_init = 'unit_initialization'; this.fixedsymbols.OUTPUT_$$_finalize = 'unit_finalization'; this.fixedsymbols.OUTPUT_$$_init_implicit = 'unit_initialization_implicit'; - this.fixedsymbols.OUTPUT_$$_finalize_implicit ='unit_finalization_implicit'; + this.fixedsymbols.OUTPUT_$$_finalize_implicit = 'unit_finalization_implicit'; this.fixedsymbols.OUTPUT_init = 'unit_initialization'; this.fixedsymbols.OUTPUT_finalize = 'unit_finalization'; this.fixedsymbols.OUTPUT_init_implicit = 'unit_initialization_implicit'; @@ -55,7 +55,7 @@ class PascalDemangler { } shouldIgnoreSymbol(text) { - for (var k in this.ignoredsymbols) { + for (let k in this.ignoredsymbols) { if (text.startsWith(this.ignoredsymbols[k])) { return true; } @@ -65,7 +65,7 @@ class PascalDemangler { } composeReadableMethodSignature(unitname, classname, methodname, params) { - var signature = ""; + let signature = ""; if (classname !== "") signature = classname.toLowerCase() + "."; @@ -83,7 +83,7 @@ class PascalDemangler { text = text.substr(0, text.length - 1); - for (var k in this.fixedsymbols) { + for (let k in this.fixedsymbols) { if (text === k) { text = text.replace(k, this.fixedsymbols[k]); this.symbolStore.Add(k, this.fixedsymbols[k]); @@ -91,7 +91,7 @@ class PascalDemangler { } } - var unmangledglobalvar; + let unmangledglobalvar; if (text.startsWith("U_$OUTPUT_$$_")) { unmangledglobalvar = text.substr(13).toLowerCase(); this.symbolStore.Add(text, unmangledglobalvar); @@ -102,8 +102,8 @@ class PascalDemangler { return unmangledglobalvar; } - var idx, paramtype = "", signature = "", phase = 0; - var unitname = "", classname = "", methodname = "", params = "", resulttype = ""; + let idx, paramtype = "", signature = "", phase = 0; + let unitname = "", classname = "", methodname = "", params = "", resulttype = ""; idx = text.indexOf("$_$"); if (idx !== -1) { @@ -115,7 +115,7 @@ class PascalDemangler { idx = text.indexOf("_$$_"); if (idx !== -1) { if (unitname === "") unitname = text.substr(0, idx - 1); - signature = text.substr(idx + 3); + signature = text.substr(idx + 3); } if (unitname === "") { @@ -160,7 +160,7 @@ class PascalDemangler { } } - var unmangled = this.composeReadableMethodSignature(unitname, classname, methodname, params); + const unmangled = this.composeReadableMethodSignature(unitname, classname, methodname, params); this.symbolStore.Add(text, unmangled); return unmangled; @@ -179,8 +179,8 @@ class PascalDemangler { return text; } - var translations = this.symbolStore.ListTranslations(); - for (var idx in translations) { + const translations = this.symbolStore.ListTranslations(); + for (let idx in translations) { text = text.replace(translations[idx][0], translations[idx][1]); } diff --git a/lib/symbol-store.js b/lib/symbol-store.js index b1dfa997e..88718a5fa 100644 --- a/lib/symbol-store.js +++ b/lib/symbol-store.js @@ -23,8 +23,6 @@ // POSSIBILITY OF SUCH DAMAGE. "use strict"; -var logger = require('../lib/logger').logger; - class SymbolStore { constructor() { this.uniqueSymbols = {}; @@ -34,11 +32,11 @@ class SymbolStore { Sort() { this.sortedSymbols = []; - for (var symbol in this.uniqueSymbols) { + for (let symbol in this.uniqueSymbols) { this.sortedSymbols.push([symbol, this.uniqueSymbols[symbol]]); } - this.sortedSymbols.sort(function(a, b) { + this.sortedSymbols.sort(function (a, b) { return b[0].length - a[0].length; }); @@ -66,7 +64,7 @@ class SymbolStore { ListSymbols() { if (!this.isSorted) this.Sort(); - return this.sortedSymbols.map(function(elem) { + return this.sortedSymbols.map(function (elem) { return elem[0]; }); } diff --git a/lib/utils.js b/lib/utils.js index bf896763c..a7a1b01c0 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -62,7 +62,7 @@ function parseOutput(lines, inputFilename) { if (inputFilename) line = line.split(inputFilename).join('<source>'); if (line !== "" && line.indexOf("fixme:") !== 0) { const lineObj = {text: line}; - const match = line.replace(/\x1b\[[\d;]*[mK]/g,'').match(re); + const match = line.replace(/\x1b\[[\d;]*[mK]/g, '').match(re); if (match) { lineObj.tag = { line: parseInt(match[1]), diff --git a/static/alert.js b/static/alert.js index e67ea78bb..cbd80fc69 100644 --- a/static/alert.js +++ b/static/alert.js @@ -95,4 +95,4 @@ Alert.prototype.notify = function (body, options) { container.append(newElement); // Add the new notification to the container }; -module.exports = Alert; +module.exports = Alert; diff --git a/static/analytics.js b/static/analytics.js index 9961db151..bfea77360 100644 --- a/static/analytics.js +++ b/static/analytics.js @@ -75,16 +75,16 @@ if (options.googleAnalyticsEnabled) { y.parentNode.insertBefore(o, y); g.identify = function (i, v) { g(l, {uid: i}); - if (v) g(l, v) + if (v) g(l, v); }; g.setUserVars = function (v) { - g(l, v) + g(l, v); }; g.identifyAccount = function (i, v) { o = 'account'; v = v || {}; v.acctId = i; - g(o, v) + g(o, v); }; g.clearUserCookie = function (c, d, i) { if (!c || document.cookie.match('fs_uid=[`;`]*`[`;`]*`[`;`]*`')) { @@ -94,7 +94,7 @@ if (options.googleAnalyticsEnabled) { ';path=/;expires=' + new Date(0).toUTCString(); i = d.indexOf('.'); if (i < 0) break; - d = d.slice(i + 1) + d = d.slice(i + 1); } } }; diff --git a/static/ansi-to-html.js b/static/ansi-to-html.js index f702cc0ba..f264d4fff 100644 --- a/static/ansi-to-html.js +++ b/static/ansi-to-html.js @@ -285,7 +285,7 @@ define(function (require) { */ function pushText(text, options) { if (options.escapeXML) { - return text.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); } return text; @@ -465,7 +465,7 @@ define(function (require) { function updateStickyStack(stickyStack, token, data) { if (token !== 'text') { stickyStack = stickyStack.filter(notCategory(categoryForCode(data))); - stickyStack.push({ token: token, data: data, category: categoryForCode(data) }); + stickyStack.push({token: token, data: data, category: categoryForCode(data)}); } return stickyStack; diff --git a/static/cfg-view.js b/static/cfg-view.js index 0b60ea2f7..2b017a668 100644 --- a/static/cfg-view.js +++ b/static/cfg-view.js @@ -127,7 +127,9 @@ function Cfg(hub, container, state) { this.eventHub.emit('requestCompiler', this.compilerId); this.adaptStructure = function (names) { - return _.map(names, function (name) {return {name: name};}); + return _.map(names, function (name) { + return {name: name}; + }); }; this.setTitle(); @@ -152,7 +154,7 @@ Cfg.prototype.onCompileResult = function (id, compiler, result) { // (Hint: It *does* happen) this.showCfgResults(this._binaryFilter ? this.binaryModeSupport : this.defaultCfgOutput); } - + this.functionPicker[0].selectize.clearOptions(); this.functionPicker[0].selectize.addOption(functionNames.length ? this.adaptStructure(functionNames) : {name: 'The input does not contain functions'}); this.functionPicker[0].selectize.refreshOptions(false); @@ -163,12 +165,12 @@ Cfg.prototype.onCompileResult = function (id, compiler, result) { } }; Cfg.prototype.onCompiler = function (id, compiler) { - if (id === this.compilerId) { - this._compilerName = compiler ? compiler.name : ''; - this.supportsCfg = compiler.supportsCfg; - this.setTitle(); - } - }; + if (id === this.compilerId) { + this._compilerName = compiler ? compiler.name : ''; + this.supportsCfg = compiler.supportsCfg; + this.setTitle(); + } +}; Cfg.prototype.onFiltersChange = function (id, filters) { if (this.compilerId === id) { @@ -211,7 +213,6 @@ Cfg.prototype.close = function () { }; - Cfg.prototype.saveState = function () { this.container.setState(this.currentState()); }; diff --git a/static/changelog.html b/static/changelog.html index eb879c51b..19fc400a2 100644 --- a/static/changelog.html +++ b/static/changelog.html @@ -1,5 +1,8 @@ <div id="changelog"> - <small>To see smaller changes, you can <a href="https://github.com/mattgodbolt/compiler-explorer/commits/master" target="_blank" rel="noopener noreferrer">visit our commits log <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a></small> + <small>To see smaller changes, you can <a href="https://github.com/mattgodbolt/compiler-explorer/commits/master" + target="_blank" rel="noopener noreferrer">visit our commits log <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small> + </sup></a></small> <h3>1st January 2018</h3> <ul> <li>Unified language support! All CE languages now on a single domain.</li> @@ -7,14 +10,19 @@ <h3>25th November 2017</h3> <ul> <li>GCC Dump view added. Click or drag the conifer tree on the assembly view to activate.</li> - <li>Added support for a new language: <a href="//fpc.godbolt.org/">Pascal</a> (Thanks <a href="https://github.com/partouf" target="_blank" rel="noopener noreferrer">@partouf <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a> !)</li> + <li>Added support for a new language: <a href="//fpc.godbolt.org/">Pascal</a> (Thanks <a + href="https://github.com/partouf" target="_blank" rel="noopener noreferrer">@partouf <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a> !) + </li> <li>More versions of <a href="//go.godbolt.org/">Go</a> added.</li> <li>Added latest Intel C++ compiler. Thanks Intel!</li> </ul> <h3>11th October 2017</h3> <ul> - <li>New Control Flow Graph mode! Click or drag the tree icon on the assembly view to activate.</li> - <li>Lots of new libraries added</li> + <li>New Control Flow Graph mode! Click or drag the tree icon on the assembly view to activate.</li> + <li>Lots of new libraries added</li> </ul> <h3>19th September 2017</h3> <ul> @@ -23,18 +31,47 @@ </ul> <h3>14th August 2017</h3> <ul> - <li>Addition of GSL and gsl-lite to <pre>/opt/compiler-explorer/libs</pre></li> + <li>Addition of GSL and gsl-lite to + <pre>/opt/compiler-explorer/libs</pre> + </li> <li>Added GCC 7.2</li> </ul> <h4>Not so new features</h4> <ul> <li>Magic initial comment <code>// setup</code> auto-folds setup code block.</li> - <li>Added Conformance view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/467" target="_blank" rel="noopener noreferrer">Click here for more details <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a></li> - <li>Added support for a new language: <a href="//swift.godbolt.org/">Swift</a> (Thanks <a href="https://github.com/adamnemecek" target="_blank" rel="noopener noreferrer">@adamnemecek <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a> !)</li> + <li>Added Conformance view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/467" target="_blank" + rel="noopener noreferrer">Click here for more details <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a></li> + <li>Added support for a new language: <a href="//swift.godbolt.org/">Swift</a> (Thanks <a + href="https://github.com/adamnemecek" target="_blank" rel="noopener noreferrer">@adamnemecek <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a> !) + </li> <li>Added support for a new language: <a href="//haskell.godbolt.org/">Haskell</a></li> - <li>Added support for a new language: <a href="//ispc.godbolt.org/">Intel's ispc</a> (<a href="https://ispc.github.io/" style="font-style: italic" target="_blank" rel="noopener noreferrer">What's ispc? <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a>)</li> - <li>Added Clang AST view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/442" target="_blank" rel="noopener noreferrer">Click here for more details <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a></li> - <li>Added Optimization view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/393" target="_blank" rel="noopener noreferrer">Click here for more details <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a></li> - <li>Added Themes. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/377" target="_blank" rel="noopener noreferrer">Click here for more details <sup><small class="glyphicon glyphicon-new-window" width="16px" height="16px" title="Opens in a new window"></small></sup></a></li> + <li>Added support for a new language: <a href="//ispc.godbolt.org/">Intel's ispc</a> (<a + href="https://ispc.github.io/" style="font-style: italic" target="_blank" rel="noopener noreferrer">What's + ispc? <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a>) + </li> + <li>Added Clang AST view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/442" target="_blank" + rel="noopener noreferrer">Click here for more details <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a></li> + <li>Added Optimization view. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/393" target="_blank" + rel="noopener noreferrer">Click here for more details <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a></li> + <li>Added Themes. <a href="https://github.com/mattgodbolt/compiler-explorer/pull/377" target="_blank" + rel="noopener noreferrer">Click here for more details <sup> + <small class="glyphicon glyphicon-new-window" width="16px" height="16px" + title="Opens in a new window"></small> + </sup></a></li> </ul> </div> diff --git a/static/colours.css b/static/colours.css index 1b3697518..9c616a5de 100644 --- a/static/colours.css +++ b/static/colours.css @@ -159,7 +159,7 @@ } .gray-shade-1 { - background: rgba(150, 150, 150, 0.35) !important; + background: rgba(150, 150, 150, 0.35) !important; } .gray-shade-2 { diff --git a/static/components.js b/static/components.js index 16d8335e1..2795ca511 100644 --- a/static/components.js +++ b/static/components.js @@ -122,7 +122,7 @@ define(function () { }; }, getGccDumpViewWith: function (id, compilerName, editorid, gccDumpOutput) { - var ret = { + var ret = { type: 'component', componentName: 'gccdump', componentState: { diff --git a/static/conformance-view.js b/static/conformance-view.js index 4fc04b35f..978e2bdf7 100644 --- a/static/conformance-view.js +++ b/static/conformance-view.js @@ -103,7 +103,7 @@ Conformance.prototype.addCompilerSelector = function (config) { // Compiler id which is being used compilerId: "", // Options which are in use - options: "", + options: "" }; this.nextSelectorId++; } @@ -273,7 +273,7 @@ Conformance.prototype.currentState = function () { // Compiler which is being used compilerId: $(child).find('.compiler-picker').val(), // Options which are in use - options: $(child).find(".options").val(), + options: $(child).find(".options").val() }); }, this)); return state; diff --git a/static/d-mode.js b/static/d-mode.js index a22c6838b..70398adf1 100644 --- a/static/d-mode.js +++ b/static/d-mode.js @@ -209,7 +209,7 @@ function definition() { [/[ \t\r\n]+/, 'white'], [/\/\*/, 'comment', '@comment'], [/\/\+/, 'comment', '@nestingcomment'], - [/\/\/.*$/, 'comment'], + [/\/\/.*$/, 'comment'] ], comment: [ @@ -236,7 +236,7 @@ function definition() { rawstring: [ [/[^\`]/, "string"], [/`/, "string", "@pop"] - ], + ] } }; } @@ -245,7 +245,7 @@ function configuration() { return { comments: { lineComment: '//', - blockComment: ['/*', '*/'], + blockComment: ['/*', '*/'] }, brackets: [ @@ -255,21 +255,21 @@ function configuration() { ], autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '`', close: '`', notIn: ['string'] }, - { open: '"', close: '"', notIn: ['string'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + {open: '{', close: '}'}, + {open: '[', close: ']'}, + {open: '(', close: ')'}, + {open: '`', close: '`', notIn: ['string']}, + {open: '"', close: '"', notIn: ['string']}, + {open: '\'', close: '\'', notIn: ['string', 'comment']} ], surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '`', close: '`' }, - { open: '"', close: '"' }, - { open: '\'', close: '\'' }, + {open: '{', close: '}'}, + {open: '[', close: ']'}, + {open: '(', close: ')'}, + {open: '`', close: '`'}, + {open: '"', close: '"'}, + {open: '\'', close: '\''} ] }; } diff --git a/static/diff.js b/static/diff.js index ecb20ff46..5b799a7dc 100644 --- a/static/diff.js +++ b/static/diff.js @@ -217,13 +217,13 @@ Diff.prototype.onThemeChange = function (newTheme) { this.outputEditor.updateOptions({theme: newTheme.monaco}); }; -module.exports = { +module.exports = { Diff: Diff, getComponent: function (lhs, rhs) { return { type: 'component', componentName: 'diff', - componentState: {lhs: lhs, rhs: rhs}, + componentState: {lhs: lhs, rhs: rhs} }; } }; diff --git a/static/editor.js b/static/editor.js index b72127845..7aac728de 100644 --- a/static/editor.js +++ b/static/editor.js @@ -197,10 +197,10 @@ function Editor(hub, state, container) { }, this)); this.mouseMoveThrottledFunction = _.throttle(_.bind(function (e) { - if (e !== null && e.target !== null && this.settings.hoverShowSource && e.target.position !== null) { - tryCompilerLinkLine(e.target.position.lineNumber, false); - } - }, this), 250); + if (e !== null && e.target !== null && this.settings.hoverShowSource && e.target.position !== null) { + tryCompilerLinkLine(e.target.position.lineNumber, false); + } + }, this), 250); this.editor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); @@ -415,7 +415,7 @@ Editor.prototype.onCompilerOpen = function (compilerId, editorId) { if (editorId === this.id) { // On any compiler open, rebroadcast our state in case they need to know it. if (this.waitingForLanguage) { - var glCompiler =_.find(this.container.layoutManager.root.getComponentsByName("compiler"), function (compiler) { + var glCompiler = _.find(this.container.layoutManager.root.getComponentsByName("compiler"), function (compiler) { return compiler.id === compilerId; }); if (glCompiler) { diff --git a/static/explorer.css b/static/explorer.css index 99affff87..f1230ac4d 100644 --- a/static/explorer.css +++ b/static/explorer.css @@ -64,7 +64,6 @@ width: 99%; } - li.tweet { padding: 3px 20px; } diff --git a/static/fontscale.js b/static/fontscale.js index 861fbe301..d5b8fde6c 100644 --- a/static/fontscale.js +++ b/static/fontscale.js @@ -34,7 +34,7 @@ function makeFontSizeDropdown(elem, interval, obj, buttonDropdown) { var step = 0.05; var found = false; - var onWheelEvent = function(e) { + var onWheelEvent = function (e) { e.preventDefault(); var selectedId = elem.find('.font-option-active').index(); if (e.originalEvent.deltaY >= 0 && selectedId < elem.children().length - 1) { @@ -45,7 +45,7 @@ function makeFontSizeDropdown(elem, interval, obj, buttonDropdown) { elem.children().eq(selectedId).trigger('click'); }; - var onClickEvent = function() { + var onClickEvent = function () { // Toggle off the selection of the others elem.children().removeClass('font-option-active'); // Toggle us on diff --git a/static/haskell-mode.js b/static/haskell-mode.js index 21e06d102..47ca4290f 100644 --- a/static/haskell-mode.js +++ b/static/haskell-mode.js @@ -32,369 +32,369 @@ function definition() { module: /^(module)\b/, import: /^(import)\b/, module_name: /([A-Z][\w']*)(\.[A-Z][\w']*)*/, - module_exports:/([A-Z][\w']*)(\.[A-Z][\w']*)*/, - target:/([A-Z][\w']*)(\.[A-Z][\w']*)*/, - invalid:/[a-z]+/, - datatype:/[A-Z][\w]+/, - datatypekey:/Int|Float|Text/, - functions:/[a-z]+/, - datacons:/[A-Z][\w]+/, - typcons:/\s*[A-Z][\w]+/, - text:/[A-Z][\w]+/, - classname:/\s*[A-Z][\w]+/, - arguments:/[a-z][\w]*/, - reservedid:/qualified|hiding|case|default|deriving|do|else|if|import|in|infix|infixr|let|of|then|type|where|show|_/, + module_exports: /([A-Z][\w']*)(\.[A-Z][\w']*)*/, + target: /([A-Z][\w']*)(\.[A-Z][\w']*)*/, + invalid: /[a-z]+/, + datatype: /[A-Z][\w]+/, + datatypekey: /Int|Float|Text/, + functions: /[a-z]+/, + datacons: /[A-Z][\w]+/, + typcons: /\s*[A-Z][\w]+/, + text: /[A-Z][\w]+/, + classname: /\s*[A-Z][\w]+/, + arguments: /[a-z][\w]*/, + reservedid: /qualified|hiding|case|default|deriving|do|else|if|import|in|infix|infixr|let|of|then|type|where|show|_/, tokenizer: { root: [ [/(@module)/, 'keyword.module.haskell', '@module'], [/@import/, 'keyword.module.haskell', '@import'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/@reservedid/,'keyword'], - [/[a-z][\w]+(?=\s*?=)/,'binderas','@binder'], - [/[a-z][\w]+(?=\s*::)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*?[a-z]\w*)/,'binder','@typconss'], - [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/,'bind','@binder'], - [/[a-z][\w]+(?=\s*?=\s*?@datacons)/,'bindings'], - {include:'@whitespace'}, - {include:'@comment'} + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/@reservedid/, 'keyword'], + [/[a-z][\w]+(?=\s*?=)/, 'binderas', '@binder'], + [/[a-z][\w]+(?=\s*::)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*?[a-z]\w*)/, 'binder', '@typconss'], + [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/, 'bind', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*?@datacons)/, 'bindings'], + {include: '@whitespace'}, + {include: '@comment'} ], import: [ - [/@module_name/,'storage.module,haskell'], + [/@module_name/, 'storage.module,haskell'], [/(@module_name)(?=\s*as)/, 'storage.module.haskell'], [/\b(qualified)\b(?=\s*@module_name)/, 'keyword'], [/(@module_name)(?=\s*?\()/, 'storage.module.haskell'], [/(@module_name)(?=\s*\bhiding\b)/, 'storage.module.haskell'], [/\b(hiding)\b(?=\s*?\()/, 'keyword'], - [/\b(as)\b(?=\s*@module_name)/,'keyword'], - [/\(/,'openbracketss','@functions'], - {include:'@comment'} + [/\b(as)\b(?=\s*@module_name)/, 'keyword'], + [/\(/, 'openbracketss', '@functions'], + {include: '@comment'} //{include:'@blockComment'} ], module: [ [/(@module_name)/, 'storage.module.haskell'], - [/\(/, 'openbracket','@module_exports'], - [/@reservedid/,'keyword','@pop'], - [/@invalid/,'invalid'], - [/,/,'commas'], - {include:'@whitespace'}, - {include:'@comment'} + [/\(/, 'openbracket', '@module_exports'], + [/@reservedid/, 'keyword', '@pop'], + [/@invalid/, 'invalid'], + [/,/, 'commas'], + {include: '@whitespace'}, + {include: '@comment'} //{include:'@blockComment'} ], functions: [ - [/@datatype/,'dcataype','@datatype'], - [/@functions/,'functions'], - [/,/,'commas'], - [/\)(?=\))/,'closebracket'], - [/\)/,'closebracketalla','@popall'], - {include:'@comment'} + [/@datatype/, 'dcataype', '@datatype'], + [/@functions/, 'functions'], + [/,/, 'commas'], + [/\)(?=\))/, 'closebracket'], + [/\)/, 'closebracketalla', '@popall'], + {include: '@comment'} //{include:'@blockComment'} ], typconss: [ - [/=/,'eqals'], - [/\bundefined\b/,'val','@all'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\binstance\b/,'keyword','@classname'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/@reservedid/,'keyword','@function'], - [/[a-z]\w*/,'arguments121'], - [/[a-z][\w]+(?=\s*=)/,'binderad','@datacons'], - [/[a-z][\w]+(?=\s*::)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*[a-z]\w*)/,'binderad','@typconss'], - [/[a-z]\w*/,'arguments121'], - [/::/,'dcol','@datacons'], - [/->/,'pipes','@binder'], - {include:'@whitespace'}, - {include:'@comment'} + [/=/, 'eqals'], + [/\bundefined\b/, 'val', '@all'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/@reservedid/, 'keyword', '@function'], + [/[a-z]\w*/, 'arguments121'], + [/[a-z][\w]+(?=\s*=)/, 'binderad', '@datacons'], + [/[a-z][\w]+(?=\s*::)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*[a-z]\w*)/, 'binderad', '@typconss'], + [/[a-z]\w*/, 'arguments121'], + [/::/, 'dcol', '@datacons'], + [/->/, 'pipes', '@binder'], + {include: '@whitespace'}, + {include: '@comment'} //{include:'@blockComment'} ], function: [ - [/@reservedid/,'keyword'], - [/@datatypekey/,'dtype'], - [/[a-z][\w]+(?=\s*::)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*?[a-z]\w*)/,'binder','@typconss'], - [/[a-z]\w*/,'arguments12'], - [/::/,'dcol'], - [/->/,'pipe'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\binstance\b/,'keyword','@classname'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword'], - {include:'@comment'} + [/@reservedid/, 'keyword'], + [/@datatypekey/, 'dtype'], + [/[a-z][\w]+(?=\s*::)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*?[a-z]\w*)/, 'binder', '@typconss'], + [/[a-z]\w*/, 'arguments12'], + [/::/, 'dcol'], + [/->/, 'pipe'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword'], + {include: '@comment'} //{include:'@blockComment'} ], typcons: [ - [/=>/,'pipes'], - [/->/,'pipe','@bind'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\binstance\b/,'keyword','@classname'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword'], - [/@reservedid(?=\s*\()/,'keyword','@typcons'], - [/@reservedid(?=\s*[A-Z][\w]+)/,'keyword','@typcons'], - [/@reservedid/,'keyword','@binder'], - [/@datatypekey/,'dtypes2'], - [/[A-Z][\w]+(?=\s*,)/,'classname','@types'], - [/[A-Z][\w]+(?=\s*[a-z][\w]*\s*,)/,'classname','@types'], - [/@arguments(?=\s*,\s*)/,'argument','@types'], + [/=>/, 'pipes'], + [/->/, 'pipe', '@bind'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword'], + [/@reservedid(?=\s*\()/, 'keyword', '@typcons'], + [/@reservedid(?=\s*[A-Z][\w]+)/, 'keyword', '@typcons'], + [/@reservedid/, 'keyword', '@binder'], + [/@datatypekey/, 'dtypes2'], + [/[A-Z][\w]+(?=\s*,)/, 'classname', '@types'], + [/[A-Z][\w]+(?=\s*[a-z][\w]*\s*,)/, 'classname', '@types'], + [/@arguments(?=\s*,\s*)/, 'argument', '@types'], - [/[A-Z][\w]+/,'typecons'], - [/[a-z][\w]+(?=\s*?=)/,'binderas','@binder'], - [/[a-z][\w]+(?=\s*::)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*?[a-z]\w*)/,'bind','@typconss'], - [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/,'bind','@binder'], - [/[a-z][\w]+(?=\s*?=\s*?@datacons)/,'bindings'], - [/{/,'oopen','@initialise'], - [/[a-z]\w*/,'arguments13'], + [/[A-Z][\w]+/, 'typecons'], + [/[a-z][\w]+(?=\s*?=)/, 'binderas', '@binder'], + [/[a-z][\w]+(?=\s*::)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*?[a-z]\w*)/, 'bind', '@typconss'], + [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/, 'bind', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*?@datacons)/, 'bindings'], + [/{/, 'oopen', '@initialise'], + [/[a-z]\w*/, 'arguments13'], - [/\(/,'open_bracket'], - [/=/,'Equalss','@datacons'], - [/,/,'commaa'], - [/::/,'colondouble','@datacons'], - [/\)/,'closebrak','@initialise'], - [/\)(?=\s* \t\r\n\bdata\b)/,'closed','@popall'], - {include:'@whitespace'}, - {include:'@comment'} + [/\(/, 'open_bracket'], + [/=/, 'Equalss', '@datacons'], + [/,/, 'commaa'], + [/::/, 'colondouble', '@datacons'], + [/\)/, 'closebrak', '@initialise'], + [/\)(?=\s* \t\r\n\bdata\b)/, 'closed', '@popall'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], bind: [ - [/@datatypekey/,'dtyp','@typconss'], - [/[a-z][\w]*/,'typvar','@typconss'], - [/\(/,'opens','@typcons'], - {include:'@whitespace'}, + [/@datatypekey/, 'dtyp', '@typconss'], + [/[a-z][\w]*/, 'typvar', '@typconss'], + [/\(/, 'opens', '@typcons'], + {include: '@whitespace'} ], types: [ - [/[a-z][\w]*/,'argument123'], - [/,/,'commaa'], - [/[A-Z][\w]*/,'classname'], - [/\)/,'closex'], - [/=>/,'pipe','@type'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]*/, 'argument123'], + [/,/, 'commaa'], + [/[A-Z][\w]*/, 'classname'], + [/\)/, 'closex'], + [/=>/, 'pipe', '@type'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], datacons: [ - [/=/,'Equalst'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], + [/=/, 'Equalst'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], - [/\bundefined\b/,'val','@all'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/\binstance\b/,'keyword','@classname'], - [/[a-z][\w]*(?=\s*?->)/,'typvar','@typcons'], + [/\bundefined\b/, 'val', '@all'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/\binstance\b/, 'keyword', '@classname'], + [/[a-z][\w]*(?=\s*?->)/, 'typvar', '@typcons'], - [/@reservedid(?=\s*\()/,'keyword','@typcons'], - [/@datatypekey(?=\s*[a-z]\w*)/,'dtypess1','@typcons'], - [/@datatypekey/,'dtypes1'], - [/@reservedid(?=\s*[A-Z][\w]+)/,'keyword','@typcons'], - [/@reservedid/,'keyword'], - [/[A-Z][\w]+(?=\s*=>)/,'classname','@type'], - [/[A-Z][\w]+(?=\s*[a-z][\w]*\s*=>)/,'classnames','@type'], - [/[a-z][\w]+(?=\s*?::)/,'bindera','@typconss'], - [/[a-z][\w]+(?=\s*?[a-z]\w*)/,'binde','@typconss'], + [/@reservedid(?=\s*\()/, 'keyword', '@typcons'], + [/@datatypekey(?=\s*[a-z]\w*)/, 'dtypess1', '@typcons'], + [/@datatypekey/, 'dtypes1'], + [/@reservedid(?=\s*[A-Z][\w]+)/, 'keyword', '@typcons'], + [/@reservedid/, 'keyword'], + [/[A-Z][\w]+(?=\s*=>)/, 'classname', '@type'], + [/[A-Z][\w]+(?=\s*[a-z][\w]*\s*=>)/, 'classnames', '@type'], + [/[a-z][\w]+(?=\s*?::)/, 'bindera', '@typconss'], + [/[a-z][\w]+(?=\s*?[a-z]\w*)/, 'binde', '@typconss'], - [/[a-z][\w]+/,'binder','@typconss'], + [/[a-z][\w]+/, 'binder', '@typconss'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], - [/@datacons/,'datacon'], - [/@reservedid/,'keyword','@binder'], - [/@datacons(?=\s*@datatypekey)/,'datacons'], + [/@datacons/, 'datacon'], + [/@reservedid/, 'keyword', '@binder'], + [/@datacons(?=\s*@datatypekey)/, 'datacons'], - [/[a-z][\w]+(?=\s*?::\s*@datatype,)/,'bindera','@binder'], - [/[a-z][\w]+(?=\s*?::\s*@datatype,)/,'bindera','@binder'], - [/[a-z][\w]+(?=\s*?=\s*(\d)+,)/,'binderb','@binder'], - [/[a-z][\w]+(?=\s*?=\s*(\d)+)/,'binderc','@binder'], - [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?")/,'binderd','@binder'], - [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?",)/,'bindere','@binder'], - [/{/,'openbracketd','@initialise'], - [/"\w+.+"/,'type'], - [/\d+/,'type'], - [/->/,'pip','@binder'], - [/,/,'commas33','@initialise'], - [/\|/,'alternate'], - [/\(/,'open','@typcons'], - [/}/,'clos','@initialise'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]+(?=\s*?::\s*@datatype,)/, 'bindera', '@binder'], + [/[a-z][\w]+(?=\s*?::\s*@datatype,)/, 'bindera', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*(\d)+,)/, 'binderb', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*(\d)+)/, 'binderc', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?")/, 'binderd', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?",)/, 'bindere', '@binder'], + [/{/, 'openbracketd', '@initialise'], + [/"\w+.+"/, 'type'], + [/\d+/, 'type'], + [/->/, 'pip', '@binder'], + [/,/, 'commas33', '@initialise'], + [/\|/, 'alternate'], + [/\(/, 'open', '@typcons'], + [/}/, 'clos', '@initialise'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], type: [ - [/[a-z][\w]*/,'argument'], - [/,/,'commas'], - [/=>/,'pipe'], - [/[A-Z][\w]*/,'typcons'], - [/->/,'pipe','@binder'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]*/, 'argument'], + [/,/, 'commas'], + [/=>/, 'pipe'], + [/[A-Z][\w]*/, 'typcons'], + [/->/, 'pipe', '@binder'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], all: [ - [/=/,'equals'], + [/=/, 'equals'], - [/\binstance\b/,'keyword','@classname'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\bdata\b(?=@typcons)/,'keyword','@typcons'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\bdata\b(?=@typcons)/, 'keyword', '@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword'], - [/@reservedid/,'keyword','@typconss'], - [/[A-Z][\w]+/,'typecons','@typcons'], - [/[a-z][\w]+(?=\s*=)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*::)/,'binderad','@typconss'], - [/[a-z][\w]+(?=\s*?[a-z]\w*)/,'binder','@typconss'], - {include:'@comment'} + [/\bnewtype\b(?=\s*@typcons)/, 'keyword'], + [/@reservedid/, 'keyword', '@typconss'], + [/[A-Z][\w]+/, 'typecons', '@typcons'], + [/[a-z][\w]+(?=\s*=)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*::)/, 'binderad', '@typconss'], + [/[a-z][\w]+(?=\s*?[a-z]\w*)/, 'binder', '@typconss'], + {include: '@comment'} // {include:'@blockComment'} ], selectors: [ - [/[a-z][\w]+/,'selectors'], - [/=/,'Equalsto','@datacons'], - [/"(\w)+.+"/,'type'], - [/\d+/,'type'], - [/}/,'closeS'], - {include:'@comment'} + [/[a-z][\w]+/, 'selectors'], + [/=/, 'Equalsto', '@datacons'], + [/"(\w)+.+"/, 'type'], + [/\d+/, 'type'], + [/}/, 'closeS'], + {include: '@comment'} // {include:'@blockComment'} ], initialise: [ - [/\binstance\b/,'keyword','@classname'], - [/\bdata\b(?=\s*@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/@datatypekey(?=\s*)/,'datatype'], - [/{/,'open'], - [/@reservedid/,'keyword'], - [/\(/,'opn','@typcons'], - [/\|/,'alternates','@datacons'], - [/,/,'comma3'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bdata\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/@datatypekey(?=\s*)/, 'datatype'], + [/{/, 'open'], + [/@reservedid/, 'keyword'], + [/\(/, 'opn', '@typcons'], + [/\|/, 'alternates', '@datacons'], + [/,/, 'comma3'], - [/[a-z][\w]+(?=\s*?=\s*?\b@reservedid\b)/,'binder','@all'], - [/[a-z][\w]+(?=\s*?=\s*?\bundefined\b)/,'binder','@binder'], - [/[a-z][\w]+(?=\s*?=\s*?@datacons)/,'bindings'], - [/[a-z][\w]+(?=\s*?::\s*@datatypekey)/,'bindera','@binder'], - [/[a-z][\w]+(?=\s*::)/,'binder','@binder'], + [/[a-z][\w]+(?=\s*?=\s*?\b@reservedid\b)/, 'binder', '@all'], + [/[a-z][\w]+(?=\s*?=\s*?\bundefined\b)/, 'binder', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*?@datacons)/, 'bindings'], + [/[a-z][\w]+(?=\s*?::\s*@datatypekey)/, 'bindera', '@binder'], + [/[a-z][\w]+(?=\s*::)/, 'binder', '@binder'], - [/[a-z][\w]+(?=\s*?::\s*@datatypekey,)/,'binderb','@binder'], - [/[a-z][\w]+(?=\s*?=\s*(\d)+,)/,'binderc','@binder'], - [/[a-z][\w]+(?=\s*?=\s*(\d)+)/,'binderd','@binder'], - [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?",)/,'binders','@binder'], - [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?")/,'bindere','@binder'], + [/[a-z][\w]+(?=\s*?::\s*@datatypekey,)/, 'binderb', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*(\d)+,)/, 'binderc', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*(\d)+)/, 'binderd', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?",)/, 'binders', '@binder'], + [/[a-z][\w]+(?=\s*?=\s*"(\w)+.+?")/, 'bindere', '@binder'], - [/[a-z][\w]+(?=\s*[a-z]\w*)/,'binder','@typconss'], - [/::/,'doublecolons','@datacons'], - [/=/,'Equalsto','@datacons'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]+(?=\s*[a-z]\w*)/, 'binder', '@typconss'], + [/::/, 'doublecolons', '@datacons'], + [/=/, 'Equalsto', '@datacons'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], classname: [ - [/\binstance\b/,'keyword','@classname'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\bdata\b(?=\s*?@typcons)/,'keyword','@typcons'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/[a-z][\w]+(?=\s*?=)/,'binderas','@binder'], - [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/,'binderas','@binder'], - [/@datatypekey/,'dtype'], - [/[A-Z][\w]*/,'classname'], - [/@reservedid/,'keyword','@typcons'], - [/[a-z]\w*/,'arguments'], - [/,/,'commas'], - [/\(/, 'openbracket'], - [/\)/,'closebracket'], - [/=>/,'pipe','@superclass'], - {include:'@whitespace'}, - {include:'@comment'} + [/\binstance\b/, 'keyword', '@classname'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\bdata\b(?=\s*?@typcons)/, 'keyword', '@typcons'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/[a-z][\w]+(?=\s*?=)/, 'binderas', '@binder'], + [/[a-z][\w]+(?=\s*?::\s*?@datatypekey)/, 'binderas', '@binder'], + [/@datatypekey/, 'dtype'], + [/[A-Z][\w]*/, 'classname'], + [/@reservedid/, 'keyword', '@typcons'], + [/[a-z]\w*/, 'arguments'], + [/,/, 'commas'], + [/\(/, 'openbracket'], + [/\)/, 'closebracket'], + [/=>/, 'pipe', '@superclass'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], binder: [ - [/\binstance\b/,'keyword','@classname'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\bdata\b(?=\s*?@typcons)/,'keyword','@typcons'], - [/@reservedid/,'keyword'], - [/[a-z][\w]+(?=\s*::)/,'binder'], - [/[a-z][\w]+(?=\s*=)/,'binder'], - [/::/,'doublecolons','@datacons'], - [/@datatypekey(?=\s*[a-z]\w*)/,'dtypes','@typcons'], - [/@datatypekey/,'dtypess'], - [/\bnewtype\b(?=\s*@typcons)/,'keyword','@typcons'], - [/->/,'pipe'], - [/\d+/,'digit'], - [/{/,'open'], - [/=/,'Equalsto','@datacons'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\bdata\b(?=\s*?@typcons)/, 'keyword', '@typcons'], + [/@reservedid/, 'keyword'], + [/[a-z][\w]+(?=\s*::)/, 'binder'], + [/[a-z][\w]+(?=\s*=)/, 'binder'], + [/::/, 'doublecolons', '@datacons'], + [/@datatypekey(?=\s*[a-z]\w*)/, 'dtypes', '@typcons'], + [/@datatypekey/, 'dtypess'], + [/\bnewtype\b(?=\s*@typcons)/, 'keyword', '@typcons'], + [/->/, 'pipe'], + [/\d+/, 'digit'], + [/{/, 'open'], + [/=/, 'Equalsto', '@datacons'], - [/\(/,'opn','@typcons'], - [/\|/,'alternates','@datacons'], - [/,/,'comma3'], + [/\(/, 'opn', '@typcons'], + [/\|/, 'alternates', '@datacons'], + [/,/, 'comma3'], - [/[a-z][\w]*/,'typvar','@typconss'], - [/\bclass\b(?=\s*@classname)/,'keyword','@classname'], - [/\bclass\b(?=\s*\()/,'keyword','@classname'], - [/\binstance\b/,'keyword','@classname'], - [/\bundefined\b/,'value'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]*/, 'typvar', '@typconss'], + [/\bclass\b(?=\s*@classname)/, 'keyword', '@classname'], + [/\bclass\b(?=\s*\()/, 'keyword', '@classname'], + [/\binstance\b/, 'keyword', '@classname'], + [/\bundefined\b/, 'value'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], superclass: [ - [/[A-Z][\w]+/,'typeclass'], - [/@reservedid/,'keyword','@typcons'], - [/[a-z][\w]*/,'typearguments'], - {include:'@whitespace'}, - {include:'@comment'} + [/[A-Z][\w]+/, 'typeclass'], + [/@reservedid/, 'keyword', '@typcons'], + [/[a-z][\w]*/, 'typearguments'], + {include: '@whitespace'}, + {include: '@comment'} //{include:'@blockComment'} ], argument: [ - [/[a-z][\w]*(?=\s*->)/,'argument'], - [/->/,'pipea','@binder'], - {include:'@whitespace'}, - {include:'@comment'} + [/[a-z][\w]*(?=\s*->)/, 'argument'], + [/->/, 'pipea', '@binder'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockComment'} ], datatype: [ - [/\(/,'openbracketd','@pop'], - {include:'@comment'} + [/\(/, 'openbracketd', '@pop'], + {include: '@comment'} //{include:'@blockComment'} ], module_exports: [ - [/(@module_exports)/,'storage.module.haskell'], - [/\(/,'openbracket','@target'], - [/\)/,'closebracket','@popall'], - [/,/,'comma1'], - [/@invalid/,'invalid'], - {include:'@whitespace'}, - {include:'@comment'} + [/(@module_exports)/, 'storage.module.haskell'], + [/\(/, 'openbracket', '@target'], + [/\)/, 'closebracket', '@popall'], + [/,/, 'comma1'], + [/@invalid/, 'invalid'], + {include: '@whitespace'}, + {include: '@comment'} // {include:'@blockcomment'} ], target: [ - [/(@target)/,'target'], - [/,/,'comma2'], - [/\)/,'closebracket','@pop'], - {include:'@comment'} + [/(@target)/, 'target'], + [/,/, 'comma2'], + [/\)/, 'closebracket', '@pop'], + {include: '@comment'} // {include:'@blockComment'} ], whitespace: [ - [/\t\r\n/,'whitespace'], - [/\s*/,'whitespace'] + [/\t\r\n/, 'whitespace'], + [/\s*/, 'whitespace'] ], comment: [ - [/--/,'punctuation.comment.haskell'], - {include:'@whitespace'}, + [/--/, 'punctuation.comment.haskell'], + {include: '@whitespace'} ], Block_comment: [ - [/{-/,'punctuation.comment.haskell'], - [/-}/,'comment.block.haskell'], - {include:'@whitespace'} - ], + [/{-/, 'punctuation.comment.haskell'], + [/-}/, 'comment.block.haskell'], + {include: '@whitespace'} + ] } }; } diff --git a/static/main.js b/static/main.js index f9eab55d4..4bcde0519 100644 --- a/static/main.js +++ b/static/main.js @@ -24,176 +24,176 @@ // POSSIBILITY OF SUCH DAMAGE "use strict"; -require("monaco-loader")().then(function() { - -require('bootstrap'); -require('bootstrap-slider'); - -var analytics = require('analytics'); -var sharing = require('sharing'); -var _ = require('underscore'); -var $ = require('jquery'); -var GoldenLayout = require('goldenlayout'); -var Components = require('components'); -var url = require('./url'); -var clipboard = require('clipboard'); -var Hub = require('hub'); -var Raven = require('raven-js'); -var settings = require('./settings'); -var local = require('./local'); -var Alert = require('./alert'); -var themer = require('./themes'); +require("monaco-loader")().then(function () { + + require('bootstrap'); + require('bootstrap-slider'); + + var analytics = require('analytics'); + var sharing = require('sharing'); + var _ = require('underscore'); + var $ = require('jquery'); + var GoldenLayout = require('goldenlayout'); + var Components = require('components'); + var url = require('./url'); + var clipboard = require('clipboard'); + var Hub = require('hub'); + var Raven = require('raven-js'); + var settings = require('./settings'); + var local = require('./local'); + var Alert = require('./alert'); + var themer = require('./themes'); //css -require("bootstrap/dist/css/bootstrap.min.css"); -require("goldenlayout/src/css/goldenlayout-base.css"); -require("selectize/dist/css/selectize.bootstrap2.css"); -require("bootstrap-slider/dist/css/bootstrap-slider.css"); -require("./colours.css"); -require("./explorer.css"); - -function setupSettings(hub) { - var eventHub = hub.layout.eventHub; - var defaultSettings = { - defaultLanguage: hub.subdomainLangId - }; - var currentSettings = JSON.parse(local.get('settings', null)) || defaultSettings; - - function onChange(settings) { - currentSettings = settings; - local.set('settings', JSON.stringify(settings)); - eventHub.emit('settingsChange', settings); - } - - new themer.Themer(eventHub, currentSettings); - - eventHub.on('requestSettings', function () { - eventHub.emit('settingsChange', currentSettings); - }); - - var setSettings = settings($('#settings'), currentSettings, onChange, hub.subdomainLangId); - eventHub.on('modifySettings', function (newSettings) { - setSettings(_.extend(currentSettings, newSettings)); - }); -} - -function start() { - analytics.initialise(); - - var options = require('options'); - - var subdomainPart = window.location.hostname.split('.')[0]; - var langBySubdomain = _.find(options.languages, function (lang) { - return lang.id === subdomainPart || lang.alias.indexOf(subdomainPart) >= 0; - }); - var subLangId = langBySubdomain ? langBySubdomain.id : null; - - var defaultConfig = { - settings: {showPopoutIcon: false}, - content: [{ - type: 'row', - content: [ - Components.getEditor(1, subLangId), - Components.getCompiler(1, subLangId) - ] - }] - }; - - $(window).bind('hashchange', function () { - // punt on hash events and just reload the page if there's a hash - if (window.location.hash.substr(1)) - window.location.reload(); - }); - - var config; - if (!options.embedded) { - config = url.deserialiseState(window.location.hash.substr(1)); - if (config) { - // replace anything in the default config with that from the hash - config = _.extend(defaultConfig, config); + require("bootstrap/dist/css/bootstrap.min.css"); + require("goldenlayout/src/css/goldenlayout-base.css"); + require("selectize/dist/css/selectize.bootstrap2.css"); + require("bootstrap-slider/dist/css/bootstrap-slider.css"); + require("./colours.css"); + require("./explorer.css"); + + function setupSettings(hub) { + var eventHub = hub.layout.eventHub; + var defaultSettings = { + defaultLanguage: hub.subdomainLangId + }; + var currentSettings = JSON.parse(local.get('settings', null)) || defaultSettings; + + function onChange(settings) { + currentSettings = settings; + local.set('settings', JSON.stringify(settings)); + eventHub.emit('settingsChange', settings); } - if (!config) { - var savedState = local.get('gl', null); - config = savedState !== null ? JSON.parse(savedState) : defaultConfig; - } - } else { - config = _.extend(defaultConfig, - { - settings: { - showMaximiseIcon: false, - showCloseIcon: false, - hasHeaders: false - } - }, - sharing.configFromEmbedded(window.location.hash.substr(1))); - } + new themer.Themer(eventHub, currentSettings); + + eventHub.on('requestSettings', function () { + eventHub.emit('settingsChange', currentSettings); + }); - var root = $("#root"); - - var layout; - var hub; - try { - layout = new GoldenLayout(config, root); - hub = new Hub(layout, subLangId); - } catch (e) { - Raven.captureException(e); - layout = new GoldenLayout(defaultConfig, root); - hub = new Hub(layout, subLangId); + var setSettings = settings($('#settings'), currentSettings, onChange, hub.subdomainLangId); + eventHub.on('modifySettings', function (newSettings) { + setSettings(_.extend(currentSettings, newSettings)); + }); } - layout.on('stateChanged', function () { - var config = layout.toConfig(); - // Only preserve state in localStorage in non-embedded mode. + + function start() { + analytics.initialise(); + + var options = require('options'); + + var subdomainPart = window.location.hostname.split('.')[0]; + var langBySubdomain = _.find(options.languages, function (lang) { + return lang.id === subdomainPart || lang.alias.indexOf(subdomainPart) >= 0; + }); + var subLangId = langBySubdomain ? langBySubdomain.id : null; + + var defaultConfig = { + settings: {showPopoutIcon: false}, + content: [{ + type: 'row', + content: [ + Components.getEditor(1, subLangId), + Components.getCompiler(1, subLangId) + ] + }] + }; + + $(window).bind('hashchange', function () { + // punt on hash events and just reload the page if there's a hash + if (window.location.hash.substr(1)) + window.location.reload(); + }); + + var config; if (!options.embedded) { - local.set('gl', JSON.stringify(config)); + config = url.deserialiseState(window.location.hash.substr(1)); + if (config) { + // replace anything in the default config with that from the hash + config = _.extend(defaultConfig, config); + } + + if (!config) { + var savedState = local.get('gl', null); + config = savedState !== null ? JSON.parse(savedState) : defaultConfig; + } } else { - var strippedToLast = window.location.pathname; - strippedToLast = strippedToLast.substr(0, - strippedToLast.lastIndexOf('/') + 1); - $('a.link').attr('href', strippedToLast + '#' + url.serialiseState(config)); + config = _.extend(defaultConfig, + { + settings: { + showMaximiseIcon: false, + showCloseIcon: false, + hasHeaders: false + } + }, + sharing.configFromEmbedded(window.location.hash.substr(1))); } - }); - function sizeRoot() { - var height = $(window).height() - root.position().top; - root.height(height); - layout.updateSize(); - } + var root = $("#root"); + + var layout; + var hub; + try { + layout = new GoldenLayout(config, root); + hub = new Hub(layout, subLangId); + } catch (e) { + Raven.captureException(e); + layout = new GoldenLayout(defaultConfig, root); + hub = new Hub(layout, subLangId); + } + layout.on('stateChanged', function () { + var config = layout.toConfig(); + // Only preserve state in localStorage in non-embedded mode. + if (!options.embedded) { + local.set('gl', JSON.stringify(config)); + } else { + var strippedToLast = window.location.pathname; + strippedToLast = strippedToLast.substr(0, + strippedToLast.lastIndexOf('/') + 1); + $('a.link').attr('href', strippedToLast + '#' + url.serialiseState(config)); + } + }); - $(window).resize(sizeRoot); - sizeRoot(); + function sizeRoot() { + var height = $(window).height() - root.position().top; + root.height(height); + layout.updateSize(); + } - new clipboard('.btn.clippy'); + $(window).resize(sizeRoot); + sizeRoot(); - setupSettings(hub); + new clipboard('.btn.clippy'); - sharing.initShareButton($('#share'), layout); + setupSettings(hub); + + sharing.initShareButton($('#share'), layout); + + function setupAdd(thing, func) { + layout.createDragSource(thing, func); + thing.click(function () { + hub.addAtRoot(func()); + }); + } - function setupAdd(thing, func) { - layout.createDragSource(thing, func); - thing.click(function () { - hub.addAtRoot(func()); + setupAdd($('#add-diff'), function () { + return Components.getDiff(); + }); + setupAdd($('#add-editor'), function () { + return Components.getEditor(); + }); + $('#ui-reset').click(function () { + local.remove('gl'); + window.location.reload(); + }); + $('#thanks-to').click(function () { + new Alert().alert("Special thanks to", $(require('./thanks.html'))); + }); + $('#changes').click(function () { + new Alert().alert("Changelog", $(require('./changelog.html'))); }); } - setupAdd($('#add-diff'), function () { - return Components.getDiff(); - }); - setupAdd($('#add-editor'), function () { - return Components.getEditor(); - }); - $('#ui-reset').click(function () { - local.remove('gl'); - window.location.reload(); - }); - $('#thanks-to').click(function () { - new Alert().alert("Special thanks to", $(require('./thanks.html'))); - }); - $('#changes').click(function () { - new Alert().alert("Changelog", $(require('./changelog.html'))); - }); -} - $(start); }); diff --git a/static/monaco-loader.js b/static/monaco-loader.js index f3fef9e00..df85a045c 100644 --- a/static/monaco-loader.js +++ b/static/monaco-loader.js @@ -5,18 +5,18 @@ var Promise = require('es6-promise').Promise, _loadPromise = null; // Returns promise that will be fulfilled when monaco is available -var waitForMonaco = function() { +var waitForMonaco = function () { if (_loadPromise) { return _loadPromise; } - _loadPromise = new Promise(function(resolve, reject) { + _loadPromise = new Promise(function (resolve, reject) { if (typeof(window.monaco) === 'object') { resolve(window.monaco); return window.monaco; } - window.require(['vs/editor/editor.main'], function() { + window.require(['vs/editor/editor.main'], function () { _loaded = true; resolve(window.monaco); }); diff --git a/static/monaco.js b/static/monaco.js index f15995118..2685f412d 100644 --- a/static/monaco.js +++ b/static/monaco.js @@ -24,6 +24,5 @@ // POSSIBILITY OF SUCH DAMAGE. - //until webpack can support monaco properly it exists on the window module.exports = monaco;
\ No newline at end of file diff --git a/static/options.js b/static/options.js index b26716b81..68edd5e31 100644 --- a/static/options.js +++ b/static/options.js @@ -23,7 +23,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. - "use strict"; - module.exports = window.compilerExplorerOptions; +"use strict"; +module.exports = window.compilerExplorerOptions; diff --git a/static/output.js b/static/output.js index c7c30e2d7..32c3ce295 100644 --- a/static/output.js +++ b/static/output.js @@ -51,12 +51,12 @@ function Output(hub, container, state) { this.fontScale = new FontScale(this.domRoot, state, "pre"); this.container.on('destroy', this.close, this); - + this.eventHub.on('compileResult', this.onCompileResult, this); this.eventHub.on('compilerFontScale', this.onFontScale, this); this.eventHub.on('compilerClose', this.onCompilerClose, this); this.eventHub.emit('outputOpened', this.compilerId); - + this.updateCompilerName(); } diff --git a/static/pascal-mode.js b/static/pascal-mode.js index df70ac895..d39729109 100644 --- a/static/pascal-mode.js +++ b/static/pascal-mode.js @@ -28,114 +28,146 @@ define(function (require) { var monaco = require('monaco'); function definition() { - // Object-Pascal language definition + // Object-Pascal language definition - return { - keywords: [ - 'unit', 'interface', 'implementation', 'uses', - 'function', 'procedure', 'const', 'begin', 'end', 'not', 'while', - 'as', 'for', 'with', - 'else', 'if', - 'break', 'except', 'on', - 'class', 'exec', 'in', 'throw', 'continue', 'finally', 'is', - 'for', 'try', 'then', 'do', - ':','=', 'var', - 'strict', 'private', 'protected', 'public', 'published', - 'type' - ], - operators: [ - '+', '-', '*', '/', 'div', 'mod', - 'shl', 'shr', 'and', 'or', 'xor', 'not', - '<', '>', '<=', '>=', '==', '<>', - '+=', '-=', '*=', '/=', - ], - brackets: [ - ['(',')','delimiter.parenthesis'], - ['[',']','delimiter.square'] - ], - symbols: /[=><!~&|+\-*\/\^%]+/, - delimiters: /[;=.@:,`]/, - escapes: /\\(?:[abfnrtv\\'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, - rawpre: /(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/, - strpre: /(?:[buBU])/, + return { + keywords: [ + 'unit', 'interface', 'implementation', 'uses', + 'function', 'procedure', 'const', 'begin', 'end', 'not', 'while', + 'as', 'for', 'with', + 'else', 'if', + 'break', 'except', 'on', + 'class', 'exec', 'in', 'throw', 'continue', 'finally', 'is', + 'for', 'try', 'then', 'do', + ':', '=', 'var', + 'strict', 'private', 'protected', 'public', 'published', + 'type' + ], + operators: [ + '+', '-', '*', '/', 'div', 'mod', + 'shl', 'shr', 'and', 'or', 'xor', 'not', + '<', '>', '<=', '>=', '==', '<>', + '+=', '-=', '*=', '/=' + ], + brackets: [ + ['(', ')', 'delimiter.parenthesis'], + ['[', ']', 'delimiter.square'] + ], + symbols: /[=><!~&|+\-*\/\^%]+/, + delimiters: /[;=.@:,`]/, + escapes: /\\(?:[abfnrtv\\'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, + rawpre: /(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/, + strpre: /(?:[buBU])/, - // The main tokenizer for our languages - tokenizer: { - root: [ - // strings: need to check first due to the prefix - [/@strpre?(''')/, { token: 'string.delim', bracket: '@open', next: '@mstring.$1' } ], - [/@strpre?'([^'\\]|\\.)*$/, 'string.invalid' ], // non-teminated string - [/@strpre?(['])/, { token: 'string.delim', bracket: '@open', next: '@string.$1' } ], - [/@rawpre(''')/, { token: 'string.delim', bracket: '@open', next: '@mrawstring.$1' } ], - [/@rawpre'([^'\\]|\\.)*$/, 'string.invalid' ], // non-teminated string - [/@rawpre(['])/, { token: 'string.delim', bracket: '@open', next: '@rawstring.$1' } ], - [/__[\w$]*/, 'predefined' ], - [/[a-z_$][\w$]*/, { cases: { '@keywords': 'keyword', - '@default': 'identifier' } }], - [/[A-Z][\w]*/, { cases: { '~[A-Z0-9_]+': 'constructor.identifier', - '@default' : 'namespace.identifier' }}], // to show class names nicely - { include: '@whitespace' }, - [/[()\[\]]/, '@brackets'], - [/@symbols/, { cases: { '@keywords' : 'keyword', - '@operators': 'operator', - '@default' : '' } } ], - [/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'], - [/#$[0-9a-fA-F]+[lL]?/, 'number.hexchar'], - [/#[bB][0-1]+[lL]?/, 'number.char'], - [/(0|[1-9]\d*)[lL]?/, 'number'], - [':', { token: 'keyword', bracket: '@open' }], // bracket for indentation - [/@delimiters/, { cases: { '@keywords': 'keyword', - '@default': 'delimiter' }}], - ], - comment: [ - [/[^\/*]+/, 'comment' ], - [/\/\*/, 'comment', '@push' ], // nested comment - ["\\*/", 'comment', '@pop' ], - [/[\/*]/, 'comment' ] - ], - mstring: [ - { include: '@strcontent' }, - [/'''/, { cases: { '$#==$S2': { token: 'string.delim', bracket: '@close', next: '@pop' }, - '@default': { token: 'string' } } }], - [/["']/, 'string' ], - [/./, 'string.invalid'], - ], - string: [ - { include: '@strcontent' }, - [/[']/, { cases: { '$#==$S2': { token: 'string.delim', bracket: '@close', next: '@pop' }, - '@default': { token: 'string' } } } ], - [/./, 'string.invalid'], - ], - strcontent: [ - [/[^\\']+/, 'string'], - [/\\$/, 'string.escape'], - [/@escapes/, 'string.escape'], - [/\\./, 'string.escape.invalid'], - ], - mrawstring: [ - { include: '@rawstrcontent' }, - [/'''/, { cases: { '$#==$S2': { token: 'string.delim', bracket: '@close', next: '@pop' }, - '@default': { token: 'string' } } }], - [/["']/, 'string' ], - [/./, 'string.invalid'], - ], - rawstring: [ - { include: '@rawstrcontent' }, - [/[']/, { cases: { '$#==$S2': { token: 'string.delim', bracket: '@close', next: '@pop' }, - '@default': { token: 'string' } } } ], - [/./, 'string.invalid'], - ], - rawstrcontent: [ - [/[^\\']+/, 'string'], - [/\\[']/, 'string'], - [/\\/, 'string' ], - ], - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/#.*$/, 'comment'], - ], - }, - }; + // The main tokenizer for our languages + tokenizer: { + root: [ + // strings: need to check first due to the prefix + [/@strpre?(''')/, {token: 'string.delim', bracket: '@open', next: '@mstring.$1'}], + [/@strpre?'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string + [/@strpre?(['])/, {token: 'string.delim', bracket: '@open', next: '@string.$1'}], + [/@rawpre(''')/, {token: 'string.delim', bracket: '@open', next: '@mrawstring.$1'}], + [/@rawpre'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string + [/@rawpre(['])/, {token: 'string.delim', bracket: '@open', next: '@rawstring.$1'}], + [/__[\w$]*/, 'predefined'], + [/[a-z_$][\w$]*/, { + cases: { + '@keywords': 'keyword', + '@default': 'identifier' + } + }], + [/[A-Z][\w]*/, { + cases: { + '~[A-Z0-9_]+': 'constructor.identifier', + '@default': 'namespace.identifier' + } + }], // to show class names nicely + {include: '@whitespace'}, + [/[()\[\]]/, '@brackets'], + [/@symbols/, { + cases: { + '@keywords': 'keyword', + '@operators': 'operator', + '@default': '' + } + }], + [/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'], + [/#$[0-9a-fA-F]+[lL]?/, 'number.hexchar'], + [/#[bB][0-1]+[lL]?/, 'number.char'], + [/(0|[1-9]\d*)[lL]?/, 'number'], + [':', {token: 'keyword', bracket: '@open'}], // bracket for indentation + [/@delimiters/, { + cases: { + '@keywords': 'keyword', + '@default': 'delimiter' + } + }] + ], + comment: [ + [/[^\/*]+/, 'comment'], + [/\/\*/, 'comment', '@push'], // nested comment + ["\\*/", 'comment', '@pop'], + [/[\/*]/, 'comment'] + ], + mstring: [ + {include: '@strcontent'}, + [/'''/, { + cases: { + '$#==$S2': {token: 'string.delim', bracket: '@close', next: '@pop'}, + '@default': {token: 'string'} + } + }], + [/["']/, 'string'], + [/./, 'string.invalid'] + ], + string: [ + {include: '@strcontent'}, + [/[']/, { + cases: { + '$#==$S2': {token: 'string.delim', bracket: '@close', next: '@pop'}, + '@default': {token: 'string'} + } + }], + [/./, 'string.invalid'] + ], + strcontent: [ + [/[^\\']+/, 'string'], + [/\\$/, 'string.escape'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'] + ], + mrawstring: [ + {include: '@rawstrcontent'}, + [/'''/, { + cases: { + '$#==$S2': {token: 'string.delim', bracket: '@close', next: '@pop'}, + '@default': {token: 'string'} + } + }], + [/["']/, 'string'], + [/./, 'string.invalid'] + ], + rawstring: [ + {include: '@rawstrcontent'}, + [/[']/, { + cases: { + '$#==$S2': {token: 'string.delim', bracket: '@close', next: '@pop'}, + '@default': {token: 'string'} + } + }], + [/./, 'string.invalid'] + ], + rawstrcontent: [ + [/[^\\']+/, 'string'], + [/\\[']/, 'string'], + [/\\/, 'string'] + ], + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/#.*$/, 'comment'] + ] + } + }; } monaco.languages.register({id: 'pascal'}); diff --git a/static/rust-mode.js b/static/rust-mode.js index 5122ba3ae..37ca9379d 100644 --- a/static/rust-mode.js +++ b/static/rust-mode.js @@ -112,7 +112,7 @@ function definition() { whitespace: [ [/[ \t\r\n]+/, 'white'], [/\/\*/, 'comment', '@comment'], - [/\/\/.*$/, 'comment'], + [/\/\/.*$/, 'comment'] ], comment: [ @@ -128,8 +128,8 @@ function definition() { [/@escapes/, 'string.escape'], [/\\./, 'string.escape.invalid'], [/"/, 'string', '@pop'] - ], - }, + ] + } }; } diff --git a/static/sharing.js b/static/sharing.js index e745d060f..a1208bd58 100644 --- a/static/sharing.js +++ b/static/sharing.js @@ -23,124 +23,124 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. - "use strict"; - var $ = require('jquery'); - var _ = require('underscore'); - var options = require('options'); - var shortenURL = require('urlshorten-google'); - var Components = require('components'); - var url = require('./url'); +"use strict"; +var $ = require('jquery'); +var _ = require('underscore'); +var options = require('options'); +var shortenURL = require('urlshorten-google'); +var Components = require('components'); +var url = require('./url'); - function configFromEmbedded(embeddedUrl) { - // Old-style link? - var params; - try { - params = url.unrisonify(embeddedUrl); - } catch (e) { - } - if (params && params.source && params.compiler) { - var filters = _.chain((params.filters || "").split(',')) - .map(function (o) { - return [o, true]; - }) - .object() - .value(); - return { - content: [ - { - type: 'row', - content: [ - Components.getEditorWith(1, params.source, filters), - Components.getCompilerWith(1, filters, params.options, params.compiler) - ] - } - ] - }; - } else { - return url.deserialiseState(embeddedUrl); - } +function configFromEmbedded(embeddedUrl) { + // Old-style link? + var params; + try { + params = url.unrisonify(embeddedUrl); + } catch (e) { } - - function getEmbeddedUrl(layout, readOnly) { - var location = window.location.origin + window.location.pathname; - if (location[location.length - 1] !== '/') location += '/'; - var path = readOnly ? 'embed-ro#' : 'e#'; - return location + path + url.serialiseState(layout.toConfig()); + if (params && params.source && params.compiler) { + var filters = _.chain((params.filters || "").split(',')) + .map(function (o) { + return [o, true]; + }) + .object() + .value(); + return { + content: [ + { + type: 'row', + content: [ + Components.getEditorWith(1, params.source, filters), + Components.getCompilerWith(1, filters, params.options, params.compiler) + ] + } + ] + }; + } else { + return url.deserialiseState(embeddedUrl); } +} - function initShareButton(getLink, layout) { - var html = $('.template .urls').html(); - var currentBind = ''; +function getEmbeddedUrl(layout, readOnly) { + var location = window.location.origin + window.location.pathname; + if (location[location.length - 1] !== '/') location += '/'; + var path = readOnly ? 'embed-ro#' : 'e#'; + return location + path + url.serialiseState(layout.toConfig()); +} - var title = getLink.attr('title'); // preserve before popover/tooltip breaks it +function initShareButton(getLink, layout) { + var html = $('.template .urls').html(); + var currentBind = ''; - getLink.popover({ - container: 'body', - content: html, - html: true, - placement: 'bottom', - trigger: 'manual' - }).click(function () { - getLink.popover('show'); - }).on('inserted.bs.popover', function () { - var root = $('.urls-container:visible'); - var urls = {}; - if (!currentBind) currentBind = $(root.find('.sources a')[0]).data().bind; + var title = getLink.attr('title'); // preserve before popover/tooltip breaks it - function update() { - if (!currentBind) return; - root.find('.current').text(currentBind); - $(".permalink:visible").val(urls[currentBind] || ""); - } + getLink.popover({ + container: 'body', + content: html, + html: true, + placement: 'bottom', + trigger: 'manual' + }).click(function () { + getLink.popover('show'); + }).on('inserted.bs.popover', function () { + var root = $('.urls-container:visible'); + var urls = {}; + if (!currentBind) currentBind = $(root.find('.sources a')[0]).data().bind; - root.find('.sources a').on('click', function () { - currentBind = $(this).data().bind; - update(); - }); - getLinks(layout, function (theUrls) { - urls = theUrls; - update(); - }); - update(); - }).attr('title', title); + function update() { + if (!currentBind) return; + root.find('.current').text(currentBind); + $(".permalink:visible").val(urls[currentBind] || ""); + } - // Dismiss the popover on escape. - $(document).on('keyup.editable', function (e) { - if (e.which === 27) { - getLink.popover("hide"); - } + root.find('.sources a').on('click', function () { + currentBind = $(this).data().bind; + update(); }); - - // Dismiss on any click that isn't either in the opening element, inside - // the popover or on any alert - $(document).on('click.editable', function (e) { - var target = $(e.target); - if (!target.is(getLink) && getLink.has(target).length === 0 && target.closest('.popover').length === 0) - getLink.popover("hide"); + getLinks(layout, function (theUrls) { + urls = theUrls; + update(); }); - } + update(); + }).attr('title', title); - function permalink(layout) { - return window.location.href.split('#')[0] + '#' + url.serialiseState(layout.toConfig()); - } + // Dismiss the popover on escape. + $(document).on('keyup.editable', function (e) { + if (e.which === 27) { + getLink.popover("hide"); + } + }); - function getLinks(layout, done) { - var result = { - Full: permalink(layout), - Embed: '<iframe width="800px" height="200px" src="' + getEmbeddedUrl(layout, false) + '"></iframe>', - 'Embed (RO)': '<iframe width="800px" height="200px" src="' + getEmbeddedUrl(layout, true) + '"></iframe>' - }; - if (!options.gapiKey) { + // Dismiss on any click that isn't either in the opening element, inside + // the popover or on any alert + $(document).on('click.editable', function (e) { + var target = $(e.target); + if (!target.is(getLink) && getLink.has(target).length === 0 && target.closest('.popover').length === 0) + getLink.popover("hide"); + }); +} + +function permalink(layout) { + return window.location.href.split('#')[0] + '#' + url.serialiseState(layout.toConfig()); +} + +function getLinks(layout, done) { + var result = { + Full: permalink(layout), + Embed: '<iframe width="800px" height="200px" src="' + getEmbeddedUrl(layout, false) + '"></iframe>', + 'Embed (RO)': '<iframe width="800px" height="200px" src="' + getEmbeddedUrl(layout, true) + '"></iframe>' + }; + if (!options.gapiKey) { + done(result); + } else { + shortenURL(result.Full, function (shorter) { + result.Short = shorter; done(result); - } else { - shortenURL(result.Full, function (shorter) { - result.Short = shorter; - done(result); - }); - } + }); } +} - module.exports = { - initShareButton: initShareButton, - configFromEmbedded: configFromEmbedded - }; +module.exports = { + initShareButton: initShareButton, + configFromEmbedded: configFromEmbedded +}; diff --git a/static/themes/contrast-theme.css b/static/themes/contrast-theme.css index 1294cf97b..9137cb460 100644 --- a/static/themes/contrast-theme.css +++ b/static/themes/contrast-theme.css @@ -73,7 +73,7 @@ .font-option { background: #000; - border: 1 px solid #fff !important; + border: 1px solid #fff !important; } .font-option:hover { diff --git a/static/toggles.js b/static/toggles.js index 59b491ed2..889d9fb00 100644 --- a/static/toggles.js +++ b/static/toggles.js @@ -23,57 +23,57 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. - "use strict"; - var _ = require('underscore'); - var $ = require('jquery'); - var EventEmitter = require('events'); +"use strict"; +var _ = require('underscore'); +var $ = require('jquery'); +var EventEmitter = require('events'); - function get(domRoot) { - var result = {}; - _.each(domRoot.find(".btn"), function (a) { - var obj = $(a); - result[obj.data().bind] = obj.hasClass("active"); - }); - return result; - } +function get(domRoot) { + var result = {}; + _.each(domRoot.find(".btn"), function (a) { + var obj = $(a); + result[obj.data().bind] = obj.hasClass("active"); + }); + return result; +} - function Toggles(root, state) { - EventEmitter.call(this); - this.domRoot = root; - state = _.extend(get(this.domRoot), state); - this.domRoot.find('.btn') - .click(_.bind(this.onClick, this)) - .each(function () { - $(this).toggleClass('active', !!state[$(this).data().bind]); - }); - this.state = state; - } +function Toggles(root, state) { + EventEmitter.call(this); + this.domRoot = root; + state = _.extend(get(this.domRoot), state); + this.domRoot.find('.btn') + .click(_.bind(this.onClick, this)) + .each(function () { + $(this).toggleClass('active', !!state[$(this).data().bind]); + }); + this.state = state; +} - _.extend(Toggles.prototype, EventEmitter.prototype); +_.extend(Toggles.prototype, EventEmitter.prototype); - Toggles.prototype.get = function () { - return _.clone(this.state); - }; +Toggles.prototype.get = function () { + return _.clone(this.state); +}; - Toggles.prototype.set = function (key, value) { - this._change(function() { - this.state[key] = value; - }.bind(this)); - }; +Toggles.prototype.set = function (key, value) { + this._change(function () { + this.state[key] = value; + }.bind(this)); +}; - Toggles.prototype._change = function(update) { - var before = this.get(); - update(); - this.emit('change', before, this.get()); - }; +Toggles.prototype._change = function (update) { + var before = this.get(); + update(); + this.emit('change', before, this.get()); +}; - Toggles.prototype.onClick = function (event) { - var button = $(event.currentTarget); - if (button.hasClass("disabled")) return; - button.toggleClass('active'); - this._change(function() { - this.state = get(this.domRoot); - }.bind(this)); - }; +Toggles.prototype.onClick = function (event) { + var button = $(event.currentTarget); + if (button.hasClass("disabled")) return; + button.toggleClass('active'); + this._change(function () { + this.state = get(this.domRoot); + }.bind(this)); +}; - module.exports = Toggles; +module.exports = Toggles; diff --git a/static/url.js b/static/url.js index e514b2cbf..1ac4ceeb2 100644 --- a/static/url.js +++ b/static/url.js @@ -115,7 +115,7 @@ function serialiseState(stateText) { } } -module.exports = { +module.exports = { deserialiseState: deserialiseState, serialiseState: serialiseState, unrisonify: unrisonify, |