highlight.js-7.4/0000755000175000017500000000000012234266276013336 5ustar boutilboutilhighlight.js-7.4/README.ru.md0000644000175000017500000001673712234266276015260 0ustar boutilboutil# Highlight.js Highlight.js нужен для подсветки синтаксиса в примерах кода в блогах, форумах и вообще на любых веб-страницах. Пользоваться им очень просто, потому что работает он автоматически: сам находит блоки кода, сам определяет язык, сам подсвечивает. Автоопределением языка можно управлять, когда оно не справляется само (см. дальше "Эвристика"). ## Простое использование Подключите библиотеку и стиль на страницу и повесть вызов подсветки на загрузку страницы: ```html ``` Весь код на странице, обрамлённый в теги `
 .. 
` будет автоматически подсвечен. Если вы используете другие теги или хотите подсвечивать блоки кода динамически, читайте "Инициализацию вручную" ниже. - Вы можете скачать собственную версию "highlight.pack.js" или сослаться на захостенный файл, как описано на странице загрузки: - Стилевые темы можно найти в загруженном архиве или также использовать захостенные. Чтобы сделать собственный стиль для своего сайта, вам будет полезен справочник классов в файле [classref.txt][cr], который тоже есть в архиве. [cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt ## node.js Highlight.js можно использовать в node.js. Библиотеку со всеми возможными языками можно установить с NPM: npm install highlight.js Также её можно собрать из исходников с только теми языками, которые нужны: python3 tools/build.py -tnode lang1 lang2 .. Использование библиотеки: ```javascript var hljs = require('highlight.js'); // Если вы знаете язык hljs.highlight(lang, code).value; // Автоопределение языка hljs.highlightAuto(code).value; ``` ## AMD Highlight.js можно использовать с загрузчиком AMD-модулей. Для этого его нужно собрать из исходников следующей командой: ```bash $ python3 tools/build.py -tamd lang1 lang2 .. ``` Она создаст файл `build/highlight.pack.js`, который является загружаемым AMD-модулем и содержит все выбранные при сборке языки. Используется он так: ```javascript require(["highlight.js/build/highlight.pack"], function(hljs){ // Если вы знаете язык hljs.highlight(lang, code).value; // Автоопределение языка hljs.highlightAuto(code).value; }); ``` ## Замена TABов Также вы можете заменить символы TAB ('\x09'), используемые для отступов, на фиксированное количество пробелов или на отдельный ``, чтобы задать ему какой-нибудь специальный стиль: ```html ``` ## Инициализация вручную Если вы используете другие теги для блоков кода, вы можете инициализировать их явно с помощью функции `highlightBlock(code, tabReplace, useBR)`. Она принимает DOM-элемент с текстом расцвечиваемого кода и опционально - строчку для замены символов TAB. Например с использованием jQuery код инициализации может выглядеть так: ```javascript $(document).ready(function() { $('pre code').each(function(i, e) {hljs.highlightBlock(e)}); }); ``` `highlightBlock` можно также использовать, чтобы подсветить блоки кода, добавленные на страницу динамически. Только убедитесь, что вы не делаете этого повторно для уже раскрашенных блоков. Если ваш блок кода использует `
` вместо переводов строки (т.е. если это не `
`), передайте `true` третьим параметром в `highlightBlock`:

```javascript
$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
```


## Эвристика

Определение языка, на котором написан фрагмент, делается с помощью
довольно простой эвристики: программа пытается расцветить фрагмент всеми
языками подряд, и для каждого языка считает количество подошедших
синтаксически конструкций и ключевых слов. Для какого языка нашлось больше,
тот и выбирается.

Это означает, что в коротких фрагментах высока вероятность ошибки, что
периодически и случается. Чтобы указать язык фрагмента явно, надо написать
его название в виде класса к элементу ``:

```html
...
``` Можно использовать рекомендованные в HTML5 названия классов: "language-html", "language-php". Также можно назначать классы на элемент `
`.

Чтобы запретить расцветку фрагмента вообще, используется класс "no-highlight":

```html
...
``` ## Экспорт В файле export.html находится небольшая программка, которая показывает и дает скопировать непосредственно HTML-код подсветки для любого заданного фрагмента кода. Это может понадобится например на сайте, на котором нельзя подключить сам скрипт highlight.js. ## Координаты - Версия: 7.4 - URL: http://highlightjs.org/ - Автор: Иван Сагалаев () Лицензионное соглашение читайте в файле LICENSE. Список соавторов читайте в файле AUTHORS.ru.txt highlight.js-7.4/tools/0000755000175000017500000000000012234266276014476 5ustar boutilboutilhighlight.js-7.4/tools/build.py0000644000175000017500000002666212234266276016163 0ustar boutilboutil# -*- coding:utf-8 -*- ''' Function for building whole packed version of highlight.js out of pre-packed modules. ''' import os import shutil import re import argparse import subprocess import json from functools import partial REPLACES = { 'case_insensitive': 'cI', 'lexems': 'l', 'contains': 'c', 'keywords': 'k', 'subLanguage': 'sL', 'className': 'cN', 'begin': 'b', 'beginWithKeyword': 'bWK', 'end': 'e', 'endsWithParent': 'eW', 'illegal': 'i', 'excludeBegin': 'eB', 'excludeEnd': 'eE', 'returnBegin': 'rB', 'returnEnd': 'rE', 'relevance': 'r', 'IDENT_RE': 'IR', 'UNDERSCORE_IDENT_RE': 'UIR', 'NUMBER_RE': 'NR', 'C_NUMBER_RE': 'CNR', 'BINARY_NUMBER_RE': 'BNR', 'RE_STARTERS_RE': 'RSR', 'APOS_STRING_MODE': 'ASM', 'QUOTE_STRING_MODE': 'QSM', 'BACKSLASH_ESCAPE': 'BE', 'C_LINE_COMMENT_MODE': 'CLCM', 'C_BLOCK_COMMENT_MODE': 'CBLCLM', 'HASH_COMMENT_MODE': 'HCM', 'C_NUMBER_MODE': 'CNM', 'BINARY_NUMBER_MODE': 'BNM', 'NUMBER_MODE': 'NM', 'beginRe': 'bR', 'endRe': 'eR', 'illegalRe': 'iR', 'lexemsRe': 'lR', 'terminators': 't', 'terminator_end': 'tE', } CATEGORIES = { 'common': ['bash', 'java', 'ini', 'sql', 'diff', 'php', 'cs', 'cpp', 'ruby', 'python', 'css', 'perl', 'xml', 'javascript', 'http', 'json'], } def lang_name(filename): return os.path.splitext(os.path.basename(filename))[0] def mapnonstrings(source, func): result = [] pos = 0 quotes = re.compile('[\'"/]') while pos < len(source): match = quotes.search(source, pos) end = match.start() if match else len(source) result.append(func(source[pos:end])) pos = end if match: terminator = re.compile(r'[%s\\]' % match.group(0)) start = pos pos += 1 while True: match = terminator.search(source, pos) if not match: raise ValueError('Unmatched quote') if match.group(0) == '\\': pos = match.start() + 2 else: pos = match.start() + 1 result.append(source[start:pos]) break return ''.join(result) def compress_content(tools_path, content, filetype='js'): if filetype == 'js': for s, r in REPLACES.items(): content = mapnonstrings(content, partial(re.sub, r'\b%s\b' % s, r)) content = re.sub(r'(block|parentNode)\.cN', r'\1.className', content) args = ['java', '-jar', os.path.join(tools_path, 'yuicompressor.jar'), '--type', filetype] p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.stdin.write(content.encode('utf-8')) p.stdin.close() content = p.stdout.read().decode('utf-8') p.stdout.close() return content def parse_header(filename): ''' Parses possible language description header from a file. If a header is found returns it as dict, otherwise returns None. ''' content = open(filename, encoding='utf-8').read(1024) match = re.search(r'^\s*/\*(.*?)\*/', content, re.S) if not match: return headers = match.group(1).split('\n') headers = dict(h.strip().split(': ') for h in headers if ': ' in h) return headers if 'Language' in headers else None def language_filenames(src_path, languages): ''' Resolves dependencies and returns the list of actual language filenames ''' lang_path = os.path.join(src_path, 'languages') filenames = [f for f in os.listdir(lang_path) if f.endswith('.js')] headers = [parse_header(os.path.join(lang_path, f)) for f in filenames] infos = [(h, f) for h, f in zip(headers, filenames) if h] # Filtering infos based on list of languages and categories if languages: categories = {l for l in languages if l.startswith(':')} languages = set(languages) - categories categories = {c.strip(':') for c in categories} cat_languages = {l for c, ls in CATEGORIES.items() if c in categories for l in ls} languages |= cat_languages infos = [ (i, f) for i, f in infos if lang_name(f) in languages ] def append(filename): if filename not in filenames: filenames.append(filename) filenames = [] for info, filename in infos: if 'Requires' in info: requires = [r.strip() for r in info['Requires'].split(',')] for r in requires: append(r) append(filename) return [os.path.join(lang_path, f) for f in filenames] def strip_read(filename): s = open(filename, encoding='utf-8').read() pattern = re.compile(r'^\s*(/\*(.*?)\*/)?\s*', re.DOTALL) s = pattern.sub('', s) return s.strip() def wrap_language(filename, content, compressed): ''' Wraps a language file content for the browser build. The "compressed" parameter selects which wrapping code to use: - If compressed is False the function expects source files to be uncompressed and wraps them maintaining readability of the source. - If compressed is True the function expects source files to be already compressed individually and wraps them with the minimal code, effectively emulating what yuicompressor does. ''' name = lang_name(filename) if compressed: name = ('["%s"]' if '-' in name or name[0].isdigit() else '.%s') % name content = content.rstrip(';') wrap = 'hljs.LANGUAGES%s=%s(hljs);' else: wrap = 'hljs.LANGUAGES[\'%s\'] = %s(hljs);\n' return wrap % (name, content) def glue_files(hljs_filename, language_filenames, compressed): ''' Glues files together for the browser build. ''' if compressed: hljs = 'var hljs=new %s();' % strip_read(hljs_filename).rstrip(';') file_func = lambda f: open(f, encoding='utf-8').read() else: hljs = 'var hljs = new %s();\n' % strip_read(hljs_filename) file_func = strip_read return ''.join([hljs] + [wrap_language(f, file_func(f), compressed) for f in language_filenames]) def build_browser(root, build_path, filenames, options): src_path = os.path.join(root, 'src') tools_path = os.path.join(root, 'tools') print('Building %d files:\n%s' % (len(filenames), '\n'.join(filenames))) content = glue_files(os.path.join(src_path, 'highlight.js'), filenames, False) print('Uncompressed size:', len(content.encode('utf-8'))) if options.compress: print('Compressing...') content = compress_content(tools_path, content) print('Compressed size:', len(content.encode('utf-8'))) open(os.path.join(build_path, 'highlight.pack.js'), 'w', encoding='utf-8').write(content) def build_amd(root, build_path, filenames, options): src_path = os.path.join(root, 'src') tools_path = os.path.join(root, 'tools') print('Building %d files:\n%s' % (len(filenames), '\n'.join(filenames))) content = glue_files(os.path.join(src_path, 'highlight.js'), filenames, False) content = 'define(function() {\n%s\nreturn hljs;\n});' % content # AMD wrap print('Uncompressed size:', len(content.encode('utf-8'))) if options.compress: print('Compressing...') content = compress_content(tools_path, content) print('Compressed size:', len(content.encode('utf-8'))) open(os.path.join(build_path, 'highlight.pack.js'), 'w', encoding='utf-8').write(content) def build_node(root, build_path, filenames, options): src_path = os.path.join(root, 'src') print('Building %d files:' % len(filenames)) for filename in filenames: print(filename) content = 'module.exports = %s;' % strip_read(filename) open(os.path.join(build_path, os.path.basename(filename)), 'w', encoding='utf-8').write(content) filename = os.path.join(src_path, 'highlight.js') print(filename) print('Registering languages with the library...') hljs = 'var hljs = new %s();' % strip_read(filename) filenames = map(os.path.basename, filenames) for filename in filenames: hljs += '\nhljs.LANGUAGES[\'%s\'] = require(\'./%s\')(hljs);' % (lang_name(filename), filename) hljs += '\nmodule.exports = hljs;' open(os.path.join(build_path, 'highlight.js'), 'w', encoding='utf-8').write(hljs) if options.compress: print('Notice: not compressing files for "node" target.') print('Adding package.json...') package = json.load(open(os.path.join(src_path, 'package.json'), encoding='utf-8')) authors = open(os.path.join(root, 'AUTHORS.en.txt'), encoding='utf-8') matches = (re.match('^- (?P.*) <(?P.*)>$', a) for a in authors) package['contributors'] = [m.groupdict() for m in matches if m] content = json.dumps(package, indent=2) open(os.path.join(build_path, 'package.json'), 'w', encoding='utf-8').write(content) def build_cdn(root, build_path, filenames, options): src_path = os.path.join(root, 'src') tools_path = os.path.join(root, 'tools') if not options.compress: print('Notice: forcing compression for "cdn" target') options.compress = True build_browser(root, build_path, filenames, options) os.rename(os.path.join(build_path, 'highlight.pack.js'), os.path.join(build_path, 'highlight.min.js')) print('Compressing all languages...') lang_path = os.path.join(build_path, 'languages') os.mkdir(lang_path) all_filenames = language_filenames(src_path, []) for filename in all_filenames: print(filename) content = compress_content(tools_path, strip_read(filename)) content = wrap_language(filename, content, True) open(os.path.join(lang_path, '%s.min.js' % lang_name(filename)), 'w', encoding='utf-8').write(content) print('Compressing styles...') build_style_path = os.path.join(build_path, 'styles') src_style_path = os.path.join(src_path, 'styles') os.mkdir(build_style_path) styles = [lang_name(f) for f in os.listdir(src_style_path) if f.endswith('.css')] for style in styles: filename = os.path.join(src_style_path, '%s.css' % style) print(filename) content = compress_content(tools_path, open(filename).read(), 'css') open(os.path.join(build_style_path, '%s.min.css' % style), 'w', encoding='utf-8').write(content) def build(buildfunc, root, args): build_path = os.path.join(root, 'build') if os.path.exists(build_path): shutil.rmtree(build_path) os.mkdir(build_path) filenames = language_filenames(os.path.join(root, 'src'), args.languages) buildfunc(root, build_path, filenames, args) print('Done.') if __name__ == '__main__': parser = argparse.ArgumentParser(description='Build highlight.js for various targets') parser.add_argument( 'languages', nargs='*', help = 'language (the name of a language file without the .js extension) or :category (currently the only available category is ":common")', ) parser.add_argument( '-n', '--no-compress', dest = 'compress', action = 'store_false', default = True, help = 'Don\'t compress source files. Compression only works for the "browser" target.', ) parser.add_argument( '-t', '--target', dest = 'target', choices = ['browser', 'node', 'cdn', 'amd'], default = 'browser', help = 'Target format, default is "browser"', ) args = parser.parse_args() buildfunc = locals()['build_%s' % args.target] root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) build(buildfunc, root, args) highlight.js-7.4/src/0000755000175000017500000000000012234266276014125 5ustar boutilboutilhighlight.js-7.4/src/highlight.js0000644000175000017500000004366312234266276016446 0ustar boutilboutil/* Syntax highlighting with language autodetection. http://highlightjs.org/ */ function() { /* Utility functions */ function escape(value) { return value.replace(/&/gm, '&').replace(//gm, '>'); } function findCode(pre) { for (var node = pre.firstChild; node; node = node.nextSibling) { if (node.nodeName == 'CODE') return node; if (!(node.nodeType == 3 && node.nodeValue.match(/\s+/))) break; } } function blockText(block, ignoreNewLines) { return Array.prototype.map.call(block.childNodes, function(node) { if (node.nodeType == 3) { return ignoreNewLines ? node.nodeValue.replace(/\n/g, '') : node.nodeValue; } if (node.nodeName == 'BR') { return '\n'; } return blockText(node, ignoreNewLines); }).join(''); } function blockLanguage(block) { var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/); classes = classes.map(function(c) {return c.replace(/^language-/, '')}); for (var i = 0; i < classes.length; i++) { if (languages[classes[i]] || classes[i] == 'no-highlight') { return classes[i]; } } } /* Stream merging */ function nodeStream(node) { var result = []; (function _nodeStream(node, offset) { for (var child = node.firstChild; child; child = child.nextSibling) { if (child.nodeType == 3) offset += child.nodeValue.length; else if (child.nodeName == 'BR') offset += 1; else if (child.nodeType == 1) { result.push({ event: 'start', offset: offset, node: child }); offset = _nodeStream(child, offset); result.push({ event: 'stop', offset: offset, node: child }); } } return offset; })(node, 0); return result; } function mergeStreams(stream1, stream2, value) { var processed = 0; var result = ''; var nodeStack = []; function selectStream() { if (stream1.length && stream2.length) { if (stream1[0].offset != stream2[0].offset) return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2; else { /* To avoid starting the stream just before it should stop the order is ensured that stream1 always starts first and closes last: if (event1 == 'start' && event2 == 'start') return stream1; if (event1 == 'start' && event2 == 'stop') return stream2; if (event1 == 'stop' && event2 == 'start') return stream1; if (event1 == 'stop' && event2 == 'stop') return stream2; ... which is collapsed to: */ return stream2[0].event == 'start' ? stream1 : stream2; } } else { return stream1.length ? stream1 : stream2; } } function open(node) { function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"'}; return '<' + node.nodeName + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; } while (stream1.length || stream2.length) { var current = selectStream().splice(0, 1)[0]; result += escape(value.substr(processed, current.offset - processed)); processed = current.offset; if ( current.event == 'start') { result += open(current.node); nodeStack.push(current.node); } else if (current.event == 'stop') { var node, i = nodeStack.length; do { i--; node = nodeStack[i]; result += (''); } while (node != current.node); nodeStack.splice(i, 1); while (i < nodeStack.length) { result += open(nodeStack[i]); i++; } } } return result + escape(value.substr(processed)); } /* Initialization */ function compileLanguage(language) { function reStr(re) { return (re && re.source) || re; } function langRe(value, global) { return RegExp( reStr(value), 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') ); } function compileMode(mode, parent) { if (mode.compiled) return; mode.compiled = true; var keywords = []; // used later with beginWithKeyword but filled as a side-effect of keywords compilation if (mode.keywords) { var compiled_keywords = {}; function flatten(className, str) { str.split(' ').forEach(function(kw) { var pair = kw.split('|'); compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; keywords.push(pair[0]); }); } mode.lexemsRe = langRe(mode.lexems || hljs.IDENT_RE + '(?!\\.)', true); if (typeof mode.keywords == 'string') { // string flatten('keyword', mode.keywords) } else { for (var className in mode.keywords) { if (!mode.keywords.hasOwnProperty(className)) continue; flatten(className, mode.keywords[className]); } } mode.keywords = compiled_keywords; } if (parent) { if (mode.beginWithKeyword) { mode.begin = '\\b(' + keywords.join('|') + ')\\b(?!\\.)\\s*'; } mode.beginRe = langRe(mode.begin ? mode.begin : '\\B|\\b'); if (!mode.end && !mode.endsWithParent) mode.end = '\\B|\\b'; if (mode.end) mode.endRe = langRe(mode.end); mode.terminator_end = reStr(mode.end) || ''; if (mode.endsWithParent && parent.terminator_end) mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; } if (mode.illegal) mode.illegalRe = langRe(mode.illegal); if (mode.relevance === undefined) mode.relevance = 1; if (!mode.contains) { mode.contains = []; } for (var i = 0; i < mode.contains.length; i++) { if (mode.contains[i] == 'self') { mode.contains[i] = mode; } compileMode(mode.contains[i], mode); } if (mode.starts) { compileMode(mode.starts, parent); } var terminators = []; for (var i = 0; i < mode.contains.length; i++) { terminators.push(reStr(mode.contains[i].begin)); } if (mode.terminator_end) { terminators.push(reStr(mode.terminator_end)); } if (mode.illegal) { terminators.push(reStr(mode.illegal)); } mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}}; } compileMode(language); } /* Core highlighting function. Accepts a language name and a string with the code to highlight. Returns an object with the following properties: - relevance (int) - keyword_count (int) - value (an HTML string with highlighting markup) */ function highlight(language_name, value, ignore_illegals) { function subMode(lexem, mode) { for (var i = 0; i < mode.contains.length; i++) { var match = mode.contains[i].beginRe.exec(lexem); if (match && match.index == 0) { return mode.contains[i]; } } } function endOfMode(mode, lexem) { if (mode.end && mode.endRe.test(lexem)) { return mode; } if (mode.endsWithParent) { return endOfMode(mode.parent, lexem); } } function isIllegal(lexem, mode) { return !ignore_illegals && mode.illegal && mode.illegalRe.test(lexem); } function keywordMatch(mode, match) { var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; } function processKeywords() { var buffer = escape(mode_buffer); if (!top.keywords) return buffer; var result = ''; var last_index = 0; top.lexemsRe.lastIndex = 0; var match = top.lexemsRe.exec(buffer); while (match) { result += buffer.substr(last_index, match.index - last_index); var keyword_match = keywordMatch(top, match); if (keyword_match) { keyword_count += keyword_match[1]; result += '' + match[0] + ''; } else { result += match[0]; } last_index = top.lexemsRe.lastIndex; match = top.lexemsRe.exec(buffer); } return result + buffer.substr(last_index); } function processSubLanguage() { if (top.subLanguage && !languages[top.subLanguage]) { return escape(mode_buffer); } var result = top.subLanguage ? highlight(top.subLanguage, mode_buffer) : highlightAuto(mode_buffer); // Counting embedded language score towards the host language may be disabled // with zeroing the containing mode relevance. Usecase in point is Markdown that // allows XML everywhere and makes every XML snippet to have a much larger Markdown // score. if (top.relevance > 0) { keyword_count += result.keyword_count; relevance += result.relevance; } return '' + result.value + ''; } function processBuffer() { return top.subLanguage !== undefined ? processSubLanguage() : processKeywords(); } function startNewMode(mode, lexem) { var markup = mode.className? '': ''; if (mode.returnBegin) { result += markup; mode_buffer = ''; } else if (mode.excludeBegin) { result += escape(lexem) + markup; mode_buffer = ''; } else { result += markup; mode_buffer = lexem; } top = Object.create(mode, {parent: {value: top}}); } function processLexem(buffer, lexem) { mode_buffer += buffer; if (lexem === undefined) { result += processBuffer(); return 0; } var new_mode = subMode(lexem, top); if (new_mode) { result += processBuffer(); startNewMode(new_mode, lexem); return new_mode.returnBegin ? 0 : lexem.length; } var end_mode = endOfMode(top, lexem); if (end_mode) { var origin = top; if (!(origin.returnEnd || origin.excludeEnd)) { mode_buffer += lexem; } result += processBuffer(); do { if (top.className) { result += ''; } relevance += top.relevance; top = top.parent; } while (top != end_mode.parent); if (origin.excludeEnd) { result += escape(lexem); } mode_buffer = ''; if (end_mode.starts) { startNewMode(end_mode.starts, ''); } return origin.returnEnd ? 0 : lexem.length; } if (isIllegal(lexem, top)) throw new Error('Illegal lexem "' + lexem + '" for mode "' + (top.className || '') + '"'); /* Parser should not reach this point as all types of lexems should be caught earlier, but if it does due to some bug make sure it advances at least one character forward to prevent infinite looping. */ mode_buffer += lexem; return lexem.length || 1; } var language = languages[language_name]; compileLanguage(language); var top = language; var mode_buffer = ''; var relevance = 0; var keyword_count = 0; var result = ''; try { var match, count, index = 0; while (true) { top.terminators.lastIndex = index; match = top.terminators.exec(value); if (!match) break; count = processLexem(value.substr(index, match.index - index), match[0]); index = match.index + count; } processLexem(value.substr(index)) return { relevance: relevance, keyword_count: keyword_count, value: result, language: language_name }; } catch (e) { if (e.message.indexOf('Illegal') != -1) { return { relevance: 0, keyword_count: 0, value: escape(value) }; } else { throw e; } } } /* Highlighting with language detection. Accepts a string with the code to highlight. Returns an object with the following properties: - language (detected language) - relevance (int) - keyword_count (int) - value (an HTML string with highlighting markup) - second_best (object with the same structure for second-best heuristically detected language, may be absent) */ function highlightAuto(text) { var result = { keyword_count: 0, relevance: 0, value: escape(text) }; var second_best = result; for (var key in languages) { if (!languages.hasOwnProperty(key)) continue; var current = highlight(key, text, false); current.language = key; if (current.keyword_count + current.relevance > second_best.keyword_count + second_best.relevance) { second_best = current; } if (current.keyword_count + current.relevance > result.keyword_count + result.relevance) { second_best = result; result = current; } } if (second_best.language) { result.second_best = second_best; } return result; } /* Post-processing of the highlighted markup: - replace TABs with something more useful - replace real line-breaks with '
' for non-pre containers */ function fixMarkup(value, tabReplace, useBR) { if (tabReplace) { value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) { return p1.replace(/\t/g, tabReplace); }); } if (useBR) { value = value.replace(/\n/g, '
'); } return value; } /* Applies highlighting to a DOM node containing code. Accepts a DOM node and two optional parameters for fixMarkup. */ function highlightBlock(block, tabReplace, useBR) { var text = blockText(block, useBR); var language = blockLanguage(block); if (language == 'no-highlight') return; var result = language ? highlight(language, text, true) : highlightAuto(text); language = result.language; var original = nodeStream(block); if (original.length) { var pre = document.createElement('pre'); pre.innerHTML = result.value; result.value = mergeStreams(original, nodeStream(pre), text); } result.value = fixMarkup(result.value, tabReplace, useBR); var class_name = block.className; if (!class_name.match('(\\s|^)(language-)?' + language + '(\\s|$)')) { class_name = class_name ? (class_name + ' ' + language) : language; } block.innerHTML = result.value; block.className = class_name; block.result = { language: language, kw: result.keyword_count, re: result.relevance }; if (result.second_best) { block.second_best = { language: result.second_best.language, kw: result.second_best.keyword_count, re: result.second_best.relevance }; } } /* Applies highlighting to all
..
blocks on a page. */ function initHighlighting() { if (initHighlighting.called) return; initHighlighting.called = true; Array.prototype.map.call(document.getElementsByTagName('pre'), findCode). filter(Boolean). forEach(function(code){highlightBlock(code, hljs.tabReplace)}); } /* Attaches highlighting to the page load event. */ function initHighlightingOnLoad() { window.addEventListener('DOMContentLoaded', initHighlighting, false); window.addEventListener('load', initHighlighting, false); } var languages = {}; // a shortcut to avoid writing "this." everywhere /* Interface definition */ this.LANGUAGES = languages; this.highlight = highlight; this.highlightAuto = highlightAuto; this.fixMarkup = fixMarkup; this.highlightBlock = highlightBlock; this.initHighlighting = initHighlighting; this.initHighlightingOnLoad = initHighlightingOnLoad; // Common regexps this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*'; this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*'; this.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; this.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; // Common modes this.BACKSLASH_ESCAPE = { begin: '\\\\[\\s\\S]', relevance: 0 }; this.APOS_STRING_MODE = { className: 'string', begin: '\'', end: '\'', illegal: '\\n', contains: [this.BACKSLASH_ESCAPE], relevance: 0 }; this.QUOTE_STRING_MODE = { className: 'string', begin: '"', end: '"', illegal: '\\n', contains: [this.BACKSLASH_ESCAPE], relevance: 0 }; this.C_LINE_COMMENT_MODE = { className: 'comment', begin: '//', end: '$' }; this.C_BLOCK_COMMENT_MODE = { className: 'comment', begin: '/\\*', end: '\\*/' }; this.HASH_COMMENT_MODE = { className: 'comment', begin: '#', end: '$' }; this.NUMBER_MODE = { className: 'number', begin: this.NUMBER_RE, relevance: 0 }; this.C_NUMBER_MODE = { className: 'number', begin: this.C_NUMBER_RE, relevance: 0 }; this.BINARY_NUMBER_MODE = { className: 'number', begin: this.BINARY_NUMBER_RE, relevance: 0 }; this.REGEXP_MODE = { className: 'regexp', begin: /\//, end: /\/[gim]*/, illegal: /\n/, contains: [ this.BACKSLASH_ESCAPE, { begin: /\[/, end: /\]/, relevance: 0, contains: [this.BACKSLASH_ESCAPE] } ] } // Utility functions this.inherit = function(parent, obj) { var result = {} for (var key in parent) result[key] = parent[key]; if (obj) for (var key in obj) result[key] = obj[key]; return result; } } highlight.js-7.4/src/test.html0000755000175000017500000016442412234266276016010 0ustar boutilboutil highlight.js test

This is a demo/test page showing all languages supported by highlight.js. Most snippets do not contain working code :-).

Styles

Automatically detected languages

...

Python
@requires_authorization
def somefunc(param1='', param2=0):
    r'''A docstring'''
    if param1 > param2: # interesting
        print 'Gre\'ater'
    return (param2 - param1 + 1) or None

class SomeClass:
pass >>> message = '''interpreter ... prompt'''
Python's profiler output
       261917242 function calls in 686.251 CPU seconds

       ncalls  tottime  filename:lineno(function)
       152824  513.894  {method 'sort' of 'list' objects}
    129590630   83.894  rrule.py:842(__cmp__)
    129590630   82.439  {cmp}
       153900    1.296  rrule.py:399(_iter)
304393/151570    0.963  rrule.py:102(_iter_cached)
Ruby
class A < B; def self.create(object = User) object end end
class Zebra; def inspect; "X#{2 + self.object_id}" end end

module ABC::DEF
  include Comparable

  # @param test
  # @return [String] nothing
  def foo(test)
    Thread.new do |blockvar|
      ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test)
    end.join
  end

  def [](index) self[index] end
  def ==(other) other == self end
end

anIdentifier = an_identifier
Constant = 1
render action: :new
Haml
!!! XML
%html
  %body
    %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js
    /html comment
    -# ignore this line
    %ul(style='margin: 0')
    -items.each do |i|
      %i= i
    = variable
    =variable2
    ~ variable3
    ~variable4
    The current year is #{DataTime.now.year}.
    
Perl
# loads object
sub load
{
  my $flds = $c->db_load($id,@_) || do {
    Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef
  };
  my $o = $c->_perl_new();
  $id12 = $id / 24 / 3600;
  $o->{'ID'} = $id12 + 123;
  #$o->{'SHCUT'} = $flds->{'SHCUT'};
  my $p = $o->props;
  my $vt;
  $string =~ m/^sought_text$/;
  $items = split //, 'abc';
  for my $key (keys %$p)
  {
    if(${$vt.'::property'}) {
      $o->{$key . '_real'} = $flds->{$key};
      tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
    }
  }
  $o->save if delete $o->{'_save_after_load'};
  return $o;
}

=head1 NAME
POD till the end of file
PHP
require_once 'Zend/Uri/Http.php';

abstract class URI extends BaseURI
{

  /**
   * Returns a URI
   *
   * @return  URI
   */
  static public function _factory($stats = array(), $uri = 'http')
  {
      $uri = explode(':', $uri, 0b10);
      $schemeSpecific = isset($uri[1]) ? $uri[1] : '';
      $desc = 'Multi
line description';

      // Security check
      if (!ctype_alnum($scheme)) {
          throw new Zend_Uri_Exception('Illegal scheme');
      }

      return [
        'uri' => $uri,
        'value' => null,
      ];
  }
}

__halt_compiler () ; datahere
datahere
datahere */
datahere
Scala
object abstractTypes extends Application {
  abstract class SeqBuffer {
    type T; val element: Seq[T]; def length = element.length
  }
}

/** Turn command line arguments to uppercase */
object Main {
  def main(args: Array[String]) {
    val res = for (a <- args) yield a.toUpperCase
    println("Arguments: " + res.toString)
  }
}

/** Maps are easy to use in Scala. */
object Maps {
  val colors = Map("red" -> 0xFF0000,
                   "turquoise" -> 0x00FFFF,
                   "black" -> 0x000000,
                   "orange" -> 0xFF8040,
                   "brown" -> 0x804000)
  def main(args: Array[String]) {
    for (name <- args) println(
      colors.get(name) match {
        case Some(code) =>
          name + " has code: " + code
        case None =>
          "Unknown color: " + name
      }
    )
  }
}
Go
package main

import (
    "fmt"
    "rand"
    "os"
)

const (
    Sunday = iota
    Partyday
    numberOfDays  // this constant is not exported
)

type Foo interface {
    FooFunc(int, float32) (complex128, []int)
}

// simple comment
type Bar struct {
    os.File /* multi
    line
    comment */

    PublicData chan int
}

func main() {
    ch := make(chan int)
    ch <- 1
    x, ok := <- ch
    ok = true
    x = nil
    float_var := 1.0e10
    defer fmt.Println('\'')
    defer fmt.Println(`exitting now\`)
    var fv1 float64 = 0.75
    go println(len("hello world!"))
    return
}

XML
<?xml version="1.0"?>
<response value="ok" xml:lang="en">
  <text>Ok</text>
  <comment html_allowed="true"/>
  <ns1:description><![CDATA[
  CDATA is <not> magical.
  ]]></ns1:description>
  <a></a> <a/>
</response>
HTML (with inline css and javascript)
<!DOCTYPE html>
<title>Title</title>

<style>body {width: 500px;}</style>

<script type="application/javascript">
  function $init() {return true;}
</script>

<body>
  <p checked class="title" id='title'>Title</p>
  <!-- here goes the rest of the page -->
</body>
Lasso
<?LassoScript
/* Lasso 8 */
  local('query' = 'SELECT * FROM `'+var:'table'+'` WHERE `id` > 10
    ORDER BY `Name` LIMIT 30');
  Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query;
    var("class.name" = (found_count != 0 ? `subtotal` | `nonefound`));
    records;
      output: ?><tr>[loop_count]</tr><?=;
    /records;
  /Inline;
?><div class="[$class.name]">[found_count]</div>
[noprocess] causes [delimiters] to be skipped until the next [/noprocess]
<?lasso
/* Lasso 9 */
  define strings_combine(value::string, ...other)::string => {
    local(result = #value->append(#other->asString))
    return #result
  }
  /**! descriptive text */
  define person => type {
    data name::string, protected nickname
    data birthdate::date
    data private ssn = null
    public showName() => return .'name'
    protected fullName() => '"' + .nickname + '"' + .'name'
    public ssnListed => .ssn ? true | false
  }
  define person->name=(value) => {
    .'name' = #value
    return self->'name'
  }
  // query expression
  with n in array(-1, 0xABCD, 3.14159e14)
  let swapped = pair(#n->second, #n->first)
  group #swapped by #n->first into t
  let key = #t->key
  order by #key
  select pair(#key, #t)
  do {^
    #n->upperCase
  ^}
?>
Markdown
# hello world

you can write text [with links](http://example.com).

* one _thing_ has *em*phasis
* two __things__ are **bold**

---

hello world
===========

<this_is inline="xml"></this_is>

> markdown is so cool

    so are code segments

1. one thing (yeah!)
2. two thing `i can write code`, and `more` wipee!
AsciiDoc
Hello, World!
============
Author Name, <author@domain.foo>

you can write text http://example.com[with links], optionally
using an explicit link:http://example.com[link prefix].

* single quotes around a phrase place 'emphasis'
** alternatively, you can put underlines around a phrase to add _emphasis_
* astericks around a phrase make the text *bold*
* pluses around a phrase make it +monospaced+

- escape characters are supported
- you can escape a quote inside emphasized text like 'here\'s johnny!'

term:: definition
 another term:: another definition

// this is just a comment

Let's make a break.

'''

////
we'll be right with you

after this brief interruption.
////

== We're back!

Want to see a image::images/tiger.png[Tiger]?

.Nested highlighting
++++
<this_is inline="xml"></this_is>
++++

____
asciidoc is so powerful.
____

another quote:

[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
____
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
____

Getting Literal
---------------

 want to get literal? prefix a line with a space.

....
I'll join that party, too.
....

. one thing (yeah!)
. two thing `i can write code`, and `more` wipee!

NOTE: AsciiDoc is quite cool, you should try it.
Django templates
{% if articles|length %}
{% for article in articles %}

{# Striped table #}
<tr class="{% cycle odd,even %}">
  <td>{{ article|default:"Hi... "|escape }}</td>
  <td {% if article.today %}class="today"{% endif %}>{{ article.date|date:"d.m.Y" }}</td>
</tr>

{% endfor %}
{% endif %}

{% comment %}
Comments may be long and
multiline.
{% endcomment %}
Handlebars
<h3>Hours</h3>

<ul>
  {{#each content.users}}
  <li {{bindAttr hello="world"}}>{{firstName}}</li>
  {{/each}}
</ul>
CSS
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  body:first-of-type pre::after {
    content: 'highlight: ' attr(class);
  }
  body {
    background: linear-gradient(45deg, blue, red);
  }
}

@import url('print.css');
@page:right {
 margin: 1cm 2cm 1.3cm 4cm;
}

@font-face {
  font-family: Chunkfive; src: url('Chunkfive.otf');
}

div.text,
#content,
li[lang=ru] {
  font: Tahoma, Chunkfive, sans-serif;
  background: url('hatch.png') /* wtf? */;  color: #F0F0F0 !important;
  width: 100%;
}
SCSS
@import "compass/reset";

// variables
$colorGreen: #008000;
$colorGreenDark: darken($colorGreen, 10);

@mixin container {
    max-width: 980px;
}

// mixins with parameters
@mixin button($color:green) {
    @if ($color == green) {
        background-color: #008000;
    }
    @else if ($color == red) {
        background-color: #B22222;
    }
}

button {
    @include button(red);
}

div,
.navbar,
#header,
input[type="input"] {
    font-family: "Helvetica Neue", Arial, sans-serif;
    width: auto;
    margin: 0 auto;
    display: block;
}

.row-12 > [class*="spans"] {
    border-left: 1px solid #B5C583;
}

// nested definitions
ul {
    width: 100%;
    padding: {
        left: 5px; right: 5px;
    }
  li {
      float: left; margin-right: 10px;
      .home {
          background: url('http://placehold.it/20') scroll no-repeat 0 0;
    }
  }
}

.banner {
    @extend .container;
}

a {
  color: $colorGreen;
  &:hover { color: $colorGreenDark; }
  &:visited { color: #c458cb; }
}

@for $i from 1 through 5 {
    .span#{$i} {
        width: 20px*$i;
    }
}

@mixin mobile {
  @media screen and (max-width : 600px) {
    @content;
  }
}
JSON
[
  {
    "title": "apples",
    "count": [12000, 20000],
    "description": {"text": "...", "sensitive": false}
  },
  {
    "title": "oranges",
    "count": [17500, null],
    "description": {"text": "...", "sensitive": false}
  }
]
JavaScript
function $initHighlight(block, flags) {
  try {
    if (block.className.search(/\bno\-highlight\b/) != -1)
      return processBlock(block, true, 0x0F) + ' class=""';
  } catch (e) {
    /* handle exception */

    var e4x =
        <div>Example
            <p>1234</p></div>;
  }
  for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp
    if (checkCondition(classes[i]) === undefined)
      return /\d+[\s/]/g;
  }
}
CoffeeScript
# Divisions
x = 6/foo/i
x = 6 /foo
x = 6 / foo
x = 6 /foo * 2/gm
x = f /foo
x = f / foo / gm
x = f /foo * 2/6

# Regexps
x = f /6 * 2/ - 3
x = f /foo * 2/gm
x = if true then /\n/ else /[.,]+/

grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) ->
  if student.excellentWork
    "A+"
  else if student.okayStuff
    if student.triedHard then "B" else "B-"
  else
    "C"

square = (x) -> x * x

two = -> 2

math =
  root:   Math.sqrt
  square: square
  cube:   (x) -> x * square x

race = (winner, runners...) ->
  print winner, runners

class Animal extends Being
  constructor: (@name) ->

  move: (meters) ->
    alert @name + " moved #{meters}m."

hi = `function() {
  return [document.title, "Hello JavaScript"].join(": ");
}`

heredoc = """
CoffeeScript subst test #{ 010 + 0xf / 0b10 + "nested string #{ /\n/ }"}
"""

###
CoffeeScript Compiler v1.2.0
Released under the MIT License
###

OPERATOR = /// ^ (
?: [-=]>             # function
) ///
ActionScript
package org.example.dummy {
    import org.dummy.*;

    /*define package inline interface*/
    public interface IFooBarzable {
        public function foo(... pairs):Array;
    }

    public class FooBar implements IFooBarzable {
        static private var cnt:uint = 0;
        private var bar:String;

        //constructor
        public function TestBar(bar:String):void {
            bar = bar;
            ++cnt;
        }

        public function foo(... pairs):Array {
            pairs.push(bar);
            return pairs;
        }
    }
}
VBScript
' creating configuration storage and initializing with default values
Set cfg = CreateObject("Scripting.Dictionary")

' reading ini file
for i = 0 to ubound(ini_strings)
    s = trim(ini_strings(i))

    ' skipping empty strings and comments
    if mid(s, 1, 1) <> "#" and len(s) > 0 then
      ' obtaining key and value
      parts = split(s, "=", -1, 1)

      if ubound(parts)+1 = 2 then
        parts(0) = trim(parts(0))
        parts(1) = trim(parts(1))

        ' reading configuration and filenames
        select case lcase(parts(0))
          case "uncompressed""_postfix" cfg.item("uncompressed""_postfix") = parts(1)
          case "f"
                    options = split(parts(1), "|", -1, 1)
                    if ubound(options)+1 = 2 then
                      ' 0: filename,  1: options
                      ff.add trim(options(0)), trim(options(1))
                    end if
        end select
      end if
    end if
next
VB.NET
Import System
Import System.IO
#Const DEBUG = True

Namespace Highlighter.Test
  ''' <summary>This is an example class.</summary>
  Public Class Program
    Protected Shared hello As Integer = 3
    Private Const ABC As Boolean = False

#Region "Code"
    ' Cheers!
    <STAThread()> _
    Public Shared Sub Main(ByVal args() As String, ParamArray arr As Object) Handles Form1.Click
      On Error Resume Next
      If ABC Then
        While ABC : Console.WriteLine() : End While
        For i As Long = 0 To 1000 Step 123
          Try
            System.Windows.Forms.MessageBox.Show(CInt("1").ToString())
          Catch ex As Exception       ' What are you doing? Well...
            Dim exp = CType(ex, IOException)
            REM ORZ
            Return
          End Try
        Next
      Else
        Dim l As New System.Collections.List<String>()
        SyncLock l
          If TypeOf l Is Decimal And l IsNot Nothing Then
            RemoveHandler button1.Paint, delegate
          End If
          Dim d = New System.Threading.Thread(AddressOf ThreadProc)
          Dim a = New Action(Sub(x, y) x + y)
          Static u = From x As String In l Select x.Substring(2, 4) Where x.Length > 0
        End SyncLock
        Do : Laugh() : Loop Until hello = 4
      End If
    End Sub
#End Region
  End Class
End Namespace
HTTP
POST /task?id=1 HTTP/1.1
Host: example.org
Content-Type: application/json; charset=utf-8
Content-Length: 19

{"status": "ok", "extended": true}
Lua
--[[
Simple signal/slot implementation
]]
local signal_mt = {
    __index = {
        register = table.insert
    }
}
function signal_mt.__index:emit(... --[[ Comment in params ]])
    for _, slot in ipairs(self) do
        slot(self, ...)
    end
end
local function create_signal()
    return setmetatable({}, signal_mt)
end

-- Signal test
local signal = create_signal()
signal:register(function(signal, ...)
    print(...)
end)
signal:emit('Answer to Life, the Universe, and Everything:', 42)

--[==[ [=[ [[
Nested ]]
multi-line ]=]
comment ]==]
[==[ Nested
[=[ multi-line
[[ string
]] ]=] ]==]
AppleScript
repeat 5 times
    if foo is greater than bar then
        display dialog "Hello there"
    else
        beep
    end if
end repeat

(* comment (*nested comment*) *)
on do_something(s, y)
    return {s + pi, y mod 4}
end do_something

do shell script "/bin/echo 'hello'"
Delphi
TList=Class(TObject)
Private
  Some: String;
Public
  Procedure Inside; // Suxx
End;{TList}

Procedure CopyFile(InFileName,var OutFileName:String);
Const
  BufSize=4096; (* Huh? *)
Var
  InFile,OutFile:TStream;
  Buffer:Array[1..BufSize] Of Byte;
  ReadBufSize:Integer;
Begin
  InFile:=Nil;
  OutFile:=Nil;
  Try
    InFile:=TFileStream.Create(InFileName,fmOpenRead);
    OutFile:=TFileStream.Create(OutFileName,fmCreate);
    Repeat
      ReadBufSize:=InFile.Read(Buffer,BufSize);
      OutFile.Write(Buffer,ReadBufSize);
    Until ReadBufSize<>BufSize;
    Log('File '''+InFileName+''' copied'#13#10);
  Finally
    InFile.Free;
    OutFile.Free;
  End;{Try}
End;{CopyFile}
Java
/**
 * @author John Smith <john.smith@example.com>
 * @version 1.0
*/
package l2f.gameserver.model;

import java.util.ArrayList;

public abstract class L2Character extends L2Object {
  public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0001; // not sure

  public void moveTo(int x, int y, int z) {
    _ai = null;
    _log.warning("Should not be called");
    if (1 > 5) {
      return;
    }
  }

  /** Task of AI notification */
  @SuppressWarnings( { "nls", "unqualified-field-access", "boxing" })
  public class NotifyAITask implements Runnable {
    private final CtrlEvent _evt;

    public void run() {
      try {
        getAI().notifyEvent(_evt, null, null);
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }
}
C++
#include <iostream>

int main(int argc, char *argv[]) {

  /* An annoying "Hello World" example */
  for (auto i = 0; i < 0xFFFF; i++)
    cout << "Hello, World!" << endl;

  char c = '\n';
  unordered_map <string, vector<string> > m;
  m["key"] = "\\\\"; // this is an error

  return -2e3 + 12l;
}
Objective C
#import <UIKit/UIKit.h>
#import "Dependency.h"

@protocol WorldDataSource
@optional
- (NSString*)worldName;
@required
- (BOOL)allowsToLive;
@end

@interface Test : NSObject <HelloDelegate, WorldDataSource> {
  NSString *_greeting;
}

@property (nonatomic, readonly) NSString *greeting;
- (IBAction) show;
@end

@implementation Test

@synthesize test=_test;

+ (id) test {
  return [self testWithGreeting:@"Hello, world!\nFoo bar!"];
}

+ (id) testWithGreeting:(NSString*)greeting {
  return [[[self alloc] initWithGreeting:greeting] autorelease];
}

- (id) initWithGreeting:(NSString*)greeting {
  if ( (self = [super init]) ) {
    _greeting = [greeting retain];
  }
  return self;
}

- (void) dealloc {
  [_greeting release];
  [super dealloc];
}

@end
Vala
using DBus;

namespace Test {
  class Foo : Object {
    public signal void some_event ();   // definition of the signal
    public void method () {
      some_event ();                    // emitting the signal (callbacks get invoked)
    }
  }
}

/* defining a class */
class Track : GLib.Object, Test.Foo {              /* subclassing 'GLib.Object' */
  public double mass;                  /* a public field */
  public double name { get; set; }     /* a public property */
  private bool terminated = false;     /* a private field */
  public void terminate() {            /* a public method */
    terminated = true;
  }
}

const ALL_UPPER_CASE = "you should follow this convention";

var t = new Track();      // same as: Track t = new Track();
var s = "hello";          // same as: string s = "hello";
var l = new List<int>();       // same as: List<int> l = new List<int>();
var i = 10;               // same as: int i = 10;


#if (ololo)
Regex regex = /foo/;
#endif

/*
 * Entry point can be outside class
 */
void main () {
  var long_string = """
    Example of "verbatim string".
    Same as in @"string" in C#
  """
  var foo = new Foo ();
  foo.some_event.connect (callback_a);      // connecting the callback functions
  foo.some_event.connect (callback_b);
  foo.method ();
}
C#
using System;

#pragma warning disable 414, 3021

public class Program
{
    /// <summary>The entry point to the program.</summary>
    public static int Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
        string s = @"This
""string""
spans
multiple
lines!";
        return 0;
    }
}

async Task<int> AccessTheWebAsync()
{
    // ...
    string urlContents = await getStringTask;
    return urlContents.Length;
}
F#
open System

// Single line comment...
(*
  This is a
  multiline comment.
*)
let checkList alist =
    match alist with
    | [] -> 0
    | [a] -> 1
    | [a; b] -> 2
    | [a; b; c] -> 3
    | _ -> failwith "List is too big!"


type IEncoding =
    abstract Encode : string -> string
    abstract Decode : string -> string

let text = "Some text..."
let text2 = @"A ""verbatim"" string..."
let catalog = """
Some "long" string...
"""

let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)

let fibs =
    Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]
    |> Async.RunSynchronously

type Sprocket(gears) =
  member this.Gears : int = gears

[<AbstractClass>]
type Animal =
  abstract Speak : unit -> unit

type Widget =
  | RedWidget
  | GreenWidget

type Point = {X: float; Y: float;}

[<Measure>]
type s
let minutte = 60<s>

D
#!/usr/bin/rdmd
// Computes average line length for standard input.
import std.stdio;

/+
  this is a /+ nesting +/ comment
+/

enum COMPILED_ON = __TIMESTAMP__;  // special token

enum character = '©';
enum copy_valid = '&copy;';
enum backslash_escaped = '\\';

// string literals
enum str = `hello "world"!`;
enum multiline = r"lorem
ipsum
dolor";  // wysiwyg string, no escapes here allowed
enum multiline2 = "sit
amet
\"adipiscing\"
elit.";
enum hex = x"66 6f 6f";   // same as "foo"

#line 5

// float literals
enum f = [3.14f, .1, 1., 1e100, 0xc0de.01p+100];

static if (something == true) {
   import std.algorithm;
}

void main() pure nothrow @safe {
    ulong lines = 0;
    double sumLength = 0;
    foreach (line; stdin.byLine()) {
        ++lines;
        sumLength += line.length;
    }
    writeln("Average line length: ",
        lines ? sumLength / lines : 0);
}
RenderMan RSL
#define TEST_DEFINE 3.14
/*  plastic surface shader
 *
 *  Pixie is:
 *  (c) Copyright 1999-2003 Okan Arikan. All rights reserved.
 */

surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;
                 color specularcolor = 1;) {
  normal Nf = faceforward (normalize(N),I);
  Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks *
       specular(Nf,-normalize(I),roughness);
  Oi = Os;
  Ci *= Oi;
}
RenderMan RIB
FrameBegin 0
Display "Scene" "framebuffer" "rgb"
Option "searchpath" "shader" "+&:/home/kew"
Option "trace" "int maxdepth" [4]
Attribute "visibility" "trace" [1]
Attribute "irradiance" "maxerror" [0.1]
Attribute "visibility" "transmission" "opaque"
Format 640 480 1.0
ShadingRate 2
PixelFilter "catmull-rom" 1 1
PixelSamples 4 4
Projection "perspective" "fov" 49.5502811377
Scale 1 1 -1

WorldBegin

ReadArchive "Lamp.002_Light/instance.rib"
Surface "plastic"
ReadArchive "Cube.004_Mesh/instance.rib"
# ReadArchive "Sphere.010_Mesh/instance.rib"
# ReadArchive "Sphere.009_Mesh/instance.rib"
ReadArchive "Sphere.006_Mesh/instance.rib"

WorldEnd
FrameEnd
MEL (Maya Embedded Language)
proc string[] getSelectedLights()

{
  string $selectedLights[];

  string $select[] = `ls -sl -dag -leaf`;

  for ( $shape in $select )
  {
    // Determine if this is a light.
    //
    string $class[] = getClassification( `nodeType $shape` );


    if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) )
    {
      $selectedLights[ `size $selectedLights` ] = $shape;
    }
  }

  // Result is an array of all lights included in

  // current selection list.
  return $selectedLights;
}
GLSL
// vertex shader
#version 150
in  vec2 in_Position;
in  vec3 in_Color;

out vec3 ex_Color;
void main(void) {
    gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0);
    ex_Color = in_Color;
}


// geometry shader
#version 150

layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;

void main() {
  for(int i = 0; i < gl_in.length(); i++) {
    gl_Position = gl_in[i].gl_Position;
    EmitVertex();
  }
  EndPrimitive();
}


// fragment shader
#version 150
precision highp float;

in  vec3 ex_Color;
out vec4 gl_FragColor;

void main(void) {
    gl_FragColor = vec4(ex_Color, 1.0);
}
SQL
BEGIN;
CREATE TABLE "topic" (
    "id" serial NOT NULL PRIMARY KEY,
    "forum_id" integer NOT NULL,
    "subject" varchar(255) NOT NULL
);
ALTER TABLE "topic" ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") REFERENCES "forum" ("id");

-- Initials
insert into "topic" ("forum_id", "subject") values (2, 'D''artagnian');

select count(*) from cicero_forum;

-- this line lacks ; at the end to allow people to be sloppy and omit it in one-liners
COMMIT
SmallTalk
Object>>method: num
    "comment 123"
    | var1 var2 |
    (1 to: num) do: [:i | |var| ^i].
    Klass with: var1.
    Klass new.
    arr := #('123' 123.345 #hello Transcript var $@).
    arr := #().
    var2 = arr at: 3.
    ^ self abc

heapExample
    "HeapTest new heapExample"
    "Multiline
    decription"
    | n rnd array time sorted |
    n := 5000.
    "# of elements to sort"
    rnd := Random new.
    array := (1 to: n)
                collect: [:i | rnd next].
    "First, the heap version"
    time := Time
                millisecondsToRun: [sorted := Heap withAll: array.
    1
        to: n
        do: [:i |
            sorted removeFirst.
            sorted add: rnd next]].
    Transcript cr; show: 'Time for Heap: ' , time printString , ' msecs'.
    "The quicksort version"
    time := Time
                millisecondsToRun: [sorted := SortedCollection withAll: array.
    1
        to: n
        do: [:i |
            sorted removeFirst.
            sorted add: rnd next]].
    Transcript cr; show: 'Time for SortedCollection: ' , time printString , ' msecs'
Lisp
#!/usr/bin/env csi

(defun prompt-for-cd ()
   "Prompts
    for CD"
   (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6))
   (prompt-read "Artist" &rest)
   (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
  (if x (format t "yes") (format t "no" nil) ;and here comment
  )
  ;; second line comment
  '(+ 1 2)
  (defvar *lines*)                ; list of all lines
  (position-if-not #'sys::whitespacep line :start beg))
  (quote (privet 1 2 3))
  '(hello world)
  (* 5 7)
  (1 2 34 5)
  (:use "aaaa")
  (let ((x 10) (y 20))
    (print (+ x y))
  )
Clojure
;   You must not remove this notice, or any other, from this software.

(ns ^{:doc "The core Clojure language."
       :author "Rich Hickey"}
  clojure.core)

(def unquote)

(def
  ^{:macro true
    :added "1.0"}
  let (fn* let [&form &env & decl] (cons 'let* decl)))

(def

 defn (fn defn [&form &env name & fdecl]
        (let [m (conj {:arglists (list 'quote (sigs fdecl))} m)
              m (let [inline (:inline m)
                      ifn (first inline)
                      iname (second inline)]
                  ;; same as: (if (and (= 'fn ifn) (not (symbol? iname))) ...)
                  (if (if (clojure.lang.Util/equiv 'fn ifn)
                        (if (instance? clojure.lang.Symbol iname) false true))
                    ;; inserts the same fn name to the inline fn if it does not have one
                    (assoc m :inline (cons ifn (cons (clojure.lang.Symbol/intern (.concat (.getName ^clojure.lang.Symbol name) "__inliner"))
                                                     (next inline))))
                    m))
              m (conj (if (meta name) (meta name) {}) m)]
          (list 'def (with-meta name m)
                ;;todo - restore propagation of fn name
                ;;must figure out how to convey primitive hints to self calls first
                (cons `fn fdecl) ))))

(. (var defn) (setMacro))
Ini file
;Settings relating to the location and loading of the database
[Database]
ProfileDir=.
ShowProfileMgr=smart
Profile1_Name[] = "\|/_-=MegaDestoyer=-_\|/"
DefaultProfile=True
AutoCreate = no

[AutoExec]
use-prompt="prompt"
Glob=autoexec_*.ini
AskAboutIgnoredPlugins=0
Apache
# rewrite`s rules for wordpress pretty url
LoadModule rewrite_module  modules/mod_rewrite.so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]

ExpiresActive On
ExpiresByType application/x-javascript  "access plus 1 days"

<Location /maps/>
  RewriteMap map txt:map.txt
  RewriteMap lower int:tolower
  RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
  RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
  RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
</Location>
nginx
user  www www;
worker_processes  2;
pid /var/run/nginx.pid;
error_log  /var/log/nginx.error_log  debug | info | notice | warn | error | crit;

events {
    connections   2000;
    use kqueue | rtsig | epoll | /dev/poll | select | poll;
}

http {
    log_format main      '$remote_addr - $remote_user [$time_local] '
                         '"$request" $status $bytes_sent '
                         '"$http_referer" "$http_user_agent" '
                         '"$gzip_ratio"';

    send_timeout 3m;
    client_header_buffer_size 1k;

    gzip on;
    gzip_min_length 1100;

    #lingering_time 30;

    server {
        server_name   one.example.com  www.one.example.com;
        access_log   /var/log/nginx.access_log  main;

        rewrite (.*) /index.php?page=$1 break;

        location / {
            proxy_pass         http://127.0.0.1/;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            charset            koi8-r;
        }

        location /api/ {
            fastcgi_pass 127.0.0.1:9000;
        }

        location ~* \.(jpg|jpeg|gif)$ {
            root         /spool/www;
        }
    }
}
Diff
Index: languages/ini.js
===================================================================
--- languages/ini.js    (revision 199)
+++ languages/ini.js    (revision 200)
@@ -1,8 +1,7 @@
 hljs.LANGUAGES.ini =
 {
   case_insensitive: true,
-  defaultMode:
-  {
+  defaultMode: {
     contains: ['comment', 'title', 'setting'],
     illegal: '[^\\s]'
   },

*** /path/to/original timestamp
--- /path/to/new      timestamp
***************
*** 1,3 ****
--- 1,9 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!

! compress the size of the
! changes.

  It is important to spell
DOS batch files
cd \
copy a b
ping 192.168.0.1
@rem ping 192.168.0.1
net stop sharedaccess
del %tmp% /f /s /q
del %temp% /f /s /q
ipconfig /flushdns
taskkill /F /IM JAVA.EXE /T

cd Photoshop/Adobe Photoshop CS3/AMT/
if exist application.sif (
    ren application.sif _application.sif
) else (
    ren _application.sif application.sif
)

taskkill /F /IM proquota.exe /T

sfc /SCANNOW

set path = test

xcopy %1\*.* %2
Bash
#!/bin/bash

###### BEGIN CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
###### END CONFIG

if [ "$UID" -ne 0 ]
then
 echo "Superuser rights is required"
 echo 'Printing the # sign'
 exit 2
fi

if test $# -eq 0
then
elif test [ $1 == 'start' ]
else
fi

genApacheConf(){
 if [[ "$2" = "www" ]]
 then
  full_domain=$1
 else
  full_domain=$2.$1
 fi
 host_root="${APACHE_HOME_DIR}$1/$2/$(title)"
 echo -e "# Host $1/$2 :"
}
CMake
project(test)
cmake_minimum_required(VERSION 2.6)

# IF LINUX
if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
    message("\nOS:\t\tLinux")
endif()

# IF WINDOWS
if (${CMAKE_SYSTEM_NAME} MATCHES Windows)
    message("\nOS:\t\tWindows")
endif()

set(test test0.cpp test1.cpp test2.cpp)

include_directories(./)

set(EXECUTABLE_OUTPUT_PATH ../bin)

add_subdirectory(src)

add_executable(test WIN32 ${test})

target_link_libraries(test msimg32)
Axapta
class ExchRateLoadBatch extends RunBaseBatch {
  ExchRateLoad rbc;
  container currencies;
  boolean actual;
  boolean overwrite;
  date beg;
  date end;

  #define.CurrentVersion(5)

  #localmacro.CurrentList
    currencies,
    actual,
    beg,
    end
  #endmacro
}

public boolean unpack(container packedClass) {
  container       base;
  boolean         ret;
  Integer         version    = runbase::getVersion(packedClass);

  switch (version) {
    case #CurrentVersion:
      [version, #CurrentList] = packedClass;
      return true;
    default:
      return false;
  }
  return ret;
}
Oracle Rules Language
//This is a comment
ABORT "You experienced an abort.";
WARN "THIS IS A WARNING";
CALL "RIDER_X";
DONE;
FOR EACH X IN CSV_FILE "d:\lodestar\user\d377.lse"
 LEAVE FOR;
END FOR;
IF ((BILL_KW = 0) AND (KW > 0)) THEN
END IF;
INCLUDE "R1";
LEAVE RIDER;
SELECT BILL_PERIOD
   WHEN "WINTER"
      BLOCK KWH
      FROM 0 TO 400 CHARGE $0.03709
      FROM 400 CHARGE $0.03000
      TOTAL $ENERGY_CHARGE_WIN;
   WHEN "SUMMER"
      $VOLTAGE_DISCOUNT_SUM = $0.00
   OTHERWISE
      $VOLTAGE_DISCOUNT_SUM = $1.00
END SELECT;
/* Report top five peaks */
LABEL PK.NM "Peak Number";
SAVE_UPDATE MV TO TABLE "METERVALUE";

FOR EACH INX IN ARRAYUPPERBOUND(#MYARRAY[])
  #MYARRAY[INX].VALUE = 2;
  CLEAR #MYARRAY[];
END FOR

//Interval Data
HNDL_1_ADD_EDI = INTDADDATTRIBUTE(HNDL_1, "EDI_TRANSACTION", EDI_ID);
HNDL_1_ADD_VAL_MSG = INTDADDVMSG(HNDL_1,"Missing (Status Code 9) values found");
EMPTY_HNDL = INTDCREATEHANDLE('05/03/2006 00:00:00', '05/03/2006 23:59:59', 3600, "Y", "0", " ");

#Если Клиент Тогда
Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий
Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции
  x=ТекстСообщения+ТекстСообщения2+"
  |строка1
  |строка2
  |строка3";
КонецФункции
#КонецЕсли

// Процедура ПриНачалеРаботыСистемы
//
Процедура ПриНачалеРаботыСистемы()
  Обработки.Помощник.ПолучитьФорму("Форма").Открыть();
  d = '21.01.2008'
КонецПроцедуры
AVR Assembler
;* Title:       Block Copy Routines
;* Version:     1.1

.include "8515def.inc"

    rjmp    RESET   ;reset handle

.def    flashsize=r16       ;size of block to be copied

flash2ram:
    lpm         ;get constant
    st  Y+,r0       ;store in SRAM and increment Y-pointer
    adiw    ZL,1        ;increment Z-pointer
    dec flashsize
    brne    flash2ram   ;if not end of table, loop more
    ret

.def    ramtemp =r1     ;temporary storage register
.def    ramsize =r16        ;size of block to be copied
VHDL
/*
 * RS-trigger with assynch. reset
 */

library ieee;
use ieee.std_logic_1164.all;

entity RS_trigger is
    generic (T: Time := 0ns);
    port ( R, S  : in  std_logic;
           Q, nQ : out std_logic;
           reset, clock : in  std_logic );
end RS_trigger;

architecture behaviour of RS_trigger is
    signal QT: std_logic; -- Q(t)
begin
    process(clock, reset) is
        subtype RS is std_logic_vector (1 downto 0);
    begin
        if reset = '0' then
            QT <= '0';
        else
            if rising_edge(C) then
                if not (R'stable(T) and S'stable(T)) then
                    QT <= 'X';
                else
                    case RS'(R&S) is
                        when "01" => QT <= '1';
                        when "10" => QT <= '0';
                        when "11" => QT <= 'X';
                        when others => null;
                    end case;
                end if;
            end if;
        end if;
    end process;

    Q  <= QT;
    nQ <= not QT;
end architecture behaviour;
Parser 3
@CLASS
base

@USE
module.p

@BASE
class

# Comment for code
@create[aParam1;aParam2][local1;local2]
  ^connect[mysql://host/database?ClientCharset=windows-1251]
  ^for[i](1;10){
    <p class="paragraph">^eval($i+10)</p>
    ^connect[mysql://host/database]{
      $tab[^table::sql{select * from `table` where a='1'}]
      $var_Name[some${value}]
    }
  }

  ^rem{
    Multiline comment with code: $var
    ^while(true){
      ^for[i](1;10){
        ^sleep[]
      }
    }
  }
  ^taint[^#0A]

@GET_base[]
## Comment for code
  # Isn't comment
  $result[$.hash_item1[one] $.hash_item2[two]]
TeX
\documentclass{article}
\usepackage[koi8-r]{inputenc}
\hoffset=0pt
\voffset=.3em
\tolerance=400
\newcommand{\eTiX}{\TeX}
\begin{document}
\section*{Highlight.js}
\begin{table}[c|c]
$\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
\end{table}
Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b
G\"otterd\"ammerung~45\%=34.
$$
    \int\limits_{0}^{\pi}\frac{4}{x-7}=3
$$
\end{document}
BrainFuck
++++++++++
[ 3*10 and 10*10
  ->+++>++++++++++<<
]>>
[ filling cells
  ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[<]<[<]<[<]>>
]<
+++++++++<<
[ rough codes correction loop
  ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]<
]
more accurate сodes correction
>>>++>
-->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++>
++>+++++++++++>++++++++++++>------>+++
rewind and output
[<]>[.>]
Haskell
{-# LANGUAGE TypeSynonymInstances #-}
module Network.UDP
( DataPacket(..)
, openBoundUDPPort
, openListeningUDPPort
, pingUDPPort
, sendUDPPacketTo
, recvUDPPacket
, recvUDPPacketFrom
) where

{- this is a {- nested -} comment -}

import qualified Data.ByteString as Strict (ByteString, concat, singleton)
import qualified Data.ByteString.Lazy as Lazy (ByteString, toChunks, fromChunks)
import Data.ByteString.Char8 (pack, unpack)
import Network.Socket hiding (sendTo, recv, recvFrom)
import Network.Socket.ByteString (sendTo, recv, recvFrom)

-- Type class for converting StringLike types to and from strict ByteStrings
class DataPacket a where
  toStrictBS :: a -> Strict.ByteString
  fromStrictBS :: Strict.ByteString -> a

instance DataPacket Strict.ByteString where
  toStrictBS = id
  {-# INLINE toStrictBS #-}
  fromStrictBS = id
  {-# INLINE fromStrictBS #-}

openBoundUDPPort :: String -> Int -> IO Socket
openBoundUDPPort uri port = do
  s <- getUDPSocket
  bindAddr <- inet_addr uri
  let a = SockAddrInet (toEnum port) bindAddr
  bindSocket s a
  return s

pingUDPPort :: Socket -> SockAddr -> IO ()
pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return ()
Erlang
-module(ssh_cli).

-behaviour(ssh_channel).

-include("ssh.hrl").
%% backwards compatibility
-export([listen/1, listen/2, listen/3, listen/4, stop/1]).

%% state
-record(state, {
    cm,
    channel
   }).

test(Foo)->Foo.

init([Shell, Exec]) ->
    {ok, #state{shell = Shell, exec = Exec}};
init([Shell]) ->
    false = not true,
    io:format("Hello, \"~p!~n", [atom_to_list('World')]),
    {ok, #state{shell = Shell}}.

concat([Single]) -> Single;
concat(RList) ->
    EpsilonFree = lists:filter(
        fun (Element) ->
            case Element of
                epsilon -> false;
                _ -> true
            end
        end,
        RList),
    case EpsilonFree of
        [Single] -> Single;
        Other -> {concat, Other}
    end.

union_dot_union({union, _}=U1, {union, _}=U2) ->
    union(lists:flatten(
        lists:map(
            fun (X1) ->
                lists:map(
                    fun (X2) ->
                        concat([X1, X2])
                    end,
                    union_to_list(U2)
                )
            end,
            union_to_list(U1)
        ))).
Erlang REPL
1> Str = "abcd".
"abcd"
2> L = test:length(Str).
4
3> Descriptor = {L, list_to_atom(Str)}.
{4,abcd}
4> L.
4
5> b().
Descriptor = {4,abcd}
L = 4
Str = "abcd"
ok
6> f(L).
ok
7> b().
Descriptor = {4,abcd}
Str = "abcd"
ok
8> {L, _} = Descriptor.
{4,abcd}
9> L.
4
10> 2#101.
5
11> 1.85e+3.
1850
Rust
use std;

import std::io;
export fac, test1;

123;                               // type int
123u;                              // type uint
123_u;                             // type uint
0xff00;                            // type int
0xff_u8;                           // type u8
0b1111_1111_1001_0000_i32;         // type i32
123.0;                             // type float
0.1;                               // type float
3f;                                // type float
0.1f32;                            // type f32
12E+99_f64;                        // type f64

/* Factorial */
fn fac(n: int) -> int {
    let s: str = "This is
a multi-line string.

It ends with an unescaped '\"'.";
    let c: char = 'Ф';

    let result = 1, i = 1;
    while i <= n { // No parens around the condition
        result *= i;
        i += 1;
    }
    ret result;
}

pure fn pure_length<T>(ls: list<T>) -> uint { /* ... */ }

type t = map::hashtbl<int,str>;
let x = id::<int>(10);

// Define some modules.
#[path = "foo.rs"]
mod foo;

iface seq<T> {
    fn len() -> uint;
}

impl <T> of seq<T> for [T] {
    fn len() -> uint { vec::len(self) }
    fn iter(b: fn(T)) {
        for elt in self { b(elt); }
    }
}

enum list<T> {
    nil;
    cons(T, @list<T>);
}

let a: list<int> = cons(7, @cons(13, @nil));
Matlab
n = 20; % number of points
points = [random('unid', 100, n, 1), random('unid', 100, n, 1)];
len = zeros(1, n - 1);
points = sortrows(points);
%% Initial set of points
plot(points(:,1),points(:,2));
for i = 1: n-1
    len(i) = points(i + 1, 1) - points(i, 1);
end
while(max(len) > 2 * min(len))
    [d, i] = max(len);
    k = on_margin(points, i, d, -1);
    m = on_margin(points, i + 1, d, 1);
    xm = 0; ym = 0;
%% New point
    if(i == 1 || i + 1 == n)
        xm = mean(points([i,i+1],1))
        ym = mean(points([i,i+1],2))
    else
        [xm, ym] = dlg1(points([k, i, i + 1, m], 1), ...
            points([k, i, i + 1, m], 2))
    end

    points = [ points(1:i, :); [xm, ym]; points(i + 1:end, :)];
end

function [net] = get_fit_network(inputs, targets)
    % Create Network
    numHiddenNeurons = 20;  % Adjust as desired
    net = newfit(inputs,targets,numHiddenNeurons);
    net.trainParam.goal = 0.01;
    net.trainParam.epochs = 1000;
    % Train and Apply Network
    [net,tr] = train(net,inputs,targets);
end

foo_matrix = [1, 2, 3; 4, 5, 6]''';
foo_cell = {1, 2, 3; 4, 5, 6}''.'.';
R
library(ggplot2)

centre <- function(x, type, ...) {
  switch(type,
         mean = mean(x),
         median = median(x),
         trimmed = mean(x, trim = .1))
}

myVar1
myVar.2
data$x
foo "bar" baz
# test "test"
"test # test"

(123) (1) (10) (0.1) (.2) (1e-7)
(1.2e+7) (2e) (3e+10) (0x0) (0xa)
(0xabcdef1234567890) (123L) (1L)
(0x10L) (10000000L) (1e6L) (1.1L)
(1e-3L) (4123.381E-10i)
(3.) (3.E10) # BUG: .E10 should be part of number

# Numbers in some different contexts
1L
0x40
.234
3.
1L + 30
plot(cars, xlim=20)
plot(cars, xlim=0x20)
foo<-30
my.data.3 <- read() # not a number
c(1,2,3)
1%%2

"this is a quote that spans
multiple lines
\"

is this still a quote? it should be.
# even still!

" # now we're done.

'same for
single quotes #'

# keywords
NULL, NA, TRUE, FALSE, Inf, NaN, NA_integer_,
NA_real_, NA_character_, NA_complex_, function,
while, repeat, for, if, in, else, next, break,
..., ..1, ..2

# not keywords
the quick brown fox jumped over the lazy dogs
null na true false inf nan na_integer_ na_real_
na_character_ na_complex_ Function While Repeat
For If In Else Next Break .. .... "NULL" `NULL` 'NULL'

# operators
+, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~,
->, <-, <<-, $, :, ::

# infix operator
foo %union% bar
%"test"%
`"test"`

Mizar
::: ## Lambda calculus

environ

  vocabularies LAMBDA,
      NUMBERS,
      NAT_1, XBOOLE_0, SUBSET_1, FINSEQ_1, XXREAL_0, CARD_1,
      ARYTM_1, ARYTM_3, TARSKI, RELAT_1, ORDINAL4, FUNCOP_1;

  :: etc...

begin

reserve D for DecoratedTree,
        p,q,r for FinSequence of NAT,
        x for set;

definition
  let D;

  attr D is LambdaTerm-like means
    (dom D qua Tree) is finite &
::>                          *143,306
    for r st r in dom D holds
      r is FinSequence of {0,1} &
      r^<*0*> in dom D implies D.r = 0;
end;

registration
  cluster LambdaTerm-like for DecoratedTree of NAT;
  existence;
::>       *4
end;

definition
  mode LambdaTerm is LambdaTerm-like DecoratedTree of NAT;
end;

::: Then we extend this ordinary one-step beta reduction, that is,
:::  any subterm is also allowed to reduce.
definition
  let M,N;

  pred M beta N means
    ex p st
      M|p beta_shallow N|p &
      for q st not p is_a_prefix_of q holds
        [r,x] in M iff [r,x] in N;
end;

theorem Th4:
  ProperPrefixes (v^<*x*>) = ProperPrefixes v \/ {v}
proof
  thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \/ {v}
  proof
    let y;
    assume y in ProperPrefixes (v^<*x*>);
    then consider v1 such that
A1: y = v1 and
A2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2;
 v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9;
then
 v1 is_a_proper_prefix_of v or v1 in {v} by TARSKI:def 1,XBOOLE_0:def 8;
then  y in ProperPrefixes v or y in {v} by A1,TREES_1:def 2;
    hence thesis by XBOOLE_0:def 3;
  end;
  let y;
  assume y in ProperPrefixes v \/ {v};
then A3: y in ProperPrefixes v or y in {v} by XBOOLE_0:def 3;
A4: now
    assume y in ProperPrefixes v;
    then consider v1 such that
A5: y = v1 and
A6: v1 is_a_proper_prefix_of v by TREES_1:def 2;
 v is_a_prefix_of v^<*x*> by TREES_1:1;
then  v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58;
    hence thesis by A5,TREES_1:def 2;
  end;
 v^{} = v by FINSEQ_1:34;
  then
 v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1;
then  v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8;
then  y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>)
  by A3,TARSKI:def 1,TREES_1:def 2;
  hence thesis by A4;
end;

Special tests

Explicit Python highlighting
for x in [1, 2, 3]:
  count(x)
Language set on <pre>
for x in [1, 2, 3]:
  count(x)
HTML5-style language class (language-python)
for x in [1, 2, 3]:
  count(x)
Replacing TAB with 4 spaces
for x in [1, 2, 3]:
	count(x)
Custom markup
<div id="contents">
  <p>Hello, World!Goodbye, cruel world!
</div>
Custom markup + TAB replacement
for x in [1, 2, 3]:
	count(x)
	if x == 3:
		count(x + 1)
Non-pre container
for x in [1, 2, 3]:
  count(x)
Disabled highlighting
<div id="contents">
  <p>Hello, World!
</div>
Non-code <pre>
Computer output
highlight.js-7.4/src/export.html0000644000175000017500000000754212234266276016344 0ustar boutilboutil Highlited code export
Write a code snippet Get HTML to paste anywhere (for actual styles and colors see sample.css)
Export script: Vladimir Gubarkov
Highlighting: highlight.js
highlight.js-7.4/src/languages/0000755000175000017500000000000012234266276016073 5ustar boutilboutilhighlight.js-7.4/src/languages/brainfuck.js0000644000175000017500000000104212234266276020372 0ustar boutilboutil/* Language: Brainfuck Author: Evgeny Stepanischev */ function(hljs){ return { contains: [ { className: 'comment', begin: '[^\\[\\]\\.,\\+\\-<> \r\n]', excludeEnd: true, end: '[\\[\\]\\.,\\+\\-<> \r\n]', relevance: 0 }, { className: 'title', begin: '[\\[\\]]', relevance: 0 }, { className: 'string', begin: '[\\.,]' }, { className: 'literal', begin: '[\\+\\-]' } ] }; } highlight.js-7.4/src/languages/markdown.js0000644000175000017500000000324512234266276020257 0ustar boutilboutil/* Language: Markdown Requires: xml.js Author: John Crepezzi Website: http://seejohncode.com/ */ function(hljs) { return { contains: [ // highlight headers { className: 'header', begin: '^#{1,3}', end: '$' }, { className: 'header', begin: '^.+?\\n[=-]{2,}$' }, // inline html { begin: '<', end: '>', subLanguage: 'xml', relevance: 0 }, // lists (indicators only) { className: 'bullet', begin: '^([*+-]|(\\d+\\.))\\s+' }, // strong segments { className: 'strong', begin: '[*_]{2}.+?[*_]{2}' }, // emphasis segments { className: 'emphasis', begin: '\\*.+?\\*' }, { className: 'emphasis', begin: '_.+?_', relevance: 0 }, // blockquotes { className: 'blockquote', begin: '^>\\s+', end: '$' }, // code snippets { className: 'code', begin: '`.+?`' }, { className: 'code', begin: '^ ', end: '$', relevance: 0 }, // horizontal rules { className: 'horizontal_rule', begin: '^-{3,}', end: '$' }, // using links - title and link { begin: '\\[.+?\\]\\(.+?\\)', returnBegin: true, contains: [ { className: 'link_label', begin: '\\[.+\\]' }, { className: 'link_url', begin: '\\(', end: '\\)', excludeBegin: true, excludeEnd: true } ] } ] }; } highlight.js-7.4/src/languages/haml.js0000644000175000017500000000665012234266276017361 0ustar boutilboutil/* Language: Haml Requires: ruby.js Author: Dan Allen Website: http://google.com/profiles/dan.j.allen */ // TODO support filter tags like :javascript, support inline HTML function(hljs) { return { case_insensitive: true, contains: [ { className: 'doctype', begin: '^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$', relevance: 10 }, { className: 'comment', // FIXME these comments should be allowed to span indented lines begin: '^\\s*(-#|/).*$', relevance: 0 }, { begin: '^\\s*-(?!#)', starts: { end: '\\n', subLanguage: 'ruby' }, relevance: 0 }, { className: 'tag', begin: '^\\s*%', contains: [ { className: 'title', begin: '\\w+', relevance: 0 }, { className: 'value', begin: '[#\\.]\\w+', relevance: 0 }, { begin: '{\\s*', end: '\\s*}', excludeEnd: true, contains: [ { //className: 'attribute', begin: ':\\w+\\s*=>', end: ',\\s+', returnBegin: true, endsWithParent: true, relevance: 0, contains: [ { className: 'symbol', begin: ':\\w+', relevance: 0 }, { className: 'string', begin: '"', end: '"', relevance: 0 }, { className: 'string', begin: '\'', end: '\'', relevance: 0 }, { begin: '\\w+', relevance: 0 } ] }, ], relevance: 0 }, { begin: '\\(\\s*', end: '\\s*\\)', excludeEnd: true, contains: [ { //className: 'attribute', begin: '\\w+\\s*=', end: '\\s+', returnBegin: true, endsWithParent: true, relevance: 0, contains: [ { className: 'attribute', begin: '\\w+', relevance: 0 }, { className: 'string', begin: '"', end: '"', relevance: 0 }, { className: 'string', begin: '\'', end: '\'', relevance: 0 }, { begin: '\\w+', relevance: 0 } ] }, ], relevance: 0 } ], relevance: 10 }, { className: 'bullet', begin: '^\\s*[=~]\\s*', relevance: 0 }, { begin: '#{', starts: { end: '}', subLanguage: 'ruby' }, relevance: 0 } ] }; } highlight.js-7.4/src/languages/java.js0000644000175000017500000000251612234266276017356 0ustar boutilboutil/* Language: Java Author: Vsevolod Solovyov */ function(hljs) { return { keywords: 'false synchronized int abstract float private char boolean static null if const ' + 'for true while long throw strictfp finally protected import native final return void ' + 'enum else break transient new catch instanceof byte super volatile case assert short ' + 'package default double public try this switch continue throws', contains: [ { className: 'javadoc', begin: '/\\*\\*', end: '\\*/', contains: [{ className: 'javadoctag', begin: '(^|\\s)@[A-Za-z]+' }], relevance: 10 }, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, { className: 'class', beginWithKeyword: true, end: '{', keywords: 'class interface', excludeEnd: true, illegal: ':', contains: [ { beginWithKeyword: true, keywords: 'extends implements', relevance: 10 }, { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE } ] }, hljs.C_NUMBER_MODE, { className: 'annotation', begin: '@[A-Za-z]+' } ] }; } highlight.js-7.4/src/languages/php.js0000644000175000017500000000605612234266276017227 0ustar boutilboutil/* Language: PHP Author: Victor Karamzin Contributors: Evgeny Stepanischev , Ivan Sagalaev */ function(hljs) { var VARIABLE = { className: 'variable', begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' }; var STRINGS = [ hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}), { className: 'string', begin: 'b"', end: '"', contains: [hljs.BACKSLASH_ESCAPE] }, { className: 'string', begin: 'b\'', end: '\'', contains: [hljs.BACKSLASH_ESCAPE] } ]; var NUMBERS = [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]; var TITLE = { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE }; return { case_insensitive: true, keywords: 'and include_once list abstract global private echo interface as static endswitch ' + 'array null if endwhile or const for endforeach self var while isset public ' + 'protected exit foreach throw elseif include __FILE__ empty require_once do xor ' + 'return implements parent clone use __CLASS__ __LINE__ else break print eval new ' + 'catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ ' + 'enddeclare final try this switch continue endfor endif declare unset true false ' + 'namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler', contains: [ hljs.C_LINE_COMMENT_MODE, hljs.HASH_COMMENT_MODE, { className: 'comment', begin: '/\\*', end: '\\*/', contains: [{ className: 'phpdoc', begin: '\\s@[A-Za-z]+' }] }, { className: 'comment', excludeBegin: true, begin: '__halt_compiler.+?;', endsWithParent: true }, { className: 'string', begin: '<<<[\'"]?\\w+[\'"]?$', end: '^\\w+;', contains: [hljs.BACKSLASH_ESCAPE] }, { className: 'preprocessor', begin: '<\\?php', relevance: 10 }, { className: 'preprocessor', begin: '\\?>' }, VARIABLE, { className: 'function', beginWithKeyword: true, end: '{', keywords: 'function', illegal: '\\$|\\[|%', contains: [ TITLE, { className: 'params', begin: '\\(', end: '\\)', contains: [ 'self', VARIABLE, hljs.C_BLOCK_COMMENT_MODE ].concat(STRINGS).concat(NUMBERS) } ] }, { className: 'class', beginWithKeyword: true, end: '{', keywords: 'class', illegal: '[:\\(\\$]', contains: [ { beginWithKeyword: true, endsWithParent: true, keywords: 'extends', contains: [TITLE] }, TITLE ] }, { begin: '=>' // No markup, just a relevance booster } ].concat(STRINGS).concat(NUMBERS) }; } highlight.js-7.4/src/languages/diff.js0000644000175000017500000000237312234266276017346 0ustar boutilboutil/* Language: Diff Description: Unified and context diff Author: Vasily Polovnyov */ function(hljs) { return { contains: [ { className: 'chunk', begin: '^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$', relevance: 10 }, { className: 'chunk', begin: '^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$', relevance: 10 }, { className: 'chunk', begin: '^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$', relevance: 10 }, { className: 'header', begin: 'Index: ', end: '$' }, { className: 'header', begin: '=====', end: '=====$' }, { className: 'header', begin: '^\\-\\-\\-', end: '$' }, { className: 'header', begin: '^\\*{3} ', end: '$' }, { className: 'header', begin: '^\\+\\+\\+', end: '$' }, { className: 'header', begin: '\\*{5}', end: '\\*{5}$' }, { className: 'addition', begin: '^\\+', end: '$' }, { className: 'deletion', begin: '^\\-', end: '$' }, { className: 'change', begin: '^\\!', end: '$' } ] }; } highlight.js-7.4/src/languages/rust.js0000644000175000017500000000264212234266276017432 0ustar boutilboutil/* Language: Rust Author: Andrey Vlasovskikh */ function(hljs) { var TITLE = { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE }; var NUMBER = { className: 'number', begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)', relevance: 0 }; var KEYWORDS = 'assert bool break char check claim comm const cont copy dir do drop ' + 'else enum extern export f32 f64 fail false float fn for i16 i32 i64 i8 ' + 'if impl int let log loop match mod move mut priv pub pure ref return ' + 'self static str struct task true trait type u16 u32 u64 u8 uint unsafe ' + 'use vec while'; return { keywords: KEYWORDS, illegal: ' */ function(hljs) { return { illegal: '\\S', contains: [ { className: 'status', begin: '^HTTP/[0-9\\.]+', end: '$', contains: [{className: 'number', begin: '\\b\\d{3}\\b'}] }, { className: 'request', begin: '^[A-Z]+ (.*?) HTTP/[0-9\\.]+$', returnBegin: true, end: '$', contains: [ { className: 'string', begin: ' ', end: ' ', excludeBegin: true, excludeEnd: true } ] }, { className: 'attribute', begin: '^\\w', end: ': ', excludeEnd: true, illegal: '\\n|\\s|=', starts: {className: 'string', end: '$'} }, { begin: '\\n\\n', starts: {subLanguage: '', endsWithParent: true} } ] }; } highlight.js-7.4/src/languages/rsl.js0000644000175000017500000000276712234266276017245 0ustar boutilboutil/* Language: RenderMan RSL Author: Konstantin Evdokimenko Contributors: Shuen-Huei Guan */ function(hljs) { return { keywords: { keyword: 'float color point normal vector matrix while for if do return else break extern continue', built_in: 'abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise ' + 'clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp ' + 'faceforward filterstep floor format fresnel incident length lightsource log match ' + 'max min mod noise normalize ntransform opposite option phong pnoise pow printf ' + 'ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp ' + 'setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan ' + 'texture textureinfo trace transform vtransform xcomp ycomp zcomp' }, illegal: ' Contributors: Ivan Sagalaev */ function(hljs) { var VARS = [ { className: 'variable', begin: '\\$\\d+' }, { className: 'variable', begin: '\\${', end: '}' }, { className: 'variable', begin: '[\\$\\@]' + hljs.UNDERSCORE_IDENT_RE } ]; var DEFAULT = { endsWithParent: true, lexems: '[a-z/_]+', keywords: { built_in: 'on off yes no true false none blocked debug info notice warn error crit ' + 'select break last permanent redirect kqueue rtsig epoll poll /dev/poll' }, relevance: 0, illegal: '=>', contains: [ hljs.HASH_COMMENT_MODE, { className: 'string', begin: '"', end: '"', contains: [hljs.BACKSLASH_ESCAPE].concat(VARS), relevance: 0 }, { className: 'string', begin: "'", end: "'", contains: [hljs.BACKSLASH_ESCAPE].concat(VARS), relevance: 0 }, { className: 'url', begin: '([a-z]+):/', end: '\\s', endsWithParent: true, excludeEnd: true }, { className: 'regexp', begin: "\\s\\^", end: "\\s|{|;", returnEnd: true, contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) }, // regexp locations (~, ~*) { className: 'regexp', begin: "~\\*?\\s+", end: "\\s|{|;", returnEnd: true, contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) }, // *.example.com { className: 'regexp', begin: "\\*(\\.[a-z\\-]+)+", contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) }, // sub.example.* { className: 'regexp', begin: "([a-z\\-]+\\.)+\\*", contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) }, // IP { className: 'number', begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b' }, // units { className: 'number', begin: '\\b\\d+[kKmMgGdshdwy]*\\b', relevance: 0 } ].concat(VARS) }; return { contains: [ hljs.HASH_COMMENT_MODE, { begin: hljs.UNDERSCORE_IDENT_RE + '\\s', end: ';|{', returnBegin: true, contains: [ { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE, starts: DEFAULT } ], relevance: 0 } ], illegal: '[^\\s\\}]' }; } highlight.js-7.4/src/languages/mel.js0000644000175000017500000004525512234266276017221 0ustar boutilboutil/* Language: MEL Description: Maya Embedded Language Author: Shuen-Huei Guan */ function(hljs) { return { keywords: 'int float string vector matrix if else switch case default while do for in break ' + 'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' + 'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' + 'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' + 'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' + 'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' + 'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' + 'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' + 'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' + 'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' + 'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' + 'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' + 'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' + 'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' + 'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' + 'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' + 'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' + 'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' + 'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' + 'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' + 'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' + 'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' + 'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' + 'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' + 'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' + 'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' + 'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' + 'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' + 'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' + 'constrainValue constructionHistory container containsMultibyte contextInfo control ' + 'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' + 'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' + 'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' + 'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' + 'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' + 'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' + 'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' + 'currentCtx currentTime currentTimeCtx currentUnit currentUnit curve curveAddPtCtx ' + 'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' + 'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' + 'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' + 'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' + 'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' + 'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' + 'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' + 'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' + 'displaySmoothness displayStats displayString displaySurface distanceDimContext ' + 'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' + 'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' + 'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' + 'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' + 'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' + 'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' + 'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' + 'equivalent equivalentTol erf error eval eval evalDeferred evalEcho event ' + 'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' + 'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' + 'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' + 'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' + 'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' + 'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' + 'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' + 'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' + 'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' + 'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' + 'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' + 'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' + 'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' + 'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' + 'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' + 'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' + 'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' + 'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' + 'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' + 'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' + 'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' + 'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' + 'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' + 'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' + 'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' + 'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' + 'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' + 'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' + 'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' + 'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' + 'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' + 'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' + 'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' + 'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' + 'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' + 'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' + 'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' + 'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' + 'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' + 'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' + 'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' + 'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' + 'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' + 'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' + 'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' + 'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' + 'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' + 'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' + 'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' + 'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' + 'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' + 'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' + 'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' + 'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' + 'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' + 'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' + 'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' + 'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' + 'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' + 'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' + 'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' + 'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' + 'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' + 'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' + 'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' + 'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' + 'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' + 'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' + 'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' + 'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' + 'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' + 'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' + 'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' + 'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' + 'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' + 'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' + 'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' + 'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' + 'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' + 'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' + 'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' + 'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' + 'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' + 'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' + 'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' + 'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' + 'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' + 'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' + 'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' + 'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' + 'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' + 'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' + 'removePanelCategory rename renameAttr renameSelectionList renameUI render ' + 'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' + 'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' + 'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' + 'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' + 'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' + 'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' + 'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' + 'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' + 'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' + 'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' + 'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' + 'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' + 'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' + 'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' + 'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' + 'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' + 'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' + 'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' + 'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' + 'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' + 'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' + 'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' + 'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' + 'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' + 'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' + 'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' + 'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' + 'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' + 'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' + 'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' + 'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' + 'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' + 'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' + 'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' + 'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' + 'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' + 'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' + 'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' + 'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' + 'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' + 'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' + 'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' + 'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' + 'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' + 'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' + 'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' + 'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' + 'trace track trackCtx transferAttributes transformCompare transformLimits translator ' + 'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' + 'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' + 'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' + 'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' + 'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' + 'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' + 'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform', illegal: ' Contributors: Angel G. Olloqui */ function(hljs) { var OBJC_KEYWORDS = { keyword: 'int float while private char catch export sizeof typedef const struct for union ' + 'unsigned long volatile static protected bool mutable if public do return goto void ' + 'enum else break extern asm case short default double throw register explicit ' + 'signed typename try this switch continue wchar_t inline readonly assign property ' + 'self synchronized end synthesize id optional required ' + 'nonatomic super unichar finally dynamic IBOutlet IBAction selector strong ' + 'weak readonly', literal: 'false true FALSE TRUE nil YES NO NULL', built_in: 'NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView ' + 'UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread ' + 'UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool ' + 'UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray ' + 'NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController ' + 'UINavigationBar UINavigationController UITabBarController UIPopoverController ' + 'UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController ' + 'NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor ' + 'UIFont UIApplication NSNotFound NSNotificationCenter NSNotification ' + 'UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar ' + 'NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection ' + 'UIInterfaceOrientation MPMoviePlayerController dispatch_once_t ' + 'dispatch_queue_t dispatch_sync dispatch_async dispatch_once' }; return { keywords: OBJC_KEYWORDS, illegal: '' } ] }, { className: 'preprocessor', begin: '#', end: '$' }, { className: 'class', beginWithKeyword: true, end: '({|$)', keywords: 'interface class protocol implementation', contains: [{ className: 'id', begin: hljs.UNDERSCORE_IDENT_RE } ] }, { className: 'variable', begin: '\\.'+hljs.UNDERSCORE_IDENT_RE, relevance: 0 } ] }; } highlight.js-7.4/src/languages/python.js0000644000175000017500000000413112234266276017751 0ustar boutilboutil/* Language: Python */ function(hljs) { var PROMPT = { className: 'prompt', begin: /^(>>>|\.\.\.) / } var STRINGS = [ { className: 'string', begin: /(u|b)?r?'''/, end: /'''/, contains: [PROMPT], relevance: 10 }, { className: 'string', begin: /(u|b)?r?"""/, end: /"""/, contains: [PROMPT], relevance: 10 }, { className: 'string', begin: /(u|r|ur)'/, end: /'/, contains: [hljs.BACKSLASH_ESCAPE], relevance: 10 }, { className: 'string', begin: /(u|r|ur)"/, end: /"/, contains: [hljs.BACKSLASH_ESCAPE], relevance: 10 }, { className: 'string', begin: /(b|br)'/, end: /'/, contains: [hljs.BACKSLASH_ESCAPE] }, { className: 'string', begin: /(b|br)"/, end: /"/, contains: [hljs.BACKSLASH_ESCAPE] } ].concat([ hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE ]); var TITLE = { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE }; var PARAMS = { className: 'params', begin: /\(/, end: /\)/, contains: ['self', hljs.C_NUMBER_MODE, PROMPT].concat(STRINGS) }; var FUNC_CLASS_PROTO = { beginWithKeyword: true, end: /:/, illegal: /[${=;\n]/, contains: [TITLE, PARAMS], relevance: 10 }; return { keywords: { keyword: 'and elif is global as in if from raise for except finally print import pass return ' + 'exec else break not with class assert yield try while continue del or def lambda ' + 'nonlocal|10', built_in: 'None True False Ellipsis NotImplemented' }, illegal: /(<\/|->|\?)/, contains: STRINGS.concat([ PROMPT, hljs.HASH_COMMENT_MODE, hljs.inherit(FUNC_CLASS_PROTO, {className: 'function', keywords: 'def'}), hljs.inherit(FUNC_CLASS_PROTO, {className: 'class', keywords: 'class'}), hljs.C_NUMBER_MODE, { className: 'decorator', begin: /@/, end: /$/ }, { begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3 } ]) }; } highlight.js-7.4/src/languages/profile.js0000644000175000017500000000222212234266276020067 0ustar boutilboutil/* Language: Python profile Description: Python profiler results Author: Brian Beck */ function(hljs) { return { contains: [ hljs.C_NUMBER_MODE, { className: 'built_in', begin: '{', end: '}$', excludeBegin: true, excludeEnd: true, contains: [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE], relevance: 0 }, { className: 'filename', begin: '[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}', end: ':', excludeEnd: true }, { className: 'header', begin: '(ncalls|tottime|cumtime)', end: '$', keywords: 'ncalls tottime|10 cumtime|10 filename', relevance: 10 }, { className: 'summary', begin: 'function calls', end: '$', contains: [hljs.C_NUMBER_MODE], relevance: 10 }, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, { className: 'function', begin: '\\(', end: '\\)$', contains: [{ className: 'title', begin: hljs.UNDERSCORE_IDENT_RE, relevance: 0 }], relevance: 0 } ] }; } highlight.js-7.4/src/languages/matlab.js0000644000175000017500000000550412234266276017675 0ustar boutilboutil/* Language: Matlab Author: Denis Bardadym Contributors: Eugene Nizhibitsky */ function(hljs) { var COMMON_CONTAINS = [ hljs.C_NUMBER_MODE, { className: 'string', begin: '\'', end: '\'', contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}], relevance: 0 } ]; return { keywords: { keyword: 'break case catch classdef continue else elseif end enumerated events for function ' + 'global if methods otherwise parfor persistent properties return spmd switch try while', built_in: 'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan ' + 'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot ' + 'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog ' + 'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal ' + 'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli ' + 'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma ' + 'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms ' + 'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones ' + 'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ' + 'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril ' + 'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute ' + 'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan ' + 'isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal ' + 'rosser toeplitz vander wilkinson' }, illegal: '(//|"|#|/\\*|\\s+/\\w+)', contains: [ { className: 'function', beginWithKeyword: true, end: '$', keywords: 'function', contains: [ { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE }, { className: 'params', begin: '\\(', end: '\\)' }, { className: 'params', begin: '\\[', end: '\\]' } ] }, { className: 'transposed_variable', begin: '[a-zA-Z_][a-zA-Z_0-9]*(\'+[\\.\']*|[\\.\']+)', end: '' }, { className: 'matrix', begin: '\\[', end: '\\]\'*[\\.\']*', contains: COMMON_CONTAINS }, { className: 'cell', begin: '\\{', end: '\\}\'*[\\.\']*', contains: COMMON_CONTAINS }, { className: 'comment', begin: '\\%', end: '$' } ].concat(COMMON_CONTAINS) }; } highlight.js-7.4/src/languages/actionscript.js0000644000175000017500000000431512234266276021136 0ustar boutilboutil/* Language: ActionScript Author: Alexander Myadzel */ function(hljs) { var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*'; var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)'; var AS3_REST_ARG_MODE = { className: 'rest_arg', begin: '[.]{3}', end: IDENT_RE, relevance: 10 }; var TITLE_MODE = {className: 'title', begin: IDENT_RE}; return { keywords: { keyword: 'as break case catch class const continue default delete do dynamic each ' + 'else extends final finally for function get if implements import in include ' + 'instanceof interface internal is namespace native new override package private ' + 'protected public return set static super switch this throw try typeof use var void ' + 'while with', literal: 'true false null undefined' }, contains: [ hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.C_NUMBER_MODE, { className: 'package', beginWithKeyword: true, end: '{', keywords: 'package', contains: [TITLE_MODE] }, { className: 'class', beginWithKeyword: true, end: '{', keywords: 'class interface', contains: [ { beginWithKeyword: true, keywords: 'extends implements' }, TITLE_MODE ] }, { className: 'preprocessor', beginWithKeyword: true, end: ';', keywords: 'import include' }, { className: 'function', beginWithKeyword: true, end: '[{;]', keywords: 'function', illegal: '\\S', contains: [ TITLE_MODE, { className: 'params', begin: '\\(', end: '\\)', contains: [ hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, AS3_REST_ARG_MODE ] }, { className: 'type', begin: ':', end: IDENT_FUNC_RETURN_TYPE_RE, relevance: 10 } ] } ] }; } highlight.js-7.4/src/languages/tex.js0000644000175000017500000000237312234266276017236 0ustar boutilboutil/* Language: TeX Author: Vladimir Moskva Website: http://fulc.ru/ */ function(hljs) { var COMMAND1 = { className: 'command', begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?' }; var COMMAND2 = { className: 'command', begin: '\\\\[^a-zA-Zа-яА-я0-9]' }; var SPECIAL = { className: 'special', begin: '[{}\\[\\]\\&#~]', relevance: 0 }; return { contains: [ { // parameter begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', returnBegin: true, contains: [ COMMAND1, COMMAND2, { className: 'number', begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', excludeBegin: true } ], relevance: 10 }, COMMAND1, COMMAND2, SPECIAL, { className: 'formula', begin: '\\$\\$', end: '\\$\\$', contains: [COMMAND1, COMMAND2, SPECIAL], relevance: 0 }, { className: 'formula', begin: '\\$', end: '\\$', contains: [COMMAND1, COMMAND2, SPECIAL], relevance: 0 }, { className: 'comment', begin: '%', end: '$', relevance: 0 } ] }; } highlight.js-7.4/src/languages/scss.js0000644000175000017500000001670012234266276017410 0ustar boutilboutil/* Language: SCSS Author: Kurt Emch */ function(hljs) { var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*'; var FUNCTION = { className: 'function', begin: IDENT_RE + '\\(', end: '\\)', contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] }; var HEXCOLOR = { className: 'hexcolor', begin: '#[0-9A-Fa-f]+' }; var DEF_INTERNALS = { className: 'attribute', begin: '[A-Z\\_\\.\\-]+', end: ':', excludeEnd: true, illegal: '[^\\s]', starts: { className: 'value', endsWithParent: true, excludeEnd: true, contains: [ FUNCTION, HEXCOLOR, hljs.NUMBER_MODE, hljs.QUOTE_STRING_MODE, hljs.APOS_STRING_MODE, hljs.C_BLOCK_COMMENT_MODE, { className: 'important', begin: '!important' } ] } }; return { case_insensitive: true, illegal: '[=/|\']', contains: [ hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, { className: 'function', begin: IDENT_RE + '\\(', end: '\\)', contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] }, { className: 'id', begin: '\\#[A-Za-z0-9_-]+', relevance: 0 }, { className: 'class', begin: '\\.[A-Za-z0-9_-]+', relevance: 0 }, { className: 'attr_selector', begin: '\\[', end: '\\]', illegal: '$' }, { className: 'tag', // begin: IDENT_RE, end: '[,|\\s]' begin: '\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b', relevance: 0 }, { className: 'pseudo', begin: ':(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)' }, { className: 'pseudo', begin: '::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)' }, { className: 'attribute', begin: '\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b', illegal: '[^\\s]' }, { className: 'value', begin: '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b' }, { className: 'value', begin: ':', end: ';', contains: [ HEXCOLOR, hljs.NUMBER_MODE, hljs.QUOTE_STRING_MODE, hljs.APOS_STRING_MODE, { className: 'important', begin: '!important' } ] }, { className: 'at_rule', begin: '@', end: '[{;]', keywords: 'mixin include for extend charset import media page font-face namespace', contains: [ FUNCTION, hljs.QUOTE_STRING_MODE, hljs.APOS_STRING_MODE, HEXCOLOR, hljs.NUMBER_MODE, { className: 'preprocessor', begin: '\\s[A-Za-z0-9_.-]+', relevance: 0 } ] } ] }; } highlight.js-7.4/src/languages/cmake.js0000644000175000017500000000360612234266276017516 0ustar boutilboutil/* Language: CMake Description: CMake is an open-source cross-platform system for build automation. Author: Igor Kalnitsky Website: http://kalnitsky.org.ua/ */ function(hljs) { return { case_insensitive: true, keywords: 'add_custom_command add_custom_target add_definitions add_dependencies ' + 'add_executable add_library add_subdirectory add_test aux_source_directory ' + 'break build_command cmake_minimum_required cmake_policy configure_file ' + 'create_test_sourcelist define_property else elseif enable_language enable_testing ' + 'endforeach endfunction endif endmacro endwhile execute_process export find_file ' + 'find_library find_package find_path find_program fltk_wrap_ui foreach function ' + 'get_cmake_property get_directory_property get_filename_component get_property ' + 'get_source_file_property get_target_property get_test_property if include ' + 'include_directories include_external_msproject include_regular_expression install ' + 'link_directories load_cache load_command macro mark_as_advanced message option ' + 'output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return ' + 'separate_arguments set set_directory_properties set_property ' + 'set_source_files_properties set_target_properties set_tests_properties site_name ' + 'source_group string target_link_libraries try_compile try_run unset variable_watch ' + 'while build_name exec_program export_library_dependencies install_files ' + 'install_programs install_targets link_libraries make_directory remove subdir_depends ' + 'subdirs use_mangled_mesa utility_source variable_requires write_file', contains: [ { className: 'envvar', begin: '\\${', end: '}' }, hljs.HASH_COMMENT_MODE, hljs.QUOTE_STRING_MODE, hljs.NUMBER_MODE ] }; } highlight.js-7.4/src/languages/mizar.js0000644000175000017500000000161212234266276017553 0ustar boutilboutil/* Language: Mizar Author: Kelley van Evert */ function(hljs) { return { keywords: [ "environ vocabularies notations constructors definitions registrations theorems schemes requirements", "begin end definition registration cluster existence pred func defpred deffunc theorem proof", "let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from", "be being by means equals implies iff redefine define now not or attr is mode suppose per cases set", "thesis contradiction scheme reserve struct", "correctness compatibility coherence symmetry assymetry reflexivity irreflexivity", "connectedness uniqueness commutativity idempotence involutiveness projectivity" ].join(" "), contains: [ { className: "comment", begin: "::", end: "$" } ] }; } highlight.js-7.4/src/languages/coffeescript.js0000755000175000017500000000733012234266276021113 0ustar boutilboutil/* Language: CoffeeScript Author: Dmytrii Nagirniak Contributors: Oleg Efimov , Cédric Néhémie Description: CoffeeScript is a programming language that transcompiles to JavaScript. For info about language see http://coffeescript.org/ */ function(hljs) { var KEYWORDS = { keyword: // JS keywords 'in if for while finally new do return else break catch instanceof throw try this ' + 'switch continue typeof delete debugger super ' + // Coffee keywords 'then unless until loop of by when and or is isnt not', literal: // JS literals 'true false null undefined ' + // Coffee literals 'yes no on off', reserved: 'case default function var void with const let enum export import native ' + '__hasProp __extends __slice __bind __indexOf', built_in: 'npm require console print module exports global window document' }; var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; var TITLE = {className: 'title', begin: JS_IDENT_RE}; var SUBST = { className: 'subst', begin: '#\\{', end: '}', keywords: KEYWORDS, }; var EXPRESSIONS = [ // Numbers hljs.BINARY_NUMBER_MODE, hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end: '(\\s*/)?', relevance: 0}}), // a number tries to eat the following slash to prevent treating it as a regexp // Strings { className: 'string', begin: '\'\'\'', end: '\'\'\'', contains: [hljs.BACKSLASH_ESCAPE] }, { className: 'string', begin: '\'', end: '\'', contains: [hljs.BACKSLASH_ESCAPE], relevance: 0 }, { className: 'string', begin: '"""', end: '"""', contains: [hljs.BACKSLASH_ESCAPE, SUBST] }, { className: 'string', begin: '"', end: '"', contains: [hljs.BACKSLASH_ESCAPE, SUBST], relevance: 0 }, // RegExps { className: 'regexp', begin: '///', end: '///', contains: [hljs.HASH_COMMENT_MODE] }, { className: 'regexp', begin: '//[gim]*', relevance: 0 }, { className: 'regexp', begin: '/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)' // \S is required to parse x / 2 / 3 as two divisions }, { className: 'property', begin: '@' + JS_IDENT_RE }, { begin: '`', end: '`', excludeBegin: true, excludeEnd: true, subLanguage: 'javascript' } ]; SUBST.contains = EXPRESSIONS; return { keywords: KEYWORDS, contains: EXPRESSIONS.concat([ { className: 'comment', begin: '###', end: '###' }, hljs.HASH_COMMENT_MODE, { className: 'function', begin: '(' + JS_IDENT_RE + '\\s*=\\s*)?(\\(.*\\))?\\s*[-=]>', end: '[-=]>', returnBegin: true, contains: [ TITLE, { className: 'params', begin: '\\(', returnBegin: true, /* We need another contained nameless mode to not have every nested pair of parens to be called "params" */ contains: [{ begin: /\(/, end: /\)/, keywords: KEYWORDS, contains: ['self'].concat(EXPRESSIONS) }] } ] }, { className: 'class', beginWithKeyword: true, keywords: 'class', end: '$', illegal: '[:\\[\\]]', contains: [ { beginWithKeyword: true, keywords: 'extends', endsWithParent: true, illegal: ':', contains: [TITLE] }, TITLE ] }, { className: 'attribute', begin: JS_IDENT_RE + ':', end: ':', returnBegin: true, excludeEnd: true } ]) }; } highlight.js-7.4/src/languages/ruby.js0000644000175000017500000001077712234266276017426 0ustar boutilboutil/* Language: Ruby Author: Anton Kovalyov Contributors: Peter Leonov , Vasily Polovnyov , Loren Segal */ function(hljs) { var RUBY_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?'; var RUBY_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?'; var RUBY_KEYWORDS = { keyword: 'and false then defined module in return redo if BEGIN retry end for true self when ' + 'next until do begin unless END rescue nil else break undef not super class case ' + 'require yield alias while ensure elsif or include' }; var YARDOCTAG = { className: 'yardoctag', begin: '@[A-Za-z]+' }; var COMMENTS = [ { className: 'comment', begin: '#', end: '$', contains: [YARDOCTAG] }, { className: 'comment', begin: '^\\=begin', end: '^\\=end', contains: [YARDOCTAG], relevance: 10 }, { className: 'comment', begin: '^__END__', end: '\\n$' } ]; var SUBST = { className: 'subst', begin: '#\\{', end: '}', lexems: RUBY_IDENT_RE, keywords: RUBY_KEYWORDS }; var STR_CONTAINS = [hljs.BACKSLASH_ESCAPE, SUBST]; var STRINGS = [ { className: 'string', begin: '\'', end: '\'', contains: STR_CONTAINS, relevance: 0 }, { className: 'string', begin: '"', end: '"', contains: STR_CONTAINS, relevance: 0 }, { className: 'string', begin: '%[qw]?\\(', end: '\\)', contains: STR_CONTAINS }, { className: 'string', begin: '%[qw]?\\[', end: '\\]', contains: STR_CONTAINS }, { className: 'string', begin: '%[qw]?{', end: '}', contains: STR_CONTAINS }, { className: 'string', begin: '%[qw]?<', end: '>', contains: STR_CONTAINS, relevance: 10 }, { className: 'string', begin: '%[qw]?/', end: '/', contains: STR_CONTAINS, relevance: 10 }, { className: 'string', begin: '%[qw]?%', end: '%', contains: STR_CONTAINS, relevance: 10 }, { className: 'string', begin: '%[qw]?-', end: '-', contains: STR_CONTAINS, relevance: 10 }, { className: 'string', begin: '%[qw]?\\|', end: '\\|', contains: STR_CONTAINS, relevance: 10 } ]; var FUNCTION = { className: 'function', beginWithKeyword: true, end: ' |$|;', keywords: 'def', contains: [ { className: 'title', begin: RUBY_METHOD_RE, lexems: RUBY_IDENT_RE, keywords: RUBY_KEYWORDS }, { className: 'params', begin: '\\(', end: '\\)', lexems: RUBY_IDENT_RE, keywords: RUBY_KEYWORDS } ].concat(COMMENTS) }; var RUBY_DEFAULT_CONTAINS = COMMENTS.concat(STRINGS.concat([ { className: 'class', beginWithKeyword: true, end: '$|;', keywords: 'class module', contains: [ { className: 'title', begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?', relevance: 0 }, { className: 'inheritance', begin: '<\\s*', contains: [{ className: 'parent', begin: '(' + hljs.IDENT_RE + '::)?' + hljs.IDENT_RE }] } ].concat(COMMENTS) }, FUNCTION, { className: 'constant', begin: '(::)?(\\b[A-Z]\\w*(::)?)+', relevance: 0 }, { className: 'symbol', begin: ':', contains: STRINGS.concat([{begin: RUBY_METHOD_RE}]), relevance: 0 }, { className: 'symbol', begin: RUBY_IDENT_RE + ':', relevance: 0 }, { className: 'number', begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', relevance: 0 }, { className: 'number', begin: '\\?\\w' }, { className: 'variable', begin: '(\\$\\W)|((\\$|\\@\\@?)(\\w+))' }, { // regexp container begin: '(' + hljs.RE_STARTERS_RE + ')\\s*', contains: COMMENTS.concat([ { className: 'regexp', begin: '/', end: '/[a-z]*', illegal: '\\n', contains: [hljs.BACKSLASH_ESCAPE, SUBST] } ]), relevance: 0 } ])); SUBST.contains = RUBY_DEFAULT_CONTAINS; FUNCTION.contains[1].contains = RUBY_DEFAULT_CONTAINS; return { lexems: RUBY_IDENT_RE, keywords: RUBY_KEYWORDS, contains: RUBY_DEFAULT_CONTAINS }; } highlight.js-7.4/src/languages/sql.js0000644000175000017500000000603312234266276017232 0ustar boutilboutil/* Language: SQL */ function(hljs) { return { case_insensitive: true, contains: [ { className: 'operator', begin: '(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)', // negative look-ahead here is specifically to prevent stomping on SmallTalk end: ';', endsWithParent: true, keywords: { keyword: 'all partial global month current_timestamp using go revoke smallint ' + 'indicator end-exec disconnect zone with character assertion to add current_user ' + 'usage input local alter match collate real then rollback get read timestamp ' + 'session_user not integer bit unique day minute desc insert execute like ilike|2 ' + 'level decimal drop continue isolation found where constraints domain right ' + 'national some module transaction relative second connect escape close system_user ' + 'for deferred section cast current sqlstate allocate intersect deallocate numeric ' + 'public preserve full goto initially asc no key output collation group by union ' + 'session both last language constraint column of space foreign deferrable prior ' + 'connection unknown action commit view or first into float year primary cascaded ' + 'except restrict set references names table outer open select size are rows from ' + 'prepare distinct leading create only next inner authorization schema ' + 'corresponding option declare precision immediate else timezone_minute external ' + 'varying translation true case exception join hour default double scroll value ' + 'cursor descriptor values dec fetch procedure delete and false int is describe ' + 'char as at in varchar null trailing any absolute current_time end grant ' + 'privileges when cross check write current_date pad begin temporary exec time ' + 'update catalog user sql date on identity timezone_hour natural whenever interval ' + 'work order cascade diagnostics nchar having left call do handler load replace ' + 'truncate start lock show pragma exists number trigger if before after each row', aggregate: 'count sum min max avg' }, contains: [ { className: 'string', begin: '\'', end: '\'', contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}], relevance: 0 }, { className: 'string', begin: '"', end: '"', contains: [hljs.BACKSLASH_ESCAPE, {begin: '""'}], relevance: 0 }, { className: 'string', begin: '`', end: '`', contains: [hljs.BACKSLASH_ESCAPE] }, hljs.C_NUMBER_MODE ] }, hljs.C_BLOCK_COMMENT_MODE, { className: 'comment', begin: '--', end: '$' } ] }; } highlight.js-7.4/src/languages/erlang.js0000644000175000017500000000746612234266276017716 0ustar boutilboutil/* Language: Erlang Description: Erlang is a general-purpose functional language, with strict evaluation, single assignment, and dynamic typing. Author: Nikolay Zakharov , Dmitry Kovega */ function(hljs) { var BASIC_ATOM_RE = '[a-z\'][a-zA-Z0-9_\']*'; var FUNCTION_NAME_RE = '(' + BASIC_ATOM_RE + ':' + BASIC_ATOM_RE + '|' + BASIC_ATOM_RE + ')'; var ERLANG_RESERVED = { keyword: 'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun let ' + 'not of orelse|10 query receive rem try when xor', literal: 'false true' }; var COMMENT = { className: 'comment', begin: '%', end: '$', relevance: 0 }; var NUMBER = { className: 'number', begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)', relevance: 0 }; var NAMED_FUN = { begin: 'fun\\s+' + BASIC_ATOM_RE + '/\\d+' }; var FUNCTION_CALL = { begin: FUNCTION_NAME_RE + '\\(', end: '\\)', returnBegin: true, relevance: 0, contains: [ { className: 'function_name', begin: FUNCTION_NAME_RE, relevance: 0 }, { begin: '\\(', end: '\\)', endsWithParent: true, returnEnd: true, relevance: 0 // "contains" defined later } ] }; var TUPLE = { className: 'tuple', begin: '{', end: '}', relevance: 0 // "contains" defined later }; var VAR1 = { className: 'variable', begin: '\\b_([A-Z][A-Za-z0-9_]*)?', relevance: 0 }; var VAR2 = { className: 'variable', begin: '[A-Z][a-zA-Z0-9_]*', relevance: 0 }; var RECORD_ACCESS = { begin: '#', end: '}', illegal: '.', relevance: 0, returnBegin: true, contains: [ { className: 'record_name', begin: '#' + hljs.UNDERSCORE_IDENT_RE, relevance: 0 }, { begin: '{', endsWithParent: true, relevance: 0 // "contains" defined later } ] }; var BLOCK_STATEMENTS = { keywords: ERLANG_RESERVED, begin: '(fun|receive|if|try|case)', end: 'end' }; BLOCK_STATEMENTS.contains = [ COMMENT, NAMED_FUN, hljs.inherit(hljs.APOS_STRING_MODE, {className: ''}), BLOCK_STATEMENTS, FUNCTION_CALL, hljs.QUOTE_STRING_MODE, NUMBER, TUPLE, VAR1, VAR2, RECORD_ACCESS ]; var BASIC_MODES = [ COMMENT, NAMED_FUN, BLOCK_STATEMENTS, FUNCTION_CALL, hljs.QUOTE_STRING_MODE, NUMBER, TUPLE, VAR1, VAR2, RECORD_ACCESS ]; FUNCTION_CALL.contains[1].contains = BASIC_MODES; TUPLE.contains = BASIC_MODES; RECORD_ACCESS.contains[1].contains = BASIC_MODES; var PARAMS = { className: 'params', begin: '\\(', end: '\\)', contains: BASIC_MODES }; return { keywords: ERLANG_RESERVED, illegal: '(', returnBegin: true, illegal: '\\(|#|//|/\\*|\\\\|:', contains: [ PARAMS, { className: 'title', begin: BASIC_ATOM_RE } ], starts: { end: ';|\\.', keywords: ERLANG_RESERVED, contains: BASIC_MODES } }, COMMENT, { className: 'pp', begin: '^-', end: '\\.', relevance: 0, excludeEnd: true, returnBegin: true, lexems: '-' + hljs.IDENT_RE, keywords: '-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' + '-import -include -include_lib -compile -define -else -endif -file -behaviour ' + '-behavior', contains: [PARAMS] }, NUMBER, hljs.QUOTE_STRING_MODE, RECORD_ACCESS, VAR1, VAR2, TUPLE ] }; } highlight.js-7.4/src/languages/parser3.js0000644000175000017500000000175212234266276020015 0ustar boutilboutil/* Language: Parser3 Requires: xml.js Author: Oleg Volchkov */ function(hljs) { return { subLanguage: 'xml', relevance: 0, contains: [ { className: 'comment', begin: '^#', end: '$' }, { className: 'comment', begin: '\\^rem{', end: '}', relevance: 10, contains: [ { begin: '{', end: '}', contains: ['self'] } ] }, { className: 'preprocessor', begin: '^@(?:BASE|USE|CLASS|OPTIONS)$', relevance: 10 }, { className: 'title', begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$' }, { className: 'variable', begin: '\\$\\{?[\\w\\-\\.\\:]+\\}?' }, { className: 'keyword', begin: '\\^[\\w\\-\\.\\:]+' }, { className: 'number', begin: '\\^#[0-9a-fA-F]+' }, hljs.C_NUMBER_MODE ] }; } highlight.js-7.4/src/languages/lasso.js0000644000175000017500000000730412234266276017556 0ustar boutilboutil/* Language: Lasso Author: Eric Knibbe Description: Lasso is a language and server platform for database-driven web applications. This definition handles Lasso 9 syntax and LassoScript for Lasso 8.6 and earlier. */ function(hljs) { var LASSO_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_.]*|&[lg]t;'; var LASSO_START = '<\\?(lasso(script)?|=)'; return { case_insensitive: true, lexems: LASSO_IDENT_RE, keywords: { literal: 'true false none minimal full all infinity nan and or not ' + 'bw ew cn lt lte gt gte eq neq ft rx nrx', built_in: 'array date decimal duration integer map pair string tag xml null ' + 'list queue set stack staticarray local var variable data global ' + 'self inherited void', keyword: 'error_code error_msg error_pop error_push error_reset cache ' + 'database_names database_schemanames database_tablenames define_tag ' + 'define_type email_batch encode_set html_comment handle handle_error ' + 'header if inline iterate ljax_target link link_currentaction ' + 'link_currentgroup link_currentrecord link_detail link_firstgroup ' + 'link_firstrecord link_lastgroup link_lastrecord link_nextgroup ' + 'link_nextrecord link_prevgroup link_prevrecord log loop ' + 'namespace_using output_none portal private protect records referer ' + 'referrer repeating resultset rows search_args search_arguments ' + 'select sort_args sort_arguments thread_atomic value_list while ' + 'abort case else if_empty if_false if_null if_true loop_abort ' + 'loop_continue loop_count params params_up return return_value ' + 'run_children soap_definetag soap_lastrequest soap_lastresponse ' + 'tag_name ascending average by define descending do equals ' + 'frozen group handle_failure import in into join let match max ' + 'min on order parent protected provide public require skip ' + 'split_thread sum take thread to trait type where with yield' }, contains: [ { className: 'preprocessor', begin: '\\]|\\?>', relevance: 0, starts: { className: 'markup', end: '\\[|' + LASSO_START, returnEnd: true } }, { className: 'preprocessor', begin: '\\[noprocess\\]', starts: { className: 'markup', end: '\\[/noprocess\\]', returnEnd: true } }, { className: 'preprocessor', begin: '\\[no_square_brackets|\\[/noprocess|' + LASSO_START }, { className: 'preprocessor', begin: '\\[', relevance: 0 }, { className: 'shebang', begin: '^#!.+lasso9\\b', relevance: 10 }, hljs.C_LINE_COMMENT_MODE, { className: 'javadoc', begin: '/\\*\\*!', end: '\\*/' }, hljs.C_BLOCK_COMMENT_MODE, hljs.C_NUMBER_MODE, hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}), { className: 'string', begin: '`', end: '`' }, { className: 'variable', begin: '#\\d+|[#$]' + LASSO_IDENT_RE }, { className: 'tag', begin: '::', end: LASSO_IDENT_RE }, { className: 'attribute', begin: '\\.\\.\\.|-' + hljs.UNDERSCORE_IDENT_RE }, { className: 'class', beginWithKeyword: true, keywords: 'define', excludeEnd: true, end: '\\(|=>', contains: [ { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE + '=?' } ] } ] }; } highlight.js-7.4/src/languages/erlang-repl.js0000644000175000017500000000242412234266276020643 0ustar boutilboutil/* Language: Erlang REPL Author: Sergey Ignatov */ function(hljs) { return { keywords: { special_functions: 'spawn spawn_link self', reserved: 'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' + 'let not of or orelse|10 query receive rem try when xor' }, contains: [ { className: 'prompt', begin: '^[0-9]+> ', relevance: 10 }, { className: 'comment', begin: '%', end: '$' }, { className: 'number', begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)', relevance: 0 }, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, { className: 'constant', begin: '\\?(::)?([A-Z]\\w*(::)?)+' }, { className: 'arrow', begin: '->' }, { className: 'ok', begin: 'ok' }, { className: 'exclamation_mark', begin: '!' }, { className: 'function_or_atom', begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)', relevance: 0 }, { className: 'variable', begin: '[A-Z][a-zA-Z0-9_\']*', relevance: 0 } ] }; } highlight.js-7.4/src/languages/django.js0000644000175000017500000000570312234266276017700 0ustar boutilboutil/* Language: Django Requires: xml.js Author: Ivan Sagalaev Contributors: Ilya Baryshev */ function(hljs) { function allowsDjangoSyntax(mode, parent) { return ( parent == undefined || // default mode (!mode.className && parent.className == 'tag') || // tag_internal mode.className == 'value' // value ); } function copy(mode, parent) { var result = {}; for (var key in mode) { if (key != 'contains') { result[key] = mode[key]; } var contains = []; for (var i = 0; mode.contains && i < mode.contains.length; i++) { contains.push(copy(mode.contains[i], mode)); } if (allowsDjangoSyntax(mode, parent)) { contains = DJANGO_CONTAINS.concat(contains); } if (contains.length) { result.contains = contains; } } return result; } var FILTER = { className: 'filter', begin: '\\|[A-Za-z]+\\:?', keywords: 'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' + 'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' + 'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' + 'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' + 'dictsortreversed default_if_none pluralize lower join center default ' + 'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' + 'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' + 'localtime utc timezone', contains: [ {className: 'argument', begin: '"', end: '"'} ] }; var DJANGO_CONTAINS = [ { className: 'template_comment', begin: '{%\\s*comment\\s*%}', end: '{%\\s*endcomment\\s*%}' }, { className: 'template_comment', begin: '{#', end: '#}' }, { className: 'template_tag', begin: '{%', end: '%}', keywords: 'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' + 'endfor in ifnotequal endifnotequal widthratio extends include spaceless ' + 'endspaceless regroup by as ifequal endifequal ssi now with cycle url filter ' + 'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' + 'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' + 'plural get_current_language language get_available_languages ' + 'get_current_language_bidi get_language_info get_language_info_list localize ' + 'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' + 'verbatim', contains: [FILTER] }, { className: 'variable', begin: '{{', end: '}}', contains: [FILTER] } ]; var result = copy(hljs.LANGUAGES.xml); result.case_insensitive = true; return result; } highlight.js-7.4/src/languages/vbscript.js0000644000175000017500000000340312234266276020265 0ustar boutilboutil/* Language: VBScript Author: Nikita Ledyaev Contributors: Michal Gabrukiewicz */ function(hljs) { return { case_insensitive: true, keywords: { keyword: 'call class const dim do loop erase execute executeglobal exit for each next function ' + 'if then else on error option explicit new private property let get public randomize ' + 'redim rem select case set stop sub while wend with end to elseif is or xor and not ' + 'class_initialize class_terminate default preserve in me byval byref step resume goto', built_in: 'lcase month vartype instrrev ubound setlocale getobject rgb getref string ' + 'weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency ' + 'conversions csng timevalue second year space abs clng timeserial fixs len asc ' + 'isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate ' + 'instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex ' + 'chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim ' + 'strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion ' + 'scriptengine split scriptengineminorversion cint sin datepart ltrim sqr ' + 'scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw ' + 'chrw regexp server response request cstr err', literal: 'true false null nothing empty' }, illegal: '//', contains: [ hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [{begin: '""'}]}), { className: 'comment', begin: '\'', end: '$' }, hljs.C_NUMBER_MODE ] }; } highlight.js-7.4/src/languages/ruleslanguage.js0000644000175000017500000001135012234266276021267 0ustar boutilboutil/* Language: Oracle Rules Language Author: Jason Jacobson Description: The Oracle Utilities Rules Language is used to program the Oracle Utilities Applications acquired from LODESTAR Corporation. The products include Billing Component, LPSS, Pricing Component etc. through version 1.6.1. */ function(hljs) { return { keywords: { keyword: 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' + 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' + 'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' + 'INTDCREATEHANDLE|5 INTDCREATEMASK|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' + 'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' + 'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' + 'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' + 'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' + 'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' + 'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' + 'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' + 'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' + 'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' + 'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' + 'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' + 'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' + 'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' + 'NOVALUE SECTION WARN DELETE SAVE SAVE_UPDATE CLEAR DETERMINANT LABEL REPORT REVENUE ABORT CALL DONE LEAVE EACH ' + 'IN LIST NOVALUE FROM TOTAL CHARGE BLOCK AND OR CSV_FILE BILL_PERIOD RATE_CODE AUXILIARY_DEMAND ' + 'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' + 'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' + 'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' + 'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' + 'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' + 'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' + 'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' + 'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' + 'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' + 'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' + 'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' + 'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' + 'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' + 'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' + 'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ABORT WARN ' + 'NUMDAYS RATE_CODE READ_DATE STAGING', built_in: 'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' + 'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' + 'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' + 'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' + 'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME' }, contains: [ hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, hljs.C_NUMBER_MODE, { className: 'array', begin: '\#[a-zA-Z\ \.]+' } ] }; }highlight.js-7.4/src/languages/clojure.js0000644000175000017500000001065712234266276020105 0ustar boutilboutil/* Language: Clojure Description: Clojure syntax (based on lisp.js) Author: mfornos */ function(hljs) { var keywords = { built_in: // Clojure keywords 'def cond apply if-not if-let if not not= = < < > <= <= >= == + / * - rem '+ 'quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? '+ 'set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? '+ 'class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? '+ 'string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . '+ 'inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last '+ 'drop-while while intern condp case reduced cycle split-at split-with repeat replicate '+ 'iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext '+ 'nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends '+ 'add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler '+ 'set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter '+ 'monitor-exit defmacro defn defn- macroexpand macroexpand-1 for doseq dosync dotimes and or '+ 'when when-not when-let comp juxt partial sequence memoize constantly complement identity assert '+ 'peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast '+ 'sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import '+ 'intern refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! '+ 'assoc! dissoc! pop! disj! import use class type num float double short byte boolean bigint biginteger '+ 'bigdec print-method print-dup throw-if throw printf format load compile get-in update-in pr pr-on newline '+ 'flush read slurp read-line subvec with-open memfn time ns assert re-find re-groups rand-int rand mod locking '+ 'assert-valid-fdecl alias namespace resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! '+ 'reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! '+ 'new next conj set! memfn to-array future future-call into-array aset gen-class reduce merge map filter find empty '+ 'hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list '+ 'disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer '+ 'chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate '+ 'unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta '+ 'lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize' }; var CLJ_IDENT_RE = '[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$\';]+'; var SIMPLE_NUMBER_RE = '[\\s:\\(\\{]+\\d+(\\.\\d+)?'; var NUMBER = { className: 'number', begin: SIMPLE_NUMBER_RE, relevance: 0 }; var STRING = { className: 'string', begin: '"', end: '"', contains: [hljs.BACKSLASH_ESCAPE], relevance: 0 }; var COMMENT = { className: 'comment', begin: ';', end: '$', relevance: 0 }; var COLLECTION = { className: 'collection', begin: '[\\[\\{]', end: '[\\]\\}]' }; var HINT = { className: 'comment', begin: '\\^' + CLJ_IDENT_RE }; var HINT_COL = { className: 'comment', begin: '\\^\\{', end: '\\}' }; var KEY = { className: 'attribute', begin: '[:]' + CLJ_IDENT_RE }; var LIST = { className: 'list', begin: '\\(', end: '\\)' }; var BODY = { endsWithParent: true, keywords: {literal: 'true false nil'}, relevance: 0 }; var TITLE = { keywords: keywords, lexems: CLJ_IDENT_RE, className: 'title', begin: CLJ_IDENT_RE, starts: BODY }; LIST.contains = [{className: 'comment', begin: 'comment'}, TITLE]; BODY.contains = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER]; COLLECTION.contains = [LIST, STRING, HINT, COMMENT, KEY, COLLECTION, NUMBER]; return { illegal: '\\S', contains: [ COMMENT, LIST ] } } highlight.js-7.4/src/languages/avrasm.js0000644000175000017500000000512112234266276017721 0ustar boutilboutil/* Language: AVR Assembler Author: Vladimir Ermakov */ function(hljs) { return { case_insensitive: true, keywords: { keyword: /* mnemonic */ 'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs ' + 'brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr ' + 'clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor ' + 'fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul ' + 'muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs ' + 'sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub ' + 'subi swap tst wdr', built_in: /* general purpose registers */ 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 ' + 'r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ' + /* IO Registers (ATMega128) */ 'ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h ' + 'tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ' + 'ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ' + 'ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk ' + 'tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ' + 'ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr ' + 'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ' + 'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf' }, contains: [ hljs.C_BLOCK_COMMENT_MODE, {className: 'comment', begin: ';', end: '$'}, hljs.C_NUMBER_MODE, // 0x..., decimal, float hljs.BINARY_NUMBER_MODE, // 0b... { className: 'number', begin: '\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)' // $..., 0o... }, hljs.QUOTE_STRING_MODE, { className: 'string', begin: '\'', end: '[^\\\\]\'', illegal: '[^\\\\][^\']' }, {className: 'label', begin: '^[A-Za-z0-9_.$]+:'}, {className: 'preprocessor', begin: '#', end: '$'}, { // директивы «.include» «.macro» и т.д. className: 'preprocessor', begin: '\\.[a-zA-Z]+' }, { // подстановка в «.macro» className: 'localvars', begin: '@[0-9]+' } ] }; } highlight.js-7.4/src/languages/cpp.js0000644000175000017500000000364212234266276017220 0ustar boutilboutil/* Language: C++ Contributors: Evgeny Stepanischev */ function(hljs) { var CPP_KEYWORDS = { keyword: 'false int float while private char catch export virtual operator sizeof ' + 'dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace ' + 'unsigned long throw volatile static protected bool template mutable if public friend ' + 'do return goto auto void enum else break new extern using true class asm case typeid ' + 'short reinterpret_cast|10 default double register explicit signed typename try this ' + 'switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype ' + 'noexcept nullptr static_assert thread_local restrict _Bool complex', built_in: 'std string cin cout cerr clog stringstream istringstream ostringstream ' + 'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' + 'unordered_map unordered_multiset unordered_multimap array shared_ptr' }; return { keywords: CPP_KEYWORDS, illegal: '', illegal: '\\n'}, hljs.C_LINE_COMMENT_MODE ] }, { className: 'stl_container', begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', keywords: CPP_KEYWORDS, relevance: 10, contains: ['self'] } ] }; } highlight.js-7.4/src/languages/fsharp.js0000644000175000017500000000276512234266276017726 0ustar boutilboutil/* Language: F# Author: Jonas Follesø Description: F# language definition. */ function(hljs) { return { keywords: 'abstract and as assert base begin class default delegate do done ' + 'downcast downto elif else end exception extern false finally for ' + 'fun function global if in inherit inline interface internal lazy let ' + 'match member module mutable namespace new null of open or ' + 'override private public rec return sig static struct then to ' + 'true try type upcast use val void when while with yield', contains: [ { className: 'string', begin: '@"', end: '"', contains: [{begin: '""'}] }, { className: 'string', begin: '"""', end: '"""' }, { className: 'comment', begin: '//', end: '$', returnBegin: true }, { className: 'comment', begin: '\\(\\*', end: '\\*\\)' }, { className: 'class', beginWithKeyword: true, end: '\\(|=|$', keywords: 'type', contains: [ { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE } ] }, { className: 'annotation', begin: '\\[<', end: '>\\]' }, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}), hljs.C_NUMBER_MODE ] } } highlight.js-7.4/src/languages/json.js0000644000175000017500000000206612234266276017406 0ustar boutilboutil/* Language: JSON Author: Ivan Sagalaev */ function(hljs) { var LITERALS = {literal: 'true false null'}; var TYPES = [ hljs.QUOTE_STRING_MODE, hljs.C_NUMBER_MODE ]; var VALUE_CONTAINER = { className: 'value', end: ',', endsWithParent: true, excludeEnd: true, contains: TYPES, keywords: LITERALS }; var OBJECT = { begin: '{', end: '}', contains: [ { className: 'attribute', begin: '\\s*"', end: '"\\s*:\\s*', excludeBegin: true, excludeEnd: true, contains: [hljs.BACKSLASH_ESCAPE], illegal: '\\n', starts: VALUE_CONTAINER } ], illegal: '\\S' }; var ARRAY = { begin: '\\[', end: '\\]', contains: [hljs.inherit(VALUE_CONTAINER, {className: null})], // inherit is also a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents illegal: '\\S' }; TYPES.splice(TYPES.length, 0, OBJECT, ARRAY); return { contains: TYPES, keywords: LITERALS, illegal: '\\S' }; } highlight.js-7.4/src/languages/go.js0000644000175000017500000000243312234266276017040 0ustar boutilboutil/* Language: Go Author: Stephan Kountso aka StepLg Contributors: Evgeny Stepanischev Description: Google go language (golang). For info about language see http://golang.org/ */ function(hljs) { var GO_KEYWORDS = { keyword: 'break default func interface select case map struct chan else goto package switch ' + 'const fallthrough if range type continue for import return var go defer', constant: 'true false iota nil', typename: 'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' + 'uint16 uint32 uint64 int uint uintptr rune', built_in: 'append cap close complex copy imag len make new panic print println real recover delete' }; return { keywords: GO_KEYWORDS, illegal: ' */ function(hljs) { var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*'; var CHAR = { className: 'char', begin: '\\$.{1}' }; var SYMBOL = { className: 'symbol', begin: '#' + hljs.UNDERSCORE_IDENT_RE }; return { keywords: 'self super nil true false thisContext', // only 6 contains: [ { className: 'comment', begin: '"', end: '"', relevance: 0 }, hljs.APOS_STRING_MODE, { className: 'class', begin: '\\b[A-Z][A-Za-z0-9_]*', relevance: 0 }, { className: 'method', begin: VAR_IDENT_RE + ':' }, hljs.C_NUMBER_MODE, SYMBOL, CHAR, { className: 'localvars', // This looks more complicated than needed to avoid combinatorial // explosion under V8. It effectively means `| var1 var2 ... |` with // whitespace adjacent to `|` being optional. begin: '\\|\\s*' + VAR_IDENT_RE + '(\\s+' + VAR_IDENT_RE + ')*\\s*\\|' }, { className: 'array', begin: '\\#\\(', end: '\\)', contains: [ hljs.APOS_STRING_MODE, CHAR, hljs.C_NUMBER_MODE, SYMBOL ] } ] }; } highlight.js-7.4/src/languages/vbnet.js0000644000175000017500000000447512234266276017561 0ustar boutilboutil/* Language: VB.NET Author: Poren Chiang */ function(hljs) { return { case_insensitive: true, keywords: { keyword: 'addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval ' + /* a-b */ 'call case catch class compare const continue custom declare default delegate dim distinct do ' + /* c-d */ 'each equals else elseif end enum erase error event exit explicit finally for friend from function ' + /* e-f */ 'get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue ' + /* g-i */ 'join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass ' + /* j-m */ 'namespace narrowing new next not notinheritable notoverridable ' + /* n */ 'of off on operator option optional or order orelse overloads overridable overrides ' + /* o */ 'paramarray partial preserve private property protected public ' + /* p */ 'raiseevent readonly redim rem removehandler resume return ' + /* r */ 'select set shadows shared skip static step stop structure strict sub synclock ' + /* s */ 'take text then throw to try unicode until using when where while widening with withevents writeonly xor', /* t-x */ built_in: 'boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype ' + /* b-c */ 'date decimal directcast double gettype getxmlnamespace iif integer long object ' + /* d-o */ 'sbyte short single string trycast typeof uinteger ulong ushort', /* s-u */ literal: 'true false nothing' }, illegal: '(//|endif|gosub|variant|wend)', /* reserved deprecated keywords */ contains: [ hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [{begin: '""'}]}), { className: 'comment', begin: '\'', end: '$', returnBegin: true, contains: [ { className: 'xmlDocTag', begin: '\'\'\'|' }, { className: 'xmlDocTag', begin: '' }, ] }, hljs.C_NUMBER_MODE, { className: 'preprocessor', begin: '#', end: '$', keywords: 'if else elseif end region externalsource' }, ] }; } highlight.js-7.4/src/languages/bash.js0000644000175000017500000000310012234266276017340 0ustar boutilboutil/* Language: Bash Author: vah Contributrors: Benjamin Pannell */ function(hljs) { var VAR1 = { className: 'variable', begin: /\$[\w\d#@][\w\d_]*/ }; var VAR2 = { className: 'variable', begin: /\$\{(.*?)\}/ }; var QUOTE_STRING = { className: 'string', begin: /"/, end: /"/, contains: [ hljs.BACKSLASH_ESCAPE, VAR1, VAR2, { className: 'variable', begin: /\$\(/, end: /\)/, contains: hljs.BACKSLASH_ESCAPE } ], relevance: 0 }; var APOS_STRING = { className: 'string', begin: /'/, end: /'/, relevance: 0 }; return { lexems: /-?[a-z]+/, keywords: { keyword: 'if then else elif fi for break continue while in do done exit return set '+ 'declare case esac export exec', literal: 'true false', built_in: 'printf echo read cd pwd pushd popd dirs let eval unset typeset readonly '+ 'getopts source shopt caller type hash bind help sudo', operator: '-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster }, contains: [ { className: 'shebang', begin: /^#![^\n]+sh\s*$/, relevance: 10 }, { className: 'function', begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, returnBegin: true, contains: [{className: 'title', begin: /\w[\w\d_]*/}], relevance: 0 }, hljs.HASH_COMMENT_MODE, hljs.NUMBER_MODE, QUOTE_STRING, APOS_STRING, VAR1, VAR2 ] }; } highlight.js-7.4/src/languages/axapta.js0000644000175000017500000000241212234266276017706 0ustar boutilboutil/* Language: Axapta Author: Dmitri Roudakov */ function(hljs) { return { keywords: 'false int abstract private char boolean static null if for true ' + 'while long throw finally protected final return void enum else ' + 'break new catch byte super case short default double public try this switch ' + 'continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count ' + 'order group by asc desc index hint like dispaly edit client server ttsbegin ' + 'ttscommit str real date container anytype common div mod', contains: [ hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, hljs.C_NUMBER_MODE, { className: 'preprocessor', begin: '#', end: '$' }, { className: 'class', beginWithKeyword: true, end: '{', illegal: ':', keywords: 'class interface', contains: [ { className: 'inheritance', beginWithKeyword: true, keywords: 'extends implements', relevance: 10 }, { className: 'title', begin: hljs.UNDERSCORE_IDENT_RE } ] } ] }; } highlight.js-7.4/src/languages/xml.js0000644000175000017500000000472012234266276017234 0ustar boutilboutil/* Language: HTML, XML */ function(hljs) { var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; var TAG_INTERNALS = { endsWithParent: true, relevance: 0, contains: [ { className: 'attribute', begin: XML_IDENT_RE, relevance: 0 }, { begin: '="', returnBegin: true, end: '"', contains: [{ className: 'value', begin: '"', endsWithParent: true }] }, { begin: '=\'', returnBegin: true, end: '\'', contains: [{ className: 'value', begin: '\'', endsWithParent: true }] }, { begin: '=', contains: [{ className: 'value', begin: '[^\\s/>]+' }] } ] }; return { case_insensitive: true, contains: [ { className: 'pi', begin: '<\\?', end: '\\?>', relevance: 10 }, { className: 'doctype', begin: '', relevance: 10, contains: [{begin: '\\[', end: '\\]'}] }, { className: 'comment', begin: '', relevance: 10 }, { className: 'cdata', begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', relevance: 10 }, { className: 'tag', /* The lookahead pattern (?=...) ensures that 'begin' only matches '|$)', end: '>', keywords: {title: 'style'}, contains: [TAG_INTERNALS], starts: { end: '', returnEnd: true, subLanguage: 'css' } }, { className: 'tag', // See the comment in the