算法评测平台前端。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
13 KiB

/*!
* monaco-ace-tokenizer
* Version - 0.1.1
* Author - Brijesh Bittu <brijesh@bitwiser.in> (http://bitwiser.in/)
*/
/*!
* For files in src/ace/
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("monaco-editor")):"function"==typeof define&&define.amd?define(["vs/editor/editor.main"],t):"object"==typeof exports?exports.MonacoAceTokenizer=t(require("monaco-editor")):e.MonacoAceTokenizer=t(e.monaco)}(self,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=2e3,o=function(e){for(var t in this.states=e,this.regExps={},this.matchMappings={},this.states){for(var n=this.states[t],r=[],o=0,i=this.matchMappings[t]={defaultToken:"text"},s="g",u=[],a=0;a<n.length;a++){var l=n[a];if(l.defaultToken&&(i.defaultToken=l.defaultToken),l.caseInsensitive&&(s="gi"),null!=l.regex){l.regex instanceof RegExp&&(l.regex=l.regex.toString().slice(1,-1));var f=l.regex,c=new RegExp("(?:("+f+")|(.))").exec("a").length-2;Array.isArray(l.token)?1==l.token.length||1==c?l.token=l.token[0]:c-1!=l.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:l,groupCount:c-1}),l.token=l.token[0]):(l.tokenArray=l.token,l.token=null,l.onMatch=this.$arrayTokens):"function"!=typeof l.token||l.onMatch||(l.onMatch=c>1?this.$applyToken:l.token),c>1&&(/\\\d/.test(l.regex)?f=l.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+o+1)}):(c=1,f=this.removeCapturingGroups(l.regex)),l.splitRegex||"string"==typeof l.token||u.push(l)),i[o]=a,o+=c,r.push(f),l.onMatch||(l.onMatch=null)}}r.length||(i[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,s)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",s)}};(function(){this.$setMaxTokenCount=function(e){r=0|e},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if("string"==typeof n)return[{type:n,value:e}];for(var r=[],o=0,i=n.length;o<i;o++)t[o]&&(r[r.length]={type:n[o],value:t[o]});return r},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var n=[],r=this.tokenArray,o=0,i=r.length;o<i;o++)t[o+1]&&(n[n.length]={type:r[o],value:t[o+1]});return n},this.removeCapturingGroups=function(e){return e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e})},this.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var n=0,r=!1,o={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,i,s,u,a){return r?r="]"!=u:u?r=!0:s?(n==o.stack&&(o.end=a+1,o.stack=-1),n--):i&&(n++,1!=i.length&&(o.stack=n,o.start=a)),e}),null!=o.end&&/^\)*$/.test(e.substr(o.end))&&(e=e.substring(0,o.start)+e.substr(o.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&"string"!=typeof t)"#tmp"===(t=(n=t.slice(0))[0])&&(n.shift(),t=n.shift());else var n=[];var o=t||"start",i=this.states[o];i||(o="start",i=this.states[o]);var s=this.matchMappings[o],u=this.regExps[o];u.lastIndex=0;for(var a,l=[],f=0,c=0,p={type:null,value:""};a=u.exec(e);){var h=s.defaultToken,g=null,d=a[0],y=u.lastIndex;if(y-d.length>f){var v=e.substring(f,y-d.length);p.type==h?p.value+=v:(p.type&&l.push(p),p={type:h,value:v})}for