LaravelTest
193 строки · 9.8 Кб
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
5
6(function(mod) {7if (typeof exports == "object" && typeof module == "object") // CommonJS8mod(require("../../lib/codemirror"));9else if (typeof define == "function" && define.amd) // AMD10define(["../../lib/codemirror"], mod);11else // Plain browser env12mod(CodeMirror);13})(function(CodeMirror) {14"use strict";15
16CodeMirror.defineMIME("text/mirc", "mirc");17CodeMirror.defineMode("mirc", function() {18function parseWords(str) {19var obj = {}, words = str.split(" ");20for (var i = 0; i < words.length; ++i) obj[words[i]] = true;21return obj;22}23var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " +24"$activewid $address $addtok $agent $agentname $agentstat $agentver " +25"$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " +26"$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " +27"$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " +28"$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " +29"$com $comcall $comchan $comerr $compact $compress $comval $cos $count " +30"$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " +31"$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " +32"$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " +33"$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " +34"$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " +35"$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " +36"$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " +37"$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " +38"$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " +39"$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " +40"$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " +41"$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " +42"$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " +43"$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " +44"$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " +45"$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " +46"$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " +47"$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " +48"$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " +49"$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " +50"$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " +51"$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " +52"$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " +53"$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " +54"$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " +55"$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " +56"$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " +57"$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " +58"$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor");59var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " +60"away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " +61"channel clear clearall cline clipboard close cnick color comclose comopen " +62"comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " +63"debug dec describe dialog did didtok disable disconnect dlevel dline dll " +64"dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " +65"drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " +66"events exit fclose filter findtext finger firewall flash flist flood flush " +67"flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " +68"gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " +69"halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " +70"ialmark identd if ignore iline inc invite iuser join kick linesep links list " +71"load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " +72"notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " +73"qme qmsg query queryn quit raw reload remini remote remove rename renwin " +74"reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " +75"say scid scon server set showmirc signam sline sockaccept sockclose socklist " +76"socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " +77"sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " +78"toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " +79"var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " +80"isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " +81"isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " +82"elseif else goto menu nicklist status title icon size option text edit " +83"button check radio box scroll list combo link tab item");84var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");85var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;86function chain(stream, state, f) {87state.tokenize = f;88return f(stream, state);89}90function tokenBase(stream, state) {91var beforeParams = state.beforeParams;92state.beforeParams = false;93var ch = stream.next();94if (/[\[\]{}\(\),\.]/.test(ch)) {95if (ch == "(" && beforeParams) state.inParams = true;96else if (ch == ")") state.inParams = false;97return null;98}99else if (/\d/.test(ch)) {100stream.eatWhile(/[\w\.]/);101return "number";102}103else if (ch == "\\") {104stream.eat("\\");105stream.eat(/./);106return "number";107}108else if (ch == "/" && stream.eat("*")) {109return chain(stream, state, tokenComment);110}111else if (ch == ";" && stream.match(/ *\( *\(/)) {112return chain(stream, state, tokenUnparsed);113}114else if (ch == ";" && !state.inParams) {115stream.skipToEnd();116return "comment";117}118else if (ch == '"') {119stream.eat(/"/);120return "keyword";121}122else if (ch == "$") {123stream.eatWhile(/[$_a-z0-9A-Z\.:]/);124if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) {125return "keyword";126}127else {128state.beforeParams = true;129return "builtin";130}131}132else if (ch == "%") {133stream.eatWhile(/[^,\s()]/);134state.beforeParams = true;135return "string";136}137else if (isOperatorChar.test(ch)) {138stream.eatWhile(isOperatorChar);139return "operator";140}141else {142stream.eatWhile(/[\w\$_{}]/);143var word = stream.current().toLowerCase();144if (keywords && keywords.propertyIsEnumerable(word))145return "keyword";146if (functions && functions.propertyIsEnumerable(word)) {147state.beforeParams = true;148return "keyword";149}150return null;151}152}153function tokenComment(stream, state) {154var maybeEnd = false, ch;155while (ch = stream.next()) {156if (ch == "/" && maybeEnd) {157state.tokenize = tokenBase;158break;159}160maybeEnd = (ch == "*");161}162return "comment";163}164function tokenUnparsed(stream, state) {165var maybeEnd = 0, ch;166while (ch = stream.next()) {167if (ch == ";" && maybeEnd == 2) {168state.tokenize = tokenBase;169break;170}171if (ch == ")")172maybeEnd++;173else if (ch != " ")174maybeEnd = 0;175}176return "meta";177}178return {179startState: function() {180return {181tokenize: tokenBase,182beforeParams: false,183inParams: false184};185},186token: function(stream, state) {187if (stream.eatSpace()) return null;188return state.tokenize(stream, state);189}190};191});192
193});194