From 7efe8c933b5d193309de8cb49085181232b9e5a5 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:17:10 -0500 Subject: [PATCH 01/19] Update modelist.js Included MUSHcode in Mode List --- demo/kitchen-sink/modelist.js | 1 + 1 file changed, 1 insertion(+) diff --git a/demo/kitchen-sink/modelist.js b/demo/kitchen-sink/modelist.js index 74e692d0..6511057c 100644 --- a/demo/kitchen-sink/modelist.js +++ b/demo/kitchen-sink/modelist.js @@ -74,6 +74,7 @@ var modesByName = { lsl: ["LSL" , "lsl"], makefile: ["Makefile" , "^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"], markdown: ["Markdown" , "md|markdown"], + mushcode: ["Tiny MUSH" , "mc|mush"] objectivec: ["Objective-C" , "m"], ocaml: ["OCaml" , "ml|mli"], pascal: ["Pascal" , "pas|p"], From fad204c0075263cc4b6a150075d599184cdebe71 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:07:25 -0500 Subject: [PATCH 02/19] Create mushcode_high_rules.js Adding support for TinyMUSH --- lib/ace/mode/mushcode_high_rules.js | 589 ++++++++++++++++++++++++++++ 1 file changed, 589 insertions(+) create mode 100644 lib/ace/mode/mushcode_high_rules.js diff --git a/lib/ace/mode/mushcode_high_rules.js b/lib/ace/mode/mushcode_high_rules.js new file mode 100644 index 00000000..6b05f5c3 --- /dev/null +++ b/lib/ace/mode/mushcode_high_rules.js @@ -0,0 +1,589 @@ +/* + * MUSHCodeMode + */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var MushCodeRules = function() { + + var keywords = ( + "@if|"+ + "@ifelse|"+ + "@switch|"+ + "@halt|"+ + "@dolist|"+ + "@create|"+ + "@scent|"+ + "@sound|"+ + "@touch|"+ + "@ataste|"+ + "@osound|"+ + "@otouch|"+ + "@otaste|"+ + "@drop|"+ + "@odrop|"+ + "@adrop|"+ + "@dropfail|"+ + "@odropfail|"+ + "@smell|"+ + "@oemit|"+ + "@emit|"+ + "@pemit|"+ + "@parent|"+ + "@clone|"+ + "@taste|"+ + "whisper|"+ + "page|"+ + "say|"+ + "pose|"+ + "semipose|"+ + "teach|"+ + "touch|"+ + "taste|"+ + "smell|"+ + "listen|"+ + "look|"+ + "move|"+ + "go|"+ + "home|"+ + "follow|"+ + "unfollow|"+ + "desert|"+ + "dismiss|"+ + "@tel" + ); + + var builtinConstants = ( + "=#0" + ); + + var builtinFunctions = ( + "default|"+ + "edefault|"+ + "eval|"+ + "get_eval|"+ + "get|"+ + "grep|"+ + "grepi|"+ + "hasattr|"+ + "hasattrp|"+ + "hasattrval|"+ + "hasattrpval|"+ + "lattr|"+ + "nattr|"+ + "poss|"+ + "udefault|"+ + "ufun|"+ + "u|"+ + "v|"+ + "uldefault|"+ + "xget|"+ + "zfun|"+ + "band|"+ + "bnand|"+ + "bnot|"+ + "bor|"+ + "bxor|"+ + "shl|"+ + "shr|"+ + "and|"+ + "cand|"+ + "cor|"+ + "eq|"+ + "gt|"+ + "gte|"+ + "lt|"+ + "lte|"+ + "nand|"+ + "neq|"+ + "nor|"+ + "not|"+ + "or|"+ + "t|"+ + "xor|"+ + "con|"+ + "entrances|"+ + "exit|"+ + "followers|"+ + "home|"+ + "lcon|"+ + "lexits|"+ + "loc|"+ + "locate|"+ + "lparent|"+ + "lsearch|"+ + "next|"+ + "num|"+ + "owner|"+ + "parent|"+ + "pmatch|"+ + "rloc|"+ + "rnum|"+ + "room|"+ + "where|"+ + "zone|"+ + "worn|"+ + "held|"+ + "carried|"+ + "acos|"+ + "asin|"+ + "atan|"+ + "ceil|"+ + "cos|"+ + "e|"+ + "exp|"+ + "fdiv|"+ + "fmod|"+ + "floor|"+ + "log|"+ + "ln|"+ + "pi|"+ + "power|"+ + "round|"+ + "sin|"+ + "sqrt|"+ + "tan|"+ + "aposs|"+ + "andflags|"+ + "conn|"+ + "commandssent|"+ + "controls|"+ + "doing|"+ + "elock|"+ + "findable|"+ + "flags|"+ + "fullname|"+ + "hasflag|"+ + "haspower|"+ + "hastype|"+ + "hidden|"+ + "idle|"+ + "isbaker|"+ + "lock|"+ + "lstats|"+ + "money|"+ + "who|"+ + "name|"+ + "nearby|"+ + "obj|"+ + "objflags|"+ + "photo|"+ + "poll|"+ + "powers|"+ + "pendingtext|"+ + "receivedtext|"+ + "restarts|"+ + "restarttime|"+ + "subj|"+ + "shortestpath|"+ + "tmoney|"+ + "type|"+ + "visible|"+ + "cat|"+ + "element|"+ + "elements|"+ + "extract|"+ + "filter|"+ + "filterbool|"+ + "first|"+ + "foreach|"+ + "fold|"+ + "grab|"+ + "graball|"+ + "index|"+ + "insert|"+ + "itemize|"+ + "items|"+ + "iter|"+ + "last|"+ + "ldelete|"+ + "map|"+ + "match|"+ + "matchall|"+ + "member|"+ + "mix|"+ + "munge|"+ + "pick|"+ + "remove|"+ + "replace|"+ + "rest|"+ + "revwords|"+ + "setdiff|"+ + "setinter|"+ + "setunion|"+ + "shuffle|"+ + "sort|"+ + "sortby|"+ + "splice|"+ + "step|"+ + "wordpos|"+ + "words|"+ + "add|"+ + "lmath|"+ + "max|"+ + "mean|"+ + "median|"+ + "min|"+ + "mul|"+ + "percent|"+ + "sign|"+ + "stddev|"+ + "sub|"+ + "val|"+ + "bound|"+ + "abs|"+ + "inc|"+ + "dec|"+ + "dist2d|"+ + "dist3d|"+ + "div|"+ + "floordiv|"+ + "mod|"+ + "modulo|"+ + "remainder|"+ + "vadd|"+ + "vdim|"+ + "vdot|"+ + "vmag|"+ + "vmax|"+ + "vmin|"+ + "vmul|"+ + "vsub|"+ + "vunit|"+ + "regedit|"+ + "regeditall|"+ + "regeditalli|"+ + "regediti|"+ + "regmatch|"+ + "regmatchi|"+ + "regrab|"+ + "regraball|"+ + "regraballi|"+ + "regrabi|"+ + "regrep|"+ + "regrepi|"+ + "after|"+ + "alphamin|"+ + "alphamax|"+ + "art|"+ + "before|"+ + "brackets|"+ + "capstr|"+ + "case|"+ + "caseall|"+ + "center|"+ + "containsfansi|"+ + "comp|"+ + "decompose|"+ + "decrypt|"+ + "delete|"+ + "edit|"+ + "encrypt|"+ + "escape|"+ + "if|"+ + "lcstr|"+ + "left|"+ + "lit|"+ + "ljust|"+ + "merge|"+ + "mid|"+ + "ostrlen|"+ + "pos|"+ + "repeat|"+ + "reverse|"+ + "right|"+ + "rjust|"+ + "scramble|"+ + "secure|"+ + "space|"+ + "spellnum|"+ + "squish|"+ + "strcat|"+ + "strmatch|"+ + "strinsert|"+ + "stripansi|"+ + "stripfansi|"+ + "strlen|"+ + "switch|"+ + "switchall|"+ + "table|"+ + "tr|"+ + "trim|"+ + "ucstr|"+ + "unsafe|"+ + "wrap|"+ + "ctitle|"+ + "cwho|"+ + "channels|"+ + "clock|"+ + "cflags|"+ + "ilev|"+ + "itext|"+ + "inum|"+ + "convsecs|"+ + "convutcsecs|"+ + "convtime|"+ + "ctime|"+ + "etimefmt|"+ + "isdaylight|"+ + "mtime|"+ + "secs|"+ + "msecs|"+ + "starttime|"+ + "time|"+ + "timefmt|"+ + "timestring|"+ + "utctime|"+ + "atrlock|"+ + "clone|"+ + "create|"+ + "cook|"+ + "dig|"+ + "emit|"+ + "lemit|"+ + "link|"+ + "oemit|"+ + "open|"+ + "pemit|"+ + "remit|"+ + "set|"+ + "tel|"+ + "wipe|"+ + "zemit|"+ + "fbcreate|"+ + "fbdestroy|"+ + "fbwrite|"+ + "fbclear|"+ + "fbcopy|"+ + "fbcopyto|"+ + "fbclip|"+ + "fbdump|"+ + "fbflush|"+ + "fbhset|"+ + "fblist|"+ + "fbstats|"+ + "qentries|"+ + "qentry|"+ + "play|"+ + "ansi|"+ + "break|"+ + "c|"+ + "asc|"+ + "die|"+ + "isdbref|"+ + "isint|"+ + "isnum|"+ + "isletters|"+ + "linecoords|"+ + "localize|"+ + "lnum|"+ + "nameshort|"+ + "null|"+ + "objeval|"+ + "r|"+ + "rand|"+ + "s|"+ + "setq|"+ + "setr|"+ + "soundex|"+ + "soundslike|"+ + "valid|"+ + "vchart|"+ + "vchart2|"+ + "vlabel|"+ + "@@|"+ + "bakerdays|"+ + "bodybuild|"+ + "box|"+ + "capall|"+ + "catalog|"+ + "children|"+ + "ctrailer|"+ + "darttime|"+ + "debt|"+ + "detailbar|"+ + "exploredroom|"+ + "fansitoansi|"+ + "fansitoxansi|"+ + "fullbar|"+ + "halfbar|"+ + "isdarted|"+ + "isnewbie|"+ + "isword|"+ + "lambda|"+ + "lobjects|"+ + "lplayers|"+ + "lthings|"+ + "lvexits|"+ + "lvobjects|"+ + "lvplayers|"+ + "lvthings|"+ + "newswrap|"+ + "numsuffix|"+ + "playerson|"+ + "playersthisweek|"+ + "randomad|"+ + "randword|"+ + "realrandword|"+ + "replacechr|"+ + "second|"+ + "splitamount|"+ + "strlenall|"+ + "text|"+ + "third|"+ + "tofansi|"+ + "totalac|"+ + "unique|"+ + "getaddressroom|"+ + "listpropertycomm|"+ + "listpropertyres|"+ + "lotowner|"+ + "lotrating|"+ + "lotratingcount|"+ + "lotvalue|"+ + "boughtproduct|"+ + "companyabb|"+ + "companyicon|"+ + "companylist|"+ + "companyname|"+ + "companyowners|"+ + "companyvalue|"+ + "employees|"+ + "invested|"+ + "productlist|"+ + "productname|"+ + "productowners|"+ + "productrating|"+ + "productratingcount|"+ + "productsoldat|"+ + "producttype|"+ + "ratedproduct|"+ + "soldproduct|"+ + "topproducts|"+ + "totalspentonproduct|"+ + "totalstock|"+ + "transfermoney|"+ + "uniquebuyercount|"+ + "uniqueproductsbought|"+ + "validcompany|"+ + "deletepicture|"+ + "fbsave|"+ + "getpicturesecurity|"+ + "haspicture|"+ + "listpictures|"+ + "picturesize|"+ + "replacecolor|"+ + "rgbtocolor|"+ + "savepicture|"+ + "setpicturesecurity|"+ + "showpicture|"+ + "piechart|"+ + "piechartlabel|"+ + "createmaze|"+ + "drawmaze|"+ + "drawwireframe" + ); + + //var futureReserved = ""; + var keywordMapper = this.createKeywordMapper({ + "invalid.deprecated": "debugger", + "support.function": builtinFunctions, + //"invalid.illegal": futureReserved, + "constant.language": builtinConstants, + "keyword": keywords + }, "identifier"); + + var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; + + var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; + var octInteger = "(?:0[oO]?[0-7]+)"; + var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; + var binInteger = "(?:0[bB][01]+)"; + var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; + + var exponent = "(?:[eE][+-]?\\d+)"; + var fraction = "(?:\\.\\d+)"; + var intPart = "(?:\\d+)"; + var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; + var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; + var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; + + this.$rules = { + "start" : [ { + token : "comment", + regex : ";.*$" + }, { + token : "string", // """ string + regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}' + }, { + token : "string", // multi line """ string start + regex : strPre + '"{3}.*$', + next : "qqstring" + }, { + token : "string", // " string + regex : strPre + '"(?:[^\\\\]|\\\\.)*?"' + }, { + token : "string", // ''' string + regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}" + }, { + token : "string", // multi line ''' string start + regex : strPre + "'{3}.*$", + next : "qstring" + }, { + token : "string", // ' string + regex : strPre + "'(?:[^\\\\]|\\\\.)*?'" + }, { + token : "constant.numeric", // imaginary + regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" + }, { + token : "constant.numeric", // float + regex : floatNumber + }, { + token : "constant.numeric", // long integer + regex : integer + "[lL]\\b" + }, { + token : "constant.numeric", // integer + regex : integer + "\\b" + }, { + token : keywordMapper, + regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token : "keyword.operator", + regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" + }, { + token : "paren.lparen", + regex : "[\\[\\(\\{]" + }, { + token : "paren.rparen", + regex : "[\\]\\)\\}]" + }, { + token : "text", + regex : "\\s+" + } ], + "qqstring" : [ { + token : "string", // multi line """ string end + regex : '(?:[^\\\\]|\\\\.)*?"{3}', + next : "start" + }, { + token : "string", + regex : '.+' + } ], + "qstring" : [ { + token : "string", // multi line ''' string end + regex : "(?:[^\\\\]|\\\\.)*?'{3}", + next : "start" + }, { + token : "string", + regex : '.+' + } ] + }; +}; + +oop.inherits(MushCodeRules, TextHighlightRules); + +exports.MushCodeRules = MushCodeRules; +}); From f5cd45b925c6bb310c670a41b30794aa2aea31da Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:12:50 -0500 Subject: [PATCH 03/19] Create mushcode.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current borrows off the python folding rules.  Folding doesn't really help mushcode unless you are using a code minimizer. --- lib/ace/mode/mushcode.js | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 lib/ace/mode/mushcode.js diff --git a/lib/ace/mode/mushcode.js b/lib/ace/mode/mushcode.js new file mode 100644 index 00000000..6fe00e17 --- /dev/null +++ b/lib/ace/mode/mushcode.js @@ -0,0 +1,116 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * 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. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var MushCodeRules = require("./mushcode_high_rules").MushCodeRules; +var PythonFoldMode = require("./folding/pythonic").FoldMode; +var Range = require("../range").Range; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new PythonHighlightRules().getRules()); + this.foldingRules = new PythonFoldMode("\\:"); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "#"; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + if (state == "start") { + var match = line.match(/^.*[\{\(\[\:]\s*$/); + if (match) { + indent += tab; + } + } + + return indent; + }; + + var outdents = { + "pass": 1, + "return": 1, + "raise": 1, + "break": 1, + "continue": 1 + }; + + this.checkOutdent = function(state, line, input) { + if (input !== "\r\n" && input !== "\r" && input !== "\n") + return false; + + var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens; + + if (!tokens) + return false; + + // ignore trailing comments + do { + var last = tokens.pop(); + } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); + + if (!last) + return false; + + return (last.type == "keyword" && outdents[last.value]); + }; + + this.autoOutdent = function(state, doc, row) { + // outdenting in python is slightly different because it always applies + // to the next line and only of a new line is inserted + + row += 1; + var indent = this.$getIndent(doc.getLine(row)); + var tab = doc.getTabString(); + if (indent.slice(-tab.length) == tab) + doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + + + From 69ea968649fb7e3655d688b06fd95b6ce52e5245 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:18:54 -0500 Subject: [PATCH 04/19] Update modelist.js Added MUSHCode to ModeList in Kitchensink --- demo/kitchen-sink/modelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/kitchen-sink/modelist.js b/demo/kitchen-sink/modelist.js index 6511057c..24dfe170 100644 --- a/demo/kitchen-sink/modelist.js +++ b/demo/kitchen-sink/modelist.js @@ -74,7 +74,7 @@ var modesByName = { lsl: ["LSL" , "lsl"], makefile: ["Makefile" , "^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"], markdown: ["Markdown" , "md|markdown"], - mushcode: ["Tiny MUSH" , "mc|mush"] + mushcode: ["TinyMUSH" , "mc|mush"], objectivec: ["Objective-C" , "m"], ocaml: ["OCaml" , "ml|mli"], pascal: ["Pascal" , "pas|p"], From cb3abb8257ac8d746c595c4416a432af80c929e5 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:21:08 -0500 Subject: [PATCH 05/19] Update doclist.js Added to docs as per ace docs for TinyMUSH code hilighter --- demo/kitchen-sink/doclist.js | 1 + 1 file changed, 1 insertion(+) diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 414acce0..867e2cef 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -101,6 +101,7 @@ var docs = { "docs/luapage.lp": "LuaPage", "docs/Makefile": "Makefile", "docs/markdown.md": {name: "Markdown", wrapped: true}, + "docs/mushcode.mc": {name: "TinyMUSH"}, "docs/objectivec.m": {name: "Objective-C"}, "docs/ocaml.ml": "OCaml", "docs/OpenSCAD.scad": "OpenSCAD", From 84f167b82875787006406c57be2338b27505d93c Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:23:37 -0500 Subject: [PATCH 06/19] Create tinymush.mc Example MUSHcode --- demo/kitchen-sink/docs/tinymush.mc | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 demo/kitchen-sink/docs/tinymush.mc diff --git a/demo/kitchen-sink/docs/tinymush.mc b/demo/kitchen-sink/docs/tinymush.mc new file mode 100644 index 00000000..6861f955 --- /dev/null +++ b/demo/kitchen-sink/docs/tinymush.mc @@ -0,0 +1,8 @@ +@create phone +&pickup phone=$pick up:@ifelse [u(is,u(mode),ICC)]={@pemit %#=You pick up the [fullname(me)].[set(me,PHONER:%#)][set(me,MODE:CIP)][set([u(INCOMING)],CONNECTED:[num(me)])][set(me,CONNECTED:[u(INCOMING)])]%r[showpicture(PICPICKUP)]%rUse '[color(green,black,psay )]' (or '[color(green,black,p )]') to talk into the phone.;@oemit %#=%N picks up the [fullname(me)].},{@pemit %#=You pick up the phone but no one is there. You hear a dialtone and then hang up. [play(u(DIALTONE))];@oemit %#=%N picks up the phone, but no one is on the other end.} +&ringfun phone=[ifelse(eq(comp([u(%0/ringtone)],off),0),[color(black,cyan,INCOMING CALL FROM %1)],[play([switch([u(%0/ringtone)],1,[u(%0/ringtone1)],2,[u(%0/ringtone2)],3,[u(%0/ringtone3)],4,[u(%0/ringtone4)],5,[u(%0/ringtone5)],6,[u(%0/ringtone6)],7,[u(%0/ringtone7)],8,[u(%0/ringtone8)],9,[u(%0/ringtone9)],custom,[u(%0/customtone)],vibrate,[u(%0/vibrate)])])] +&ringloop phone=@switch [u(ringstate)]=1,{@emit [setq(q,[u(connecting)])][set(%qq,rangs:0)][set(%qq,mode:WFC)][set(%qq,INCOMING:)];@ifelse [u(%qq/HASVMB)]={@tr me/ROUTEVMB=[u(connecting)];},{@pemit %#=[u(MSGCNC)];}},2,{@pemit %#=The call is connected.[setq(q,[u(CONNECTING)])][set(me,CONNECTED:%qq)][set(%qq,CONNECTED:[num(me)])][set(%qq,MODE:CIP)];@tr me/ciploop;@tr %qq/ciploop;},3,{@emit On [fullname(me)]'s earpiece you hear a ringing sound.[play(u(LINETONE))];@tr me/ringhere;@increment [u(connecting)]/RANGS;@wait 5={@tr me/ringloop};},4,{} +&ringstate phone=[setq(q,u(connecting))][setq(1,[gt(u(%qq/rangs),sub(u(%qq/rings),1))])][setq(2,[and(u(is,u(%qq/MODE),CIP),u(is,u(%qq/INCOMING),[num(me)]))][setq(3,[u(is,u(%qq/MODE),ICC)])][ifelse(%q1,1,ifelse(%q2,2,ifelse(%q3,3,4)))] +;comment +@@(comment) +say [time()] From 3637c8d87b9fc9e91e3e3ef4083aa97d6bcbeed2 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:24:27 -0500 Subject: [PATCH 07/19] Update doclist.js Modified name of file --- demo/kitchen-sink/doclist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 867e2cef..6fe81002 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -101,7 +101,7 @@ var docs = { "docs/luapage.lp": "LuaPage", "docs/Makefile": "Makefile", "docs/markdown.md": {name: "Markdown", wrapped: true}, - "docs/mushcode.mc": {name: "TinyMUSH"}, + "docs/tinymush.mc": {name: "TinyMUSH"}, "docs/objectivec.m": {name: "Objective-C"}, "docs/ocaml.ml": "OCaml", "docs/OpenSCAD.scad": "OpenSCAD", From c17238765bc457e4940b259b0d5300e1cd577125 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:39:01 -0500 Subject: [PATCH 08/19] Update mushcode.js Typo --- lib/ace/mode/mushcode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/mushcode.js b/lib/ace/mode/mushcode.js index 6fe00e17..689ff9df 100644 --- a/lib/ace/mode/mushcode.js +++ b/lib/ace/mode/mushcode.js @@ -39,7 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new PythonHighlightRules().getRules()); + this.$tokenizer = new Tokenizer(new MushCodeRules().getRules()); this.foldingRules = new PythonFoldMode("\\:"); }; oop.inherits(Mode, TextMode); From 1042f2a1060a6b3f791ac13a6a4d0270bbf59bc6 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:51:36 -0500 Subject: [PATCH 09/19] Create terminal.css Adding new theme "Terminal" --- lib/ace/theme/terminal.css | 136 +++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 lib/ace/theme/terminal.css diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css new file mode 100644 index 00000000..911ef755 --- /dev/null +++ b/lib/ace/theme/terminal.css @@ -0,0 +1,136 @@ +.ace-terminal-theme .ace_gutter { + background: #1a0005; + color: steelblue +} + +.ace-terminal-theme .ace_print-margin { + width: 1px; + background: #1a1a1a +} + +.ace-terminal-theme .ace_scroller { + background-color: black +} + +.ace-terminal-theme .ace_text-layer { + color: #DEDEDE +} + +.ace-terminal-theme .ace_cursor { + border-left: 2px solid springgreen +} + +.ace-terminal-theme .ace_overwrite-cursors .ace_cursor { + border-left: 0px; + border-bottom: 1px solid #9F9F9F +} + +.ace-terminal-theme .ace_marker-layer .ace_selection { + background: #424242 +} + +.ace-terminal-theme.ace_multiselect .ace_selection.ace_start { + box-shadow: 0 0 3px 0px black; + border-radius: 2px +} + +.ace-terminal-theme .ace_marker-layer .ace_step { + background: rgb(0, 0, 0) +} + +.ace-terminal-theme .ace_marker-layer .ace_bracket { + margin: -1px 0 0 -1px; + border: 1px solid #F00 +} + +.ace-terminal-theme .ace_marker-layer .ace_active-line { + background: #2A2A2A +} + +.ace-terminal-theme .ace_gutter-active-line { + background-color: #2A112A +} + +.ace-terminal-theme .ace_marker-layer .ace_selected-word { + border: 1px solid #424242 +} + +.ace-terminal-theme .ace_invisible { + color: #343434 +} + +.ace-terminal-theme .ace_keyword, +.ace-terminal-theme .ace_meta, +.ace-terminal-theme .ace_storage, +.ace-terminal-theme .ace_storage.ace_type, +.ace-terminal-theme .ace_support.ace_type { + color: tomato +} + +.ace-terminal-theme .ace_keyword.ace_operator { + color: deeppink +} + +.ace-terminal-theme .ace_constant.ace_character, +.ace-terminal-theme .ace_constant.ace_language, +.ace-terminal-theme .ace_constant.ace_numeric, +.ace-terminal-theme .ace_keyword.ace_other.ace_unit, +.ace-terminal-theme .ace_support.ace_constant, +.ace-terminal-theme .ace_variable.ace_parameter { + color: #E78C45 +} + +.ace-terminal-theme .ace_constant.ace_other { + color: gold +} + +.ace-terminal-theme .ace_invalid { + color: yellow; + background-color: red +} + +.ace-terminal-theme .ace_invalid.ace_deprecated { + color: #CED2CF; + background-color: #B798BF +} + +.ace-terminal-theme .ace_fold { + background-color: #7AA6DA; + border-color: #DEDEDE +} + +.ace-terminal-theme .ace_entity.ace_name.ace_function, +.ace-terminal-theme .ace_support.ace_function, +.ace-terminal-theme .ace_variable { + color: #7AA6DA +} + +.ace-terminal-theme .ace_support.ace_class, +.ace-terminal-theme .ace_support.ace_type { + color: #E7C547 +} + +.ace-terminal-theme .ace_markup.ace_heading, +.ace-terminal-theme .ace_string { + color: #B9CA4A +} + +.ace-terminal-theme .ace_entity.ace_name.ace_tag, +.ace-terminal-theme .ace_entity.ace_other.ace_attribute-name, +.ace-terminal-theme .ace_meta.ace_tag, +.ace-terminal-theme .ace_string.ace_regexp, +.ace-terminal-theme .ace_variable { + color: #D54E53 +} + +.ace-terminal-theme .ace_comment { + color: orangered +} + +.ace-terminal-theme .ace_markup.ace_underline { + text-decoration: underline +} + +.ace-terminal-theme .ace_indent-guide { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGD4z7Bq1ar/AAz9A/2naJQKAAAAAElFTkSuQmCC) right repeat-y +} From 6f6ec76f7b84f02789297128882d8b89475fcbb6 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:52:02 -0500 Subject: [PATCH 10/19] Create terminal.js Adding new theme "Terminal" --- lib/ace/theme/terminal.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/ace/theme/terminal.js diff --git a/lib/ace/theme/terminal.js b/lib/ace/theme/terminal.js new file mode 100644 index 00000000..d7ff36ae --- /dev/null +++ b/lib/ace/theme/terminal.js @@ -0,0 +1,39 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * 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. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +exports.isDark = true; +exports.cssClass = "ace-terminal-theme"; +exports.cssText = require("../requirejs/text!./terminal.css"); + +var dom = require("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); +}); From 6e62f2f0a5cc9b02a36f493bb64a12b9f722d7a5 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:57:39 -0500 Subject: [PATCH 11/19] Update scrollable-page.html added terminal theme to "dark" --- demo/scrollable-page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/scrollable-page.html b/demo/scrollable-page.html index dfc48eba..6745eda2 100644 --- a/demo/scrollable-page.html +++ b/demo/scrollable-page.html @@ -143,7 +143,7 @@ var themes = { bright: [ "chrome", "clouds", "crimson_editor", "dawn", "dreamweaver", "eclipse", "github", "solarized_light", "textmate", "tomorrow"], dark: [ "clouds_midnight", "cobalt", "idle_fingers", "kr_theme", "merbivore", "merbivore_soft", - "mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "tomorrow_night", + "mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "terminal", "tomorrow_night", "tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties", "twilight", "vibrant_ink"] } themes = [].concat(themes.bright, themes.dark); From b059930cbae9a9a17cafc81e3acaeba7ca5ef104 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 20:59:36 -0500 Subject: [PATCH 12/19] Update perf-test.html Adding Terminal theme support --- tool/perf-test.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tool/perf-test.html b/tool/perf-test.html index fa5de999..451c1b8a 100644 --- a/tool/perf-test.html +++ b/tool/perf-test.html @@ -90,11 +90,12 @@ - + + From 7809bff1198c0c35e881fd3b3a173d8d0b000a96 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 21:00:17 -0500 Subject: [PATCH 13/19] Update mode_creator.js Adding "Terminal" theme support --- tool/mode_creator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/mode_creator.js b/tool/mode_creator.js index 82c0d5b6..cb633a8b 100644 --- a/tool/mode_creator.js +++ b/tool/mode_creator.js @@ -107,7 +107,7 @@ util.fillDropdown("themeEl", { "chrome", "clouds", "crimson_editor", "dawn", "dreamweaver", "eclipse", "github", "solarized_light", "textmate", "tomorrow", "xcode"], dark: [ "clouds_midnight", "cobalt", "idle_fingers", "kr_theme", "merbivore", "merbivore_soft", - "mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "tomorrow_night", + "mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "terminal", "tomorrow_night", "tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties", "twilight", "vibrant_ink"] }); From 9e3f1e663d0ff2bb432b54b9ba7ae7157fe1fab9 Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 21:01:02 -0500 Subject: [PATCH 14/19] Update tmtheme.js Adding "Terminal" theme support --- tool/tmtheme.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tool/tmtheme.js b/tool/tmtheme.js index ab40d4a5..0040da3e 100755 --- a/tool/tmtheme.js +++ b/tool/tmtheme.js @@ -248,6 +248,7 @@ var themes = { "solarized_dark": "Solarized-dark", "solarized_light": "Solarized-light", //"textmate": "Textmate (Mac Classic)", + "terminal": "Terminal" "tomorrow": "Tomorrow", "tomorrow_night": "Tomorrow-Night", "tomorrow_night_blue": "Tomorrow-Night-Blue", @@ -368,4 +369,4 @@ var rule = "."+ace.renderer.$theme +" .ace_indent-guide {\n\ console.log(rule) require("ace/lib/dom").importCssString(rule) -*/ \ No newline at end of file +*/ From 7099a2604cc236801b3700d57be3c5877329b8df Mon Sep 17 00:00:00 2001 From: h3rb Date: Fri, 1 Mar 2013 21:22:03 -0500 Subject: [PATCH 15/19] Added support to terminal theme for bad/start brace --- lib/ace/theme/terminal.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index 911ef755..4e740858 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -39,6 +39,16 @@ } .ace-terminal-theme .ace_marker-layer .ace_bracket { + margin: -1px 0 0 -1px; + border: 1px solid #0F0 +} + +.ace-terminal-theme .ace_marker-layer .ace_bracket_start { + margin: -1px 0 0 -1px; + border: 1px solid #0F0 +} + +.ace-terminal-theme .ace_marker-layer .ace_bracket_bad { margin: -1px 0 0 -1px; border: 1px solid #F00 } From 00c5b8cecc7a8890c437535163be5707fe9dfc82 Mon Sep 17 00:00:00 2001 From: h3rb Date: Mon, 4 Mar 2013 09:46:23 -0500 Subject: [PATCH 16/19] Refinement Includes proper MUSH substitution/register highlighting --- lib/ace/mode/mushcode_high_rules.js | 74 +++++++++++------------------ 1 file changed, 27 insertions(+), 47 deletions(-) diff --git a/lib/ace/mode/mushcode_high_rules.js b/lib/ace/mode/mushcode_high_rules.js index 6b05f5c3..e2ad064c 100644 --- a/lib/ace/mode/mushcode_high_rules.js +++ b/lib/ace/mode/mushcode_high_rules.js @@ -10,6 +10,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MushCodeRules = function() { + var keywords = ( "@if|"+ "@ifelse|"+ @@ -22,6 +23,9 @@ var MushCodeRules = function() { "@touch|"+ "@ataste|"+ "@osound|"+ + "@ahear|"+ + "@aahear|"+ + "@amhear|"+ "@otouch|"+ "@otaste|"+ "@drop|"+ @@ -285,6 +289,7 @@ var MushCodeRules = function() { "encrypt|"+ "escape|"+ "if|"+ + "ifelse|"+ "lcstr|"+ "left|"+ "lit|"+ @@ -398,7 +403,7 @@ var MushCodeRules = function() { "@@|"+ "bakerdays|"+ "bodybuild|"+ - "box|"+ + "box|"+ "capall|"+ "catalog|"+ "children|"+ @@ -485,14 +490,11 @@ var MushCodeRules = function() { "piechartlabel|"+ "createmaze|"+ "drawmaze|"+ - "drawwireframe" - ); - - //var futureReserved = ""; + "drawwireframe" + ); var keywordMapper = this.createKeywordMapper({ "invalid.deprecated": "debugger", "support.function": builtinFunctions, - //"invalid.illegal": futureReserved, "constant.language": builtinConstants, "keyword": keywords }, "identifier"); @@ -513,30 +515,24 @@ var MushCodeRules = function() { var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; this.$rules = { - "start" : [ { - token : "comment", - regex : ";.*$" - }, { - token : "string", // """ string - regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}' - }, { - token : "string", // multi line """ string start - regex : strPre + '"{3}.*$', - next : "qqstring" - }, { - token : "string", // " string - regex : strPre + '"(?:[^\\\\]|\\\\.)*?"' - }, { - token : "string", // ''' string - regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}" - }, { - token : "string", // multi line ''' string start - regex : strPre + "'{3}.*$", - next : "qstring" - }, { - token : "string", // ' string - regex : strPre + "'(?:[^\\\\]|\\\\.)*?'" - }, { + "start" : [ + { + token : "variable", // mush substitution register + regex : "%[0-9]{1}" + }, + { + token : "variable", // mush substitution register + regex : "%q[0-9A-Za-z]{1}" + }, + { + token : "variable", // mush special character register + regex : "%[a-zA-Z]{1}" + }, + { + token: "variable.language", + regex: "%[a-z0-9-_]+" + }, + { token : "constant.numeric", // imaginary regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { @@ -553,7 +549,7 @@ var MushCodeRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" + regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token : "paren.lparen", regex : "[\\[\\(\\{]" @@ -564,22 +560,6 @@ var MushCodeRules = function() { token : "text", regex : "\\s+" } ], - "qqstring" : [ { - token : "string", // multi line """ string end - regex : '(?:[^\\\\]|\\\\.)*?"{3}', - next : "start" - }, { - token : "string", - regex : '.+' - } ], - "qstring" : [ { - token : "string", // multi line ''' string end - regex : "(?:[^\\\\]|\\\\.)*?'{3}", - next : "start" - }, { - token : "string", - regex : '.+' - } ] }; }; From f7a542a86c56d725d4984266982c218278e9c1b2 Mon Sep 17 00:00:00 2001 From: h3rb Date: Mon, 4 Mar 2013 09:48:56 -0500 Subject: [PATCH 17/19] Naming / color updates to bracket-related css --- lib/ace/theme/terminal.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index 4e740858..b9f80237 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -40,17 +40,17 @@ .ace-terminal-theme .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; - border: 1px solid #0F0 + background: #090; } -.ace-terminal-theme .ace_marker-layer .ace_bracket_start { +.ace-terminal-theme .ace_marker-layer .ace_bracket-start { margin: -1px 0 0 -1px; - border: 1px solid #0F0 + background: #090; } -.ace-terminal-theme .ace_marker-layer .ace_bracket_bad { +.ace-terminal-theme .ace_marker-layer .ace_bracket-bad { margin: -1px 0 0 -1px; - border: 1px solid #F00 + border: 1px solid #900 } .ace-terminal-theme .ace_marker-layer .ace_active-line { From bac45dd0bb050226930391dd5e452031671da330 Mon Sep 17 00:00:00 2001 From: h3rb Date: Mon, 4 Mar 2013 10:03:13 -0500 Subject: [PATCH 18/19] Fixed misnomer ace_bracket-bad -> ace_bracket-unmatched --- kitchen-sink.html | 3 ++- lib/ace/theme/terminal.css | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kitchen-sink.html b/kitchen-sink.html index 33bc19a7..614ec7be 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -89,11 +89,12 @@ - + + diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index b9f80237..95e47fad 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -48,7 +48,7 @@ background: #090; } -.ace-terminal-theme .ace_marker-layer .ace_bracket-bad { +.ace-terminal-theme .ace_marker-layer .ace_bracket-unmatched { margin: -1px 0 0 -1px; border: 1px solid #900 } From 311e708da3274a6b4c01032bbef1773d2d5a8c28 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 23 Mar 2013 15:48:56 +0400 Subject: [PATCH 19/19] remove unneeded margin for brackets in terminal.css --- lib/ace/theme/terminal.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index 95e47fad..a2d3a415 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -39,12 +39,10 @@ } .ace-terminal-theme .ace_marker-layer .ace_bracket { - margin: -1px 0 0 -1px; background: #090; } .ace-terminal-theme .ace_marker-layer .ace_bracket-start { - margin: -1px 0 0 -1px; background: #090; }