diff --git a/ep_syntaxhighlighting/static/js/shBrushBash.js b/ep_syntaxhighlighting/static/js/shBrushBash.js new file mode 100644 index 0000000..775a23e --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushBash.js @@ -0,0 +1,97 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + function hereDocProcess(match, regexInfo) { + var result = []; + + if (match.here_doc != null) + result.push(new Match(match.here_doc, match.index + match[0].indexOf(match.here_doc), 'string')); + + if (match.full_tag != null) + result.push(new Match(match.full_tag, match.index, 'preprocessor')); + + if (match.end_tag != null) + result.push(new Match(match.end_tag, match.index + match[0].lastIndexOf(match.end_tag), 'preprocessor')); + + return result; + } + + var keywords = 'if fi then elif else for do done until while break continue case esac function return in eq ne ge le'; + var commands = 'alias apropos awk basename base64 bash bc bg builtin bunzip2 bzcat bzip2 bzip2recover cal cat cd cfdisk chgrp chmod chown chroot' + + 'cksum clear cmp comm command cp cron crontab crypt csplit cut date dc dd ddrescue declare df ' + + 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + + 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + + 'free fsck ftp gawk gcc gdb getconf getopts grep groups gunzip gzcat gzip hash head history hostname id ifconfig ' + + 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + + 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + + 'mv nasm nc ndisasm netstat nice nl nohup nslookup objdump od open op passwd paste pathchk ping popd pr printcap ' + + 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + + 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + + 'sleep sort source split ssh strace strings su sudo sum symlink sync tail tar tee test time ' + + 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + + 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + + 'vi watch wc whereis which who whoami Wget xargs xxd yes chsh zcat'; + + this.regexList = [ + { + regex: /^#!.*$/gm, + css: 'preprocessor bold' + }, + { + regex: /\/[\w-\/]+/gm, + css: 'plain' + }, + { + regex: SyntaxHighlighter.regexLib.singleLinePerlComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.doubleQuotedString, + css: 'string' + }, + { + regex: SyntaxHighlighter.regexLib.singleQuotedString, + css: 'string' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gm'), + css: 'keyword' + }, + { + regex: new RegExp(this.getKeywords(commands), 'gm'), + css: 'functions' + }, + { + regex: new XRegExp("(?(<|<){2}(?\\w+)) .*$(?[\\s\\S]*)(?^\\k$)", 'gm'), + func: hereDocProcess + } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['bash', 'shell', 'sh']; + + SyntaxHighlighter.brushes.Bash = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushDelphi.js b/ep_syntaxhighlighting/static/js/shBrushDelphi.js new file mode 100644 index 0000000..9da9383 --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushDelphi.js @@ -0,0 +1,78 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + + 'case char class comp const constructor currency destructor div do double ' + + 'downto else end except exports extended false file finalization finally ' + + 'for function goto if implementation in inherited int64 initialization ' + + 'integer interface is label library longint longword mod nil not object ' + + 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + + 'pint64 pointer private procedure program property pshortstring pstring ' + + 'pvariant pwidechar pwidestring protected public published raise real real48 ' + + 'record repeat set shl shortint shortstring shr single smallint string then ' + + 'threadvar to true try type unit until uses val var varirnt while widechar ' + + 'widestring with word write writeln xor'; + + this.regexList = [ + { + regex: /\(\*[\s\S]*?\*\)/gm, + css: 'comments' + }, + { + regex: /{(?!\$)[\s\S]*?}/gm, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.singleLineCComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.singleQuotedString, + css: 'string' + }, + { + regex: /\{\$[a-zA-Z]+ .+\}/g, + css: 'color1' + }, + { + regex: /\b[\d\.]+\b/g, + css: 'value' + }, + { + regex: /\$[a-zA-Z0-9]+\b/g, + css: 'value' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gmi'), + css: 'keyword' + } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['delphi', 'pascal', 'pas']; + + SyntaxHighlighter.brushes.Delphi = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushDiff.js b/ep_syntaxhighlighting/static/js/shBrushDiff.js new file mode 100644 index 0000000..1d36b36 --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushDiff.js @@ -0,0 +1,58 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + this.regexList = [ + { + regex: /^\+\+\+ .*$/gm, + css: 'color2' + }, + { + regex: /^\-\-\- .*$/gm, + css: 'color2' + }, + { + regex: /^\s.*$/gm, + css: 'color1' + }, + { + regex: /^@@.*@@.*$/gm, + css: 'variable' + }, + { + regex: /^\+.*$/gm, + css: 'string' + }, + { + regex: /^\-.*$/gm, + css: 'color3' + } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['diff', 'patch']; + + SyntaxHighlighter.brushes.Diff = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushErlang.js b/ep_syntaxhighlighting/static/js/shBrushErlang.js new file mode 100644 index 0000000..e37a138 --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushErlang.js @@ -0,0 +1,72 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + // Contributed by Jean-Lou Dupont + // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html + + // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 + var keywords = 'after and andalso band begin bnot bor bsl bsr bxor ' + + 'case catch cond div end fun if let not of or orelse ' + + 'query receive rem try when xor' + + // additional + ' module export import define'; + + this.regexList = [ + { + regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), + css: 'constants' + }, + { + regex: new RegExp("\\%.+", 'gm'), + css: 'comments' + }, + { + regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), + css: 'preprocessor' + }, + { + regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), + css: 'functions' + }, + { + regex: SyntaxHighlighter.regexLib.doubleQuotedString, + css: 'string' + }, + { + regex: SyntaxHighlighter.regexLib.singleQuotedString, + css: 'string' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gm'), + css: 'keyword' + } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['erlang', 'erl']; + + SyntaxHighlighter.brushes.Erlang = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushGroovy.js b/ep_syntaxhighlighting/static/js/shBrushGroovy.js new file mode 100644 index 0000000..e1699f5 --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushGroovy.js @@ -0,0 +1,96 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + // Contributed by Andres Almiray + // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter + + var keywords = 'as assert break case catch class continue def default do else extends finally ' + + 'if in implements import instanceof interface new package property return switch ' + + 'throw throws try while public protected private static'; + var types = 'void boolean byte char short int long float double'; + var constants = 'null'; + var methods = 'allProperties count get size ' + + 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + + 'findIndexOf grep inject max min reverseEach sort ' + + 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + + 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + + 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + + 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + + 'transformChar transformLine withOutputStream withPrintWriter withStream ' + + 'withStreams withWriter withWriterAppend write writeLine ' + + 'dump inspect invokeMethod print println step times upto use waitForOrKill ' + + 'getText'; + + this.regexList = [ + { + regex: SyntaxHighlighter.regexLib.singleLineCComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.multiLineCComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.doubleQuotedString, + css: 'string' + }, + { + regex: SyntaxHighlighter.regexLib.singleQuotedString, + css: 'string' + }, + { + regex: /""".*"""/g, + css: 'string' + }, + { + regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), + css: 'value' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gm'), + css: 'keyword' + }, + { + regex: new RegExp(this.getKeywords(types), 'gm'), + css: 'color1' + }, + { + regex: new RegExp(this.getKeywords(constants), 'gm'), + css: 'constants' + }, + { + regex: new RegExp(this.getKeywords(methods), 'gm'), + css: 'functions' + } + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['groovy']; + + SyntaxHighlighter.brushes.Groovy = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushHaxe.js b/ep_syntaxhighlighting/static/js/shBrushHaxe.js new file mode 100644 index 0000000..996f8da --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushHaxe.js @@ -0,0 +1,111 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + var inits = 'class interface package macro enum typedef extends implements dynamic in for if while else do try switch case catch'; + + var keywords = 'return break continue new throw cast using import function public private inline static untyped callback true false null Int Float String Void Std Bool Dynamic Array Vector'; + + this.regexList = [ + { + regex: SyntaxHighlighter.regexLib.singleLineCComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.multiLineCComments, + css: 'comments' + }, + { + regex: SyntaxHighlighter.regexLib.doubleQuotedString, + css: 'string' + }, + { + regex: SyntaxHighlighter.regexLib.singleQuotedString, + css: 'string' + }, + { + regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, + css: 'value' + }, + { + regex: new RegExp(this.getKeywords(inits), 'gm'), + css: 'color3' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gm'), + css: 'keyword' + }, + { + regex: new RegExp('var', 'gm'), + css: 'variable' + }, + { + regex: new RegExp('trace', 'gm'), + css: 'color1' + }, + { + regex: new RegExp('#if', 'gm'), + css: 'comments' + }, + { + regex: new RegExp('#elseif', 'gm'), + css: 'comments' + }, + { + regex: new RegExp('#end', 'gm'), + css: 'comments' + }, + { + regex: new RegExp('#error', 'gm'), + css: 'comments' + } + ]; + + //standard compiler conditionals flags + var flags = [ + "debug", "error", "cpp", "js", "neko", "php", "flash", "flash8", "flash9", "flash10", "flash10", "mobile", "desktop", "web", "ios", "android", "iphone" + ]; + + //append the flags to the array with a ! operator + var i; + var length = flags.length; + for (i = 0; i <= length - 1; i++) { + this.regexList.push({ + regex: new RegExp(flags[i], 'gm'), + css: 'comments' + }); + this.regexList.push({ + regex: new RegExp('!' + flags[i], 'gm'), + css: 'comments' + }); + } + + this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['haxe', 'hx']; + + SyntaxHighlighter.brushes.Haxe = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushPowerSh.js b/ep_syntaxhighlighting/static/js/shBrushPowerSh.js new file mode 100644 index 0000000..9942a3d --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushPowerSh.js @@ -0,0 +1,113 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { // Contributed by Joel 'Jaykul' Bennett, http://PoshCode.org | http://HuddledMasses.org + var keywords = 'while validateset validaterange validatepattern validatelength validatecount ' + + 'until trap switch return ref process param parameter in if global: ' + + 'function foreach for finally filter end elseif else dynamicparam do default ' + + 'continue cmdletbinding break begin alias \\? % #script #private #local #global ' + + 'mandatory parametersetname position valuefrompipeline ' + + 'valuefrompipelinebypropertyname valuefromremainingarguments helpmessage '; + + var operators = ' and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle ' + + 'clike clt cmatch cne cnotcontains cnotlike cnotmatch contains ' + + 'creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt ' + + 'imatch ine inotcontains inotlike inotmatch ireplace is isnot le like ' + + 'lt match ne not notcontains notlike notmatch or regex replace wildcard'; + + var verbs = 'write where wait use update unregister undo trace test tee take suspend ' + + 'stop start split sort skip show set send select scroll resume restore ' + + 'restart resolve resize reset rename remove register receive read push ' + + 'pop ping out new move measure limit join invoke import group get format ' + + 'foreach export expand exit enter enable disconnect disable debug cxnew ' + + 'copy convertto convertfrom convert connect complete compare clear ' + + 'checkpoint aggregate add'; + + // I can't find a way to match the comment based help in multi-line comments, because SH won't highlight in highlights, and javascript doesn't support lookbehind + var commenthelp = ' component description example externalhelp forwardhelpcategory forwardhelptargetname forwardhelptargetname functionality inputs link notes outputs parameter remotehelprunspace role synopsis'; + + this.regexList = [ + { + regex: new RegExp('^\\s*#[#\\s]*\\.(' + this.getKeywords(commenthelp) + ').*$', 'gim'), + css: 'preprocessor help bold' + }, + { + regex: SyntaxHighlighter.regexLib.singleLinePerlComments, + css: 'comments' + }, + { + regex: /(<|<)#[\s\S]*?#(>|>)/gm, + css: 'comments here' + }, + + { + regex: new RegExp('@"\\n[\\s\\S]*?\\n"@', 'gm'), + css: 'script string here' + }, + { + regex: new RegExp("@'\\n[\\s\\S]*?\\n'@", 'gm'), + css: 'script string single here' + }, + { + regex: new RegExp('"(?:\\$\\([^\\)]*\\)|[^"]|`"|"")*[^`]"', 'g'), + css: 'string' + }, + { + regex: new RegExp("'(?:[^']|'')*'", 'g'), + css: 'string single' + }, + + { + regex: new RegExp('[\\$|@|@@](?:(?:global|script|private|env):)?[A-Z0-9_]+', 'gi'), + css: 'variable' + }, + { + regex: new RegExp('(?:\\b' + verbs.replace(/ /g, '\\b|\\b') + ')-[a-zA-Z_][a-zA-Z0-9_]*', 'gmi'), + css: 'functions' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gmi'), + css: 'keyword' + }, + { + regex: new RegExp('-' + this.getKeywords(operators), 'gmi'), + css: 'operator value' + }, + { + regex: new RegExp('\\[[A-Z_\\[][A-Z0-9_. `,\\[\\]]*\\]', 'gi'), + css: 'constants' + }, + { + regex: new RegExp('\\s+-(?!' + this.getKeywords(operators) + ')[a-zA-Z_][a-zA-Z0-9_]*', 'gmi'), + css: 'color1' + }, + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['powershell', 'ps', 'posh']; + + SyntaxHighlighter.brushes.PowerSh = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/static/js/shBrushSwift.js b/ep_syntaxhighlighting/static/js/shBrushSwift.js new file mode 100644 index 0000000..1f7d924 --- /dev/null +++ b/ep_syntaxhighlighting/static/js/shBrushSwift.js @@ -0,0 +1,165 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 4.0.0 (February 7 2016) + * + * @copyright + * Copyright (C) 2004-2016 Alex Gorbatchev. + * + * @license + * MIT license. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() { + // Swift brush contributed by Nate Cook + // http://natecook.com/code/swift-syntax-highlighting + + function getKeywordsPrependedBy(keywords, by) { + return '(?:' + keywords.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|' + by + '\\b').replace(/^/, by + '\\b') + ')\\b'; + } + + function multiLineCCommentsAdd(match, regexInfo) { + var str = match[0], + result = [], + pos = 0, + matchStart = 0, + level = 0; + + while (pos < str.length - 1) { + var chunk = str.substr(pos, 2); + if (level == 0) { + if (chunk == "/*") { + matchStart = pos; + level++; + pos += 2; + } else { + pos++; + } + } else { + if (chunk == "/*") { + level++; + pos += 2; + } else if (chunk == "*/") { + level--; + if (level == 0) { + result.push(new Match(str.substring(matchStart, pos + 2), matchStart + match.index, regexInfo.css)); + } + pos += 2; + } else { + pos++; + } + } + } + + return result; + } + + function stringAdd(match, regexInfo) { + var str = match[0], + result = [], + pos = 0, + matchStart = 0, + level = 0; + + while (pos < str.length - 1) { + if (level == 0) { + if (str.substr(pos, 2) == "\\(") { + result.push(new Match(str.substring(matchStart, pos + 2), matchStart + match.index, regexInfo.css)); + level++; + pos += 2; + } else { + pos++; + } + } else { + if (str[pos] == "(") { + level++; + } + if (str[pos] == ")") { + level--; + if (level == 0) { + matchStart = pos; + } + } + pos++; + } + } + if (level == 0) { + result.push(new Match(str.substring(matchStart, str.length), matchStart + match.index, regexInfo.css)); + } + + return result; + }; + + // "Swift-native types" are all the protocols, classes, structs, enums, funcs, vars, and typealiases built into the language + var swiftTypes = 'AbsoluteValuable Any AnyClass Array ArrayBound ArrayBuffer ArrayBufferType ArrayLiteralConvertible ArrayType AutoreleasingUnsafePointer BidirectionalIndex Bit BitwiseOperations Bool C CBool CChar CChar16 CChar32 CConstPointer CConstVoidPointer CDouble CFloat CInt CLong CLongLong CMutablePointer CMutableVoidPointer COpaquePointer CShort CSignedChar CString CUnsignedChar CUnsignedInt CUnsignedLong CUnsignedLongLong CUnsignedShort CVaListPointer CVarArg CWideChar Character CharacterLiteralConvertible Collection CollectionOfOne Comparable ContiguousArray ContiguousArrayBuffer DebugPrintable Dictionary DictionaryGenerator DictionaryIndex DictionaryLiteralConvertible Double EmptyCollection EmptyGenerator EnumerateGenerator Equatable ExtendedGraphemeClusterLiteralConvertible ExtendedGraphemeClusterType ExtensibleCollection FilterCollectionView FilterCollectionViewIndex FilterGenerator FilterSequenceView Float Float32 Float64 Float80 FloatLiteralConvertible FloatLiteralType FloatingPointClassification FloatingPointNumber ForwardIndex Generator GeneratorOf GeneratorOfOne GeneratorSequence Hashable HeapBuffer HeapBufferStorage HeapBufferStorageBase ImplicitlyUnwrappedOptional IndexingGenerator Int Int16 Int32 Int64 Int8 IntEncoder IntMax Integer IntegerArithmetic IntegerLiteralConvertible IntegerLiteralType Less LifetimeManager LogicValue MapCollectionView MapSequenceGenerator MapSequenceView MaxBuiltinFloatType MaxBuiltinIntegerType Mirror MirrorDisposition MutableCollection MutableSliceable ObjectIdentifier OnHeap Optional OutputStream PermutationGenerator Printable QuickLookObject RandomAccessIndex Range RangeGenerator RawByte RawOptionSet RawRepresentable Reflectable Repeat ReverseIndex ReverseRange ReverseRangeGenerator ReverseView Sequence SequenceOf SignedInteger SignedNumber Sink SinkOf Slice SliceBuffer Sliceable StaticString Streamable StridedRangeGenerator String StringElement StringInterpolationConvertible StringLiteralConvertible StringLiteralType UInt UInt16 UInt32 UInt64 UInt8 UIntMax UTF16 UTF32 UTF8 UWord UnicodeCodec UnicodeScalar Unmanaged UnsafeArray UnsafePointer UnsignedInteger Void Word Zip2 ZipGenerator2 abs advance alignof alignofValue assert bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal false filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced join lexicographicalCompare map max maxElement min minElement nil numericCast partition posix print println quickSort reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith strideof strideofValue swap swift toString transcode true underestimateCount unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafePointers withVaList'; + + var keywords = 'as break case class continue default deinit do dynamicType else enum ' + + 'extension fallthrough for func if import in init is let new protocol ' + + 'return self Self static struct subscript super switch Type typealias ' + + 'var where while __COLUMN__ __FILE__ __FUNCTION__ __LINE__ associativity ' + + 'didSet get infix inout left mutating none nonmutating operator override ' + + 'postfix precedence prefix right set unowned unowned(safe) unowned(unsafe) weak willSet'; + + var attributes = 'assignment class_protocol exported final lazy noreturn NSCopying NSManaged objc optional required auto_closure noreturn IBAction IBDesignable IBInspectable IBOutlet infix prefix postfix'; + + + this.regexList = [ + // html entities + { + regex: new RegExp('\&[a-z]+;', 'gi'), + css: 'plain' + }, + { + regex: SyntaxHighlighter.regexLib.singleLineCComments, + css: 'comments' + }, + { + regex: new RegExp('\\/\\*[\\s\\S]*\\*\\/', 'g'), + css: 'comments', + func: multiLineCCommentsAdd + }, + { + regex: SyntaxHighlighter.regexLib.doubleQuotedString, + css: 'string', + func: stringAdd + }, + { + regex: new RegExp('\\b([\\d_]+(\\.[\\de_]+)?|0x[a-f0-9_]+(\\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b', 'gi'), + css: 'value' + }, + { + regex: new RegExp(this.getKeywords(keywords), 'gm'), + css: 'keyword' + }, + { + regex: new RegExp(getKeywordsPrependedBy(attributes, '@'), 'gm'), + css: 'color1' + }, + { + regex: new RegExp(this.getKeywords(swiftTypes), 'gm'), + css: 'color2' + }, + { + regex: new RegExp('\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b', 'gi'), + css: 'variable' + }, + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['swift']; + + SyntaxHighlighter.brushes.Swift = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/ep_syntaxhighlighting/templates/syntaxHighlightingEditbarButtons.ejs b/ep_syntaxhighlighting/templates/syntaxHighlightingEditbarButtons.ejs index 2b8d790..f4f6cca 100644 --- a/ep_syntaxhighlighting/templates/syntaxHighlightingEditbarButtons.ejs +++ b/ep_syntaxhighlighting/templates/syntaxHighlightingEditbarButtons.ejs @@ -15,6 +15,14 @@ + + + + + + + + -
  • \ No newline at end of file +
  • diff --git a/ep_syntaxhighlighting/templates/syntaxHighlightingScripts.ejs b/ep_syntaxhighlighting/templates/syntaxHighlightingScripts.ejs index 468ffdb..a534d70 100644 --- a/ep_syntaxhighlighting/templates/syntaxHighlightingScripts.ejs +++ b/ep_syntaxhighlighting/templates/syntaxHighlightingScripts.ejs @@ -19,4 +19,12 @@ - \ No newline at end of file + + + + + + + + +