added site files
This commit is contained in:
parent
a6f70a6c78
commit
329148c253
253 changed files with 30486 additions and 0 deletions
114
EnlighterJS/Source/Language/Assembly.js
Normal file
114
EnlighterJS/Source/Language/Assembly.js
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
---
|
||||
description: ASM General Assembly Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.asm]
|
||||
...
|
||||
*/
|
||||
EJS.Language.asm = new Class({
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
|
||||
this.patterns = {
|
||||
// comments start with a semicolon (only single line comments available)
|
||||
'singleLineComments': {
|
||||
pattern: /(;.*)$/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
// controls - used e.g. in KEIL
|
||||
'controls': {
|
||||
pattern: /(\$.*)$/gm,
|
||||
alias: 'co2'
|
||||
},
|
||||
|
||||
// "strings" may used in some assemblers for char constants
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
|
||||
// general instructions (followed after a label or at a new line)
|
||||
'instruction':{
|
||||
pattern: /(^|:)\s*?(\w+)\s+/gm,
|
||||
alias: 'kw3'
|
||||
},
|
||||
|
||||
// labels (jump targets)
|
||||
'label': {
|
||||
pattern: /^\s*?([A-Z\?_][A-Z0-9\?_]+:)\s*?/gim,
|
||||
alias: 'kw1'
|
||||
},
|
||||
|
||||
// indirect addresses starts with @
|
||||
'indirect': {
|
||||
pattern: /@\w+/gi,
|
||||
alias: 'kw4'
|
||||
},
|
||||
|
||||
// immediate data
|
||||
'immediate': {
|
||||
pattern: /#\w+/gi,
|
||||
alias: 'kw4'
|
||||
},
|
||||
|
||||
// Hexadecimal (two notations): 0aH (8051 asm)
|
||||
'hex': {
|
||||
pattern: /[A-F0-9][A-F0-9$]+?H/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Decimal: \d+ (8051 asm)
|
||||
'integer': {
|
||||
pattern: /\d[\d$]+?D/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Binary: 0b00001010, 0b11111111 (8051 asm)
|
||||
'binary': {
|
||||
pattern: /[01][01$]+?B/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Octals: 1767q (8051 asm)
|
||||
'octals': {
|
||||
pattern: /[0-7][0-7$]+?(?:Q|O)/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Hexadecimal (two notations): 0x0a, $0a, 0xff, $ff (generic)
|
||||
'hex2': {
|
||||
pattern: /(0x[A-F0-9]+|\$[A-F0-9]+)/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Binary: 0b00001010, 0b11111111 (generic)
|
||||
'binary2': {
|
||||
pattern: /(0b[01]+)/g,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Decimal: \d+ (generic)
|
||||
'integer2': {
|
||||
pattern: /\b(\d+)/g,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// e.g. LOW(), HIGH() ..
|
||||
'functions': {
|
||||
pattern: this.common.functionCalls,
|
||||
alias: 'me0'
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
});
|
89
EnlighterJS/Source/Language/AvrAssembly.js
Normal file
89
EnlighterJS/Source/Language/AvrAssembly.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
---
|
||||
description: ATMEL AVR Assembly Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.avrasm]
|
||||
...
|
||||
*/
|
||||
EJS.Language.avrasm = new Class({
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
|
||||
this.patterns = {
|
||||
'singleLineComments': {
|
||||
pattern: /(;.*)$/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
// available directives: BYTE,CSEG,DB,DEF,DEVICE,DSEG,DW,ENDMACRO,EQU,ESEG,EXIT,INCLUDE,LIST,LISTMAC,MACRO,NOLIST,ORG,SET
|
||||
'directives': {
|
||||
pattern: /^\s*?\.(\w+)\s+/gm,
|
||||
alias: 'kw1'
|
||||
},
|
||||
|
||||
'register': {
|
||||
pattern: /\b(r\d{1,2})/gi,
|
||||
alias: 'kw1'
|
||||
},
|
||||
|
||||
'macroparam': {
|
||||
pattern: /(@[0-9])/gi,
|
||||
alias: 'kw4'
|
||||
},
|
||||
|
||||
'label': {
|
||||
pattern: /^\s*?(\w+:)\s*?/gm,
|
||||
alias: 'kw3'
|
||||
},
|
||||
|
||||
'instruction':{
|
||||
pattern: /(^|:)\s*?(\w+)\s+/gm,
|
||||
alias: 'kw3'
|
||||
},
|
||||
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
|
||||
// Hexadecimal (two notations): 0x0a, $0a, 0xff, $ff
|
||||
'hex': {
|
||||
pattern: /(0x[A-F0-9]+|\$[A-F0-9]+)/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Binary: 0b00001010, 0b11111111
|
||||
'binary': {
|
||||
pattern: /(0b[01]+)/g,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// Decimal: \d+
|
||||
'integer': {
|
||||
pattern: /\b(\d+)/g,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
// e.g. LOW(), HIGH() ..
|
||||
'functions': {
|
||||
pattern: this.common.functionCalls,
|
||||
alias: 'me0'
|
||||
},
|
||||
|
||||
// io register alias e.g. DDRA, PORTB, TIMSK
|
||||
'ioregister': {
|
||||
pattern: /\b[A-Z]{2,}[0-9]?[0-9]?\b/g,
|
||||
alias: 'kw4'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
52
EnlighterJS/Source/Language/CSharp.js
Normal file
52
EnlighterJS/Source/Language/CSharp.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
---
|
||||
description: C# Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Joshua Maag
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.csharp]
|
||||
...
|
||||
*/
|
||||
EJS.Language.csharp = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
reserved: {
|
||||
csv: "as, base, break, case, catch, checked, continue, default, do, else, event, explicit, false, finally, fixed, for, foreach, goto, if, implicit, internal, is, lock, namespace, new, null, operator, params, private, protected, public, ref, return, sizeof, stackalloc, switch, this, throw, true, try, typeof, unchecked, using, void, while",
|
||||
alias: 'kw1'
|
||||
},
|
||||
keywords: {
|
||||
csv: "abstract, async, class, const, delegate, dynamic, event, extern, in, interface, out, override, readonly, sealed, static, unsafe, virtual, volatile",
|
||||
alias: 'kw3'
|
||||
},
|
||||
primitives: {
|
||||
csv: "bool, byte, char, decimal, double, enum, float, int, long, sbyte, short, struct, uint, ulong, ushort, object, string",
|
||||
alias: 'kw2'
|
||||
},
|
||||
internal: {
|
||||
csv: "System",
|
||||
alias: 'kw4'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1'},
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co2'},
|
||||
'chars': { pattern: this.common.singleQuotedString, alias: 'st0' },
|
||||
'strings': { pattern: this.common.doubleQuotedString, alias: 'st1' },
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim, alias: 'nu0' },
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
'functionCalls': { pattern: this.common.functionCalls, alias: 'me0'},
|
||||
'methodCalls': { pattern: this.common.methodCalls, alias: 'me1'}
|
||||
};
|
||||
|
||||
}
|
||||
});
|
49
EnlighterJS/Source/Language/Cpp.js
Normal file
49
EnlighterJS/Source/Language/Cpp.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
---
|
||||
description: C/C++ Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.cpp]
|
||||
...
|
||||
*/
|
||||
EJS.Language.cpp = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function() {
|
||||
this.keywords = {
|
||||
cpp: {
|
||||
csv: "and,and_eq,asm,auto,bitand,bitor,bool,break,case,catch,char,class,compl,const,const_cast,continue,default,delete,do,double,dynamic_cast,else,enum,explicit,export,extern,false,float,for,friend,goto,if,inline,int,long,mutable,namespace,new,not,not_eq,operator,or,or_eq,private,protected,public,register,reinterpret_cast,return,short,signed,sizeof,static,static_cast,struct,switch,template,this,throw,true,try,typedef,typeid,typename,union,unsigned,using,virtual,void,volatile,wchar_t,while,xor,xor_eq",
|
||||
alias: 'kw1'
|
||||
},
|
||||
cppX11: {
|
||||
csv: "alignas,alignof,char16_t,char32_t,constexpr,decltype,noexcept,nullptr,static_assert,thread_local",
|
||||
alias: 'kw4'
|
||||
},
|
||||
directives: {
|
||||
csv: "__LINE__,__FILE__,__DATE__,__TIME__,__cplusplus",
|
||||
alias: 'kw2'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1'},
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co2'},
|
||||
'chars': { pattern: this.common.singleQuotedString, alias: 'st0' },
|
||||
'strings': { pattern: this.common.doubleQuotedString, alias: 'st1' },
|
||||
'annotation': { pattern: /@[\W\w_][\w\d_]+/gm, alias: 'st1' },
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim, alias: 'nu0' },
|
||||
'properties': { pattern: this.common.properties, alias: 'me0' },
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
'functionCalls': { pattern: this.common.functionCalls, alias: 'de1'},
|
||||
'directives': { pattern: /#.*$/gm, alias: 'kw2'}
|
||||
};
|
||||
}
|
||||
});
|
40
EnlighterJS/Source/Language/Css.js
Normal file
40
EnlighterJS/Source/Language/Css.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
---
|
||||
description: CSS (Cascading Style Sheets)
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
- Jose Prado
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.css]
|
||||
...
|
||||
*/
|
||||
EnlighterJS.Language.css = new Class({
|
||||
|
||||
Extends: EnlighterJS.Language.generic,
|
||||
|
||||
setupLanguage: function() {
|
||||
|
||||
this.keywords = {
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'comments2': { pattern: /\/\*![\s\S]*?\*\//gm, alias: 'co2'},
|
||||
'comments': { pattern: this.common.multiComments, alias: 'co1'},
|
||||
'strings': { pattern: this.common.strings, alias: 'st0' },
|
||||
'selectors': { pattern: /(?:^|}|\/)\s*([^\\/{@]+)\s*\{/gi, alias: 'kw1' },
|
||||
'directives': { pattern: /(@[a-z]+)\s+/gi, alias: 'kw2' },
|
||||
'rules': { pattern: /([\w-]+)\s*:/g, alias: 'kw3' },
|
||||
'uri': { pattern: /url\s*\([^\)]*\)/gi, alias: 'kw4' },
|
||||
'units': { pattern: /\b(\d+[\.\d+-]?\s*(%|[a-z]{1,3})?)/gi, alias: 'nu0' },
|
||||
'hexColors': { pattern: /(#[A-F0-9]{3}([A-F0-9]{3})?)\b/gi, alias: 'nu0' },
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0'},
|
||||
'symbols': { pattern: /,|\.|;|:|>/g, alias: 'sy0'}
|
||||
};
|
||||
}
|
||||
});
|
30
EnlighterJS/Source/Language/Cython.js
Normal file
30
EnlighterJS/Source/Language/Cython.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
---
|
||||
description: Cython language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
- Devyn Collier Johnson
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.cython]
|
||||
...
|
||||
*/
|
||||
EJS.Language.cython = new Class({
|
||||
|
||||
Extends: EJS.Language.python,
|
||||
|
||||
setupLanguage: function() {
|
||||
// run origin language setup
|
||||
this.parent();
|
||||
|
||||
// append cython extension keywords
|
||||
this.keywords.reserved.csv += ', __all__, include, cimport, pyximport, cythonize, cdef, cpdef, ctypedef, property, IF, ELIF, ELSE, DEF';
|
||||
this.keywords.functions.csv += ', __dealloc__, __get__, __init__, fopen';
|
||||
this.keywords.classes.csv += ', PyErr_Fetch, PyErr_Occurred, PyErr_WarnEx, char, double, extern, namespace, public, struct, void, union, unsigned, enum';
|
||||
}
|
||||
});
|
46
EnlighterJS/Source/Language/Diff.js
Normal file
46
EnlighterJS/Source/Language/Diff.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
---
|
||||
description: DIFF Highlighting
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.diff]
|
||||
...
|
||||
*/
|
||||
EJS.Language.diff = new Class({
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
|
||||
'comments' : {
|
||||
pattern : /^((---|\+\+\+) .*)/gm,
|
||||
alias : 'co1'
|
||||
},
|
||||
|
||||
'stats' : {
|
||||
pattern : /^(@@.*@@\s*)/gm,
|
||||
alias : 'nu0'
|
||||
},
|
||||
|
||||
'add' : {
|
||||
pattern : /^(\+.*)/gm,
|
||||
alias : 're0'
|
||||
},
|
||||
|
||||
'del' : {
|
||||
pattern : /^(-.*)/gm,
|
||||
alias : 'st0'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
184
EnlighterJS/Source/Language/Generic.js
Normal file
184
EnlighterJS/Source/Language/Generic.js
Normal file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
---
|
||||
description: Code parsing engine for EnlighterJS
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.generic]
|
||||
...
|
||||
*/
|
||||
EJS.Language.generic = new Class({
|
||||
|
||||
tokenizerType : 'Standard',
|
||||
tokenizer : null,
|
||||
code : null,
|
||||
|
||||
patterns : {},
|
||||
keywords : {},
|
||||
|
||||
delimiters : {
|
||||
start: null,
|
||||
end: null
|
||||
},
|
||||
|
||||
|
||||
// commonly used Regex Patterns
|
||||
common : {
|
||||
// Matches a C style single-line comment.
|
||||
slashComments : /(?:^|[^\\])\/\/.*$/gm,
|
||||
|
||||
// Matches a Perl style single-line comment.
|
||||
poundComments : /#.*$/gm,
|
||||
|
||||
// Matches a C style multi-line comment
|
||||
multiComments : /\/\*[\s\S]*?\*\//gm,
|
||||
|
||||
// Matches a string enclosed by single quotes. Legacy.
|
||||
aposStrings : /'[^'\\]*(?:\\.[^'\\]*)*'/gm,
|
||||
|
||||
// Matches a string enclosed by double quotes. Legacy.
|
||||
quotedStrings : /"[^"\\]*(?:\\.[^"\\]*)*"/gm,
|
||||
|
||||
// Matches a string enclosed by single quotes across multiple lines.
|
||||
multiLineSingleQuotedStrings : /'[^'\\]*(?:\\.[^'\\]*)*'/gm,
|
||||
|
||||
// Matches a string enclosed by double quotes across multiple lines.
|
||||
multiLineDoubleQuotedStrings : /"[^"\\]*(?:\\.[^"\\]*)*"/gm,
|
||||
|
||||
// Matches both.
|
||||
multiLineStrings : /'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"/gm,
|
||||
|
||||
// Matches a string enclosed by single quotes.
|
||||
singleQuotedString : /'[^'\\\r\n]*(?:\\.[^'\\\r\n]*)*'/gm,
|
||||
|
||||
// Matches a string enclosed by double quotes.
|
||||
doubleQuotedString : /"[^"\\\r\n]*(?:\\.[^"\\\r\n]*)*"/gm,
|
||||
|
||||
// Matches both.
|
||||
strings : /'[^'\\\r\n]*(?:\\.[^'\\\r\n]*)*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*)*"/gm,
|
||||
|
||||
// Matches a property: .property style.
|
||||
properties : /\.([\w]+)\s*/gi,
|
||||
|
||||
// Matches a method call: .methodName() style.
|
||||
methodCalls : /\.([\w]+)\s*\(/gm,
|
||||
|
||||
// Matches a function call: functionName() style.
|
||||
functionCalls : /\b([\w]+)\s*\(/gm,
|
||||
|
||||
// Matches any of the common brackets.
|
||||
brackets : /\{|}|\(|\)|\[|]/g,
|
||||
|
||||
// Matches integers, decimals, hexadecimals.
|
||||
numbers : /\b((?:(\d+)?\.)?[0-9]+|0x[0-9A-F]+)\b/gi
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @constructs
|
||||
* @param {Object}
|
||||
* options
|
||||
*/
|
||||
initialize : function(code){
|
||||
// initialize language options
|
||||
this.setupLanguage();
|
||||
|
||||
this.rules = [];
|
||||
this.code = code;
|
||||
|
||||
// create new tokenizer
|
||||
this.tokenizer = new EnlighterJS.Tokenizer[this.tokenizerType]();
|
||||
|
||||
// Add delimiter rules.
|
||||
if (this.delimiters.start){
|
||||
this.rules.push({
|
||||
pattern: this.delimiters.start,
|
||||
alias: 'de1'
|
||||
});
|
||||
}
|
||||
|
||||
if (this.delimiters.end){
|
||||
this.rules.push({
|
||||
pattern: this.delimiters.end,
|
||||
alias: 'de2'
|
||||
});
|
||||
}
|
||||
|
||||
// Set Keyword Rules from this.keywords object.
|
||||
Object.each(this.keywords, function(keywordSet, ruleName){
|
||||
// keyword set contains elements ?
|
||||
if (keywordSet.csv != ''){
|
||||
this.rules.push({
|
||||
pattern: this.csvToRegExp(keywordSet.csv, keywordSet.mod || "g"),
|
||||
alias: keywordSet.alias
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Set Rules from this.patterns object.
|
||||
Object.each(this.patterns, function(regex, ruleName){
|
||||
// add new rule entry
|
||||
this.rules.push(regex);
|
||||
}, this);
|
||||
},
|
||||
|
||||
getRuleByName: function(name){
|
||||
//return this.rulesN[name];
|
||||
},
|
||||
|
||||
// override this method to setup language params
|
||||
setupLanguage: function(){
|
||||
// generic highlighting
|
||||
this.patterns = {
|
||||
strings: { pattern: this.common.strings, alias: 'st0'},
|
||||
fn : { pattern: this.common.functionCalls, alias: 'kw1'},
|
||||
me : { pattern: this.common.methodCalls, alias: 'kw2'},
|
||||
brackets: { pattern: this.common.brackets, alias: 'br0' },
|
||||
numbers: { pattern: this.common.numbers, alias: 'nu0'},
|
||||
comment0: { pattern: this.common.slashComments, alias: 'co1'},
|
||||
comment1: { pattern: this.common.poundComments, alias: 'co1'},
|
||||
comment3: { pattern: this.common.multiComments, alias: 'co2'},
|
||||
};
|
||||
},
|
||||
|
||||
getTokens : function(){
|
||||
return this.tokenizer.getTokens(this, this.code);
|
||||
},
|
||||
|
||||
getRules : function(){
|
||||
return this.rules;
|
||||
},
|
||||
|
||||
csvToRegExp : function(csv, mod){
|
||||
return new RegExp('\\b(' + csv.replace(/,\s*/g, '|') + ')\\b', mod);
|
||||
},
|
||||
|
||||
delimToRegExp : function(beg, esc, end, mod, suffix){
|
||||
beg = beg.escapeRegExp();
|
||||
if (esc){
|
||||
esc = esc.escapeRegExp();
|
||||
}
|
||||
end = (end) ? end.escapeRegExp() : beg;
|
||||
var pat = (esc) ? beg + "[^" + end + esc + '\\n]*(?:' + esc + '.[^' + end + esc + '\\n]*)*' + end : beg + "[^" + end + '\\n]*' + end;
|
||||
|
||||
return new RegExp(pat + (suffix || ''), mod || '');
|
||||
},
|
||||
|
||||
strictRegExp : function(){
|
||||
var regex = '(';
|
||||
for (var i = 0; i < arguments.length; i++){
|
||||
regex += arguments[i].escapeRegExp();
|
||||
regex += (i < arguments.length - 1) ? '|' : '';
|
||||
}
|
||||
regex += ')';
|
||||
return new RegExp(regex, "gim");
|
||||
}
|
||||
});
|
58
EnlighterJS/Source/Language/Ini.js
Normal file
58
EnlighterJS/Source/Language/Ini.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
---
|
||||
description: Ini/Conf/Property Highlighting
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.ini]
|
||||
...
|
||||
*/
|
||||
EJS.Language.ini = new Class({
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'singleLineComments': {
|
||||
pattern: /(;.*)$/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
'section': {
|
||||
pattern: /^\s*?(\[.*\])\s*?$/gm,
|
||||
alias: 'kw4'
|
||||
},
|
||||
|
||||
'directive': {
|
||||
pattern: /^\s*?[a-z0-9\._-]+\s*?=/gim,
|
||||
alias: 'kw1'
|
||||
},
|
||||
|
||||
'boolean': {
|
||||
pattern: /\b(true|false|on|off|yes|no)\b/gim,
|
||||
alias: 'kw2'
|
||||
},
|
||||
|
||||
'strings': {
|
||||
pattern: this.common.doubleQuotedString,
|
||||
alias: 'st1'
|
||||
},
|
||||
'numbers': {
|
||||
pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)[a-z]*?\b/gim,
|
||||
alias: 'nu0'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
55
EnlighterJS/Source/Language/Java.js
Normal file
55
EnlighterJS/Source/Language/Java.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
---
|
||||
description: Java language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Italo Maia
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.java]
|
||||
...
|
||||
*/
|
||||
EJS.Language.java = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(code)
|
||||
{
|
||||
this.keywords = {
|
||||
reserved: {
|
||||
csv: "continue, for, new, switch, assert, default, goto, synchronized, do, if, this, break, throw, else, throws, case, instanceof, return, transient, catch, try, final, finally, strictfp, volatile, const, native, super, while",
|
||||
alias: 'kw1'
|
||||
},
|
||||
keywords: {
|
||||
csv: "abstract, package, private, implements, protected, public, import, extends, interface, static, void, class",
|
||||
alias: 'kw3'
|
||||
},
|
||||
primitives: {
|
||||
csv: "byte, short, int, long, float, double, boolean, char, String",
|
||||
alias: 'kw2'
|
||||
},
|
||||
internal: {
|
||||
csv: "System",
|
||||
alias: 'kw4'
|
||||
}
|
||||
},
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1'},
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co2'},
|
||||
'chars': { pattern: this.common.singleQuotedString, alias: 'st0' },
|
||||
'strings': { pattern: this.common.doubleQuotedString, alias: 'st1' },
|
||||
'annotation': { pattern: /@[\W\w_][\w\d_]+/gm, alias: 'st1' },
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim, alias: 'nu0' },
|
||||
'properties': { pattern: this.common.properties, alias: 'me0' },
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
'functionCalls': { pattern: this.common.functionCalls, alias: 'kw1'}
|
||||
};
|
||||
|
||||
}
|
||||
});
|
78
EnlighterJS/Source/Language/Javascript.js
Normal file
78
EnlighterJS/Source/Language/Javascript.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
---
|
||||
description: JavaScript language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.javascript]
|
||||
...
|
||||
*/
|
||||
EJS.Language.javascript = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function()
|
||||
{
|
||||
this.keywords = {
|
||||
commonKeywords: {
|
||||
csv: "as, break, case, catch, continue, delete, do, else, eval, finally, for, if, in, is, instanceof, return, switch, this, throw, try, typeof, void, while, write, with",
|
||||
alias: 'kw1'
|
||||
},
|
||||
langKeywords: {
|
||||
csv: "class, const, default, debugger, export, extends, false, function, import, namespace, new, null, package, private, protected, public, super, true, use, var",
|
||||
alias: 'kw2'
|
||||
},
|
||||
windowKeywords: {
|
||||
csv: "alert, confirm, open, print, prompt",
|
||||
alias: 'kw3'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': {
|
||||
pattern: this.common.slashComments,
|
||||
alias: 'co1'
|
||||
},
|
||||
'multiComments': {
|
||||
pattern: this.common.multiComments,
|
||||
alias: 'co2'
|
||||
},
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
'methodCalls': {
|
||||
pattern: this.common.properties,
|
||||
alias: 'me0'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
},
|
||||
'numbers': {
|
||||
pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
'regex': {
|
||||
pattern: this.delimToRegExp("/", "\\", "/", "g", "[gimy]*"),
|
||||
alias: 're0'
|
||||
},
|
||||
'symbols': {
|
||||
pattern: /\+|-|\*|\/|%|!|@|&|\||\^|\<|\>|=|,|\.|;|\?|:/g,
|
||||
alias: 'sy0'
|
||||
}
|
||||
};
|
||||
|
||||
this.delimiters = {
|
||||
start: this.strictRegExp('<script type="text/javascript">', '<script language="javascript">'),
|
||||
end: this.strictRegExp('<\/script>')
|
||||
};
|
||||
|
||||
}
|
||||
});
|
56
EnlighterJS/Source/Language/Json.js
Normal file
56
EnlighterJS/Source/Language/Json.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
---
|
||||
description: JSON Object Highlighting
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.json]
|
||||
...
|
||||
*/
|
||||
EJS.Language.json = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function()
|
||||
{
|
||||
this.keywords = {
|
||||
values: {
|
||||
csv: "true, false, null",
|
||||
alias: 'kw2'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'keys': {
|
||||
pattern: /("[^"\\\r\n]+?")\s*?:/gi,
|
||||
alias: 'kw1'
|
||||
},
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
},
|
||||
'numbers': {
|
||||
pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi,
|
||||
alias: 'nu0'
|
||||
},
|
||||
'symbols': {
|
||||
pattern: /,|:/g,
|
||||
alias: 'sy0'
|
||||
}
|
||||
};
|
||||
|
||||
this.delimiters = {
|
||||
|
||||
};
|
||||
}
|
||||
});
|
52
EnlighterJS/Source/Language/Less.js
Normal file
52
EnlighterJS/Source/Language/Less.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
---
|
||||
description: LESS (Cascading Style Sheets)
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.less]
|
||||
...
|
||||
*/
|
||||
EnlighterJS.Language.less = new Class({
|
||||
|
||||
Extends: EnlighterJS.Language.css,
|
||||
|
||||
setupLanguage: function() {
|
||||
this.parent();
|
||||
|
||||
this.keywords = Object.merge(this.keywords, {
|
||||
|
||||
});
|
||||
|
||||
this.patterns = Object.merge(this.patterns, {
|
||||
'vars': {
|
||||
pattern: /(@[\w_-]+:?)/gi,
|
||||
alias: 'kw4'
|
||||
},
|
||||
/*
|
||||
'fn': {
|
||||
pattern: /\b(\.?[\w_-]+)\s*\(/gm,
|
||||
alias: ''
|
||||
},
|
||||
'include': {
|
||||
pattern: /(\.[\w_-]+)\s*;/gm,
|
||||
alias: 'me0'
|
||||
},*/
|
||||
'symbols': {
|
||||
pattern: /,|\.|;|:|>|\+|\-|\*|\//g,
|
||||
alias: 'sy0'
|
||||
},
|
||||
'singleComments': {
|
||||
pattern: this.common.slashComments,
|
||||
alias: 'co1'
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
82
EnlighterJS/Source/Language/Lua.js
Normal file
82
EnlighterJS/Source/Language/Lua.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
---
|
||||
description: LUA http://www.lua.org/
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.lua]
|
||||
...
|
||||
*/
|
||||
EJS.Language.lua = new Class({
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
'reserved': {
|
||||
'csv': 'and,break,do,else,elseif,end,for,function,if,in,local,or,repeat,return,not,then,until,while',
|
||||
'alias': 'kw1'
|
||||
},
|
||||
'values': {
|
||||
'csv': 'false,nil,true',
|
||||
'alias': 'kw2'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
|
||||
'multiLineComments': {
|
||||
pattern: /--\[\[[\s\S]*?]]/g,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
'singleLineComments': {
|
||||
pattern: /(--.*)$/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
'specialComments': {
|
||||
pattern: /---\[\[[\s\S]*?(]])/g,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
// single and double quoted strings
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
|
||||
// multi line strings
|
||||
'mlstring': {
|
||||
pattern: /(\[(=*)\[[\S\s]*?]\2])/g,
|
||||
alias: 'st1'
|
||||
},
|
||||
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
},
|
||||
|
||||
'numbers': {
|
||||
pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?)/gim,
|
||||
alias: 'nu0'
|
||||
},
|
||||
|
||||
'functionCalls': {
|
||||
pattern: this.common.functionCalls,
|
||||
alias: 'me0'
|
||||
},
|
||||
|
||||
'methodCalls': {
|
||||
pattern: this.common.methodCalls,
|
||||
alias: 'me1'
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
});
|
35
EnlighterJS/Source/Language/Markdown.js
Normal file
35
EnlighterJS/Source/Language/Markdown.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
---
|
||||
description: Markdown language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.markdown]
|
||||
...
|
||||
*/
|
||||
EJS.Language.markdown = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(code){
|
||||
this.patterns = {
|
||||
'header1': { pattern: /^(.+)\n=+\n/gim, alias: 'st1' },
|
||||
'header2': { pattern: /^(.+)\n-+\n/gim, alias: 'st2' },
|
||||
'header3': { pattern: /[#]{1,6}.*/gim, alias: 'st0' },
|
||||
'ul': { pattern: /^\*\s*.*/gim, alias: 'kw1' },
|
||||
'ol': { pattern: /^\d+\..*/gim, alias: 'kw1' },
|
||||
'italics': { pattern: /\*.*?\*/g, alias: 'kw3' },
|
||||
'bold': { pattern: /\*\*.*?\*\*/g, alias: 'kw3' },
|
||||
'url': { pattern: /\[[^\]]*\]\([^\)]*\)/g, alias: 'kw4' }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
});
|
56
EnlighterJS/Source/Language/Matlab.js
Normal file
56
EnlighterJS/Source/Language/Matlab.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
---
|
||||
description: Octave/Matlab Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.matlab]
|
||||
...
|
||||
*/
|
||||
EJS.Language.matlab = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function() {
|
||||
this.keywords = {
|
||||
// keywords: https://www.gnu.org/software/octave/doc/interpreter/Keywords.html
|
||||
kw: {
|
||||
csv: "__FILE__,__LINE__,break,case,catch,classdef,continue,do,else,elseif,end,end_try_catch,end_unwind_protect,endclassdef,endenumeration,endevents,endfor,endfunction,endif,endmethods,endparfor,endproperties,endswitch,endwhile,enumeration,events,for,function,global,if,methods,otherwise,parfor,persistent,properties,return,static,switch,try,until,unwind_protect,unwind_protect_cleanup,while",
|
||||
alias: 'kw1',
|
||||
mod: 'gi'
|
||||
},
|
||||
const: {
|
||||
csv: 'true, false',
|
||||
alias: 'kw3',
|
||||
mod: 'gi'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'lineComments': { pattern: /%.*$/gm, alias: 'co1'},
|
||||
'blockComments': { pattern: /%%.*$/gm, alias: 'co2'},
|
||||
|
||||
'fn' : { pattern: this.common.functionCalls, alias: 'me0'},
|
||||
'fn2' : { pattern: /\b([\w]+)\s*;/gm, alias: 'me0'},
|
||||
'me' : { pattern: this.common.methodCalls, alias: 'me1'},
|
||||
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
|
||||
'strings': {pattern: this.common.singleQuotedString, alias: 'st0'},
|
||||
|
||||
'numbers': { pattern: this.common.numbers, alias: 'nu0' },
|
||||
|
||||
'fhandle': { pattern: /(@[\w]+)\s*/gm, alias: 'kw3' },
|
||||
|
||||
'symbols': { pattern: /\+|-|\*|\/|%|!|@|&|\||\^|<|>|=|,|\.|;|\?|:|\[|]/g, alias: 'sy0' },
|
||||
|
||||
'classdef': { pattern: /classdef\s+(\w+(?:\s*<\s*\w+)?)\s*$/gim, alias: 'kw4'}
|
||||
};
|
||||
}
|
||||
});
|
96
EnlighterJS/Source/Language/Nsis.js
Normal file
96
EnlighterJS/Source/Language/Nsis.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
---
|
||||
description: Nullsoft Scriptable Install System (NSIS)
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jan T. Sott
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.nsis]
|
||||
...
|
||||
*/
|
||||
EJS.Language.nsis = new Class({
|
||||
|
||||
Extends : EJS.Language.generic,
|
||||
|
||||
setupLanguage : function(){
|
||||
/** Set of keywords in CSV form. Add multiple keyword hashes for differentiate keyword sets. */
|
||||
|
||||
this.keywords = {
|
||||
commands : {
|
||||
csv : "Function, PageEx, Section, SectionGroup, SubSection, Abort, AddBrandingImage, AddSize, AllowRootDirInstall, AllowSkipFiles, AutoCloseWindow, BGFont, BGGradient, BrandingText, BringToFront, Call, CallInstDLL, Caption, ChangeUI, CheckBitmap, ClearErrors, CompletedText, ComponentText, CopyFiles, CRCCheck, CreateDirectory, CreateFont, CreateShortCut, Delete, DeleteINISec, DeleteINIStr, DeleteRegKey, DeleteRegValue, DetailPrint, DetailsButtonText, DirText, DirVar, DirVerify, EnableWindow, EnumRegKey, EnumRegValue, Exch, Exec, ExecShell, ExecWait, ExpandEnvStrings, File, FileBufSize, FileClose, FileErrorText, FileOpen, FileRead, FileReadByte, FileReadUTF16LE, FileReadWord, FileSeek, FileWrite, FileWriteByte, FileWriteUTF16LE, FileWriteWord, FindClose, FindFirst, FindNext, FindWindow, FlushINI, FunctionEnd, GetCurInstType, GetCurrentAddress, GetDlgItem, GetDLLVersion, GetDLLVersionLocal, GetErrorLevel, GetFileTime, GetFileTimeLocal, GetFullPathName, GetFunctionAddress, GetInstDirError, GetLabelAddress, GetTempFileName, Goto, HideWindow, Icon, IfAbort, IfErrors, IfFileExists, IfRebootFlag, IfSilent, InitPluginsDir, InstallButtonText, InstallColors, InstallDir, InstallDirRegKey, InstProgressFlags, InstType, InstTypeGetText, InstTypeSetText, IntCmp, IntCmpU, IntFmt, IntOp, IsWindow, LangString, LicenseBkColor, LicenseData, LicenseForceSelection, LicenseLangString, LicenseText, LoadLanguageFile, LockWindow, LogSet, LogText, ManifestDPIAware, ManifestSupportedOS, MessageBox, MiscButtonText, Name, Nop, OutFile, Page, PageCallbacks, PageExEnd, Pop, Push, Quit, ReadEnvStr, ReadINIStr, ReadRegDWORD, ReadRegStr, Reboot, RegDLL, Rename, RequestExecutionLevel, ReserveFile, Return, RMDir, SearchPath, SectionEnd, SectionGetFlags, SectionGetInstTypes, SectionGetSize, SectionGetText, SectionGroupEnd, SectionIn, SectionSetFlags, SectionSetInstTypes, SectionSetSize, SectionSetText, SendMessage, SetAutoClose, SetBrandingImage, SetCompress, SetCompressor, SetCompressorDictSize, SetCtlColors, SetCurInstType, SetDatablockOptimize, SetDateSave, SetDetailsPrint, SetDetailsView, SetErrorLevel, SetErrors, SetFileAttributes, SetFont, SetOutPath, SetOverwrite, SetPluginUnload, SetRebootFlag, SetRegView, SetShellVarContext, SetSilent, ShowInstDetails, ShowUninstDetails, ShowWindow, SilentInstall, SilentUnInstall, Sleep, SpaceTexts, StrCmp, StrCmpS, StrCpy, StrLen, SubCaption, SubSectionEnd, Unicode, UninstallButtonText, UninstallCaption, UninstallIcon, UninstallSubCaption, UninstallText, UninstPage, UnRegDLL, Var, VIAddVersionKey, VIFileVersion, VIProductVersion, WindowIcon, WriteINIStr, WriteRegBin, WriteRegDWORD, WriteRegExpandStr, WriteRegStr, WriteUninstaller, XPStyle",
|
||||
alias : 'kw1'
|
||||
},
|
||||
states : {
|
||||
csv : "admin, all, auto, both, colored, false, force, hide, highest, lastused, leave, listonly, none, normal, notset, off, on, open, print, show, silent, silentlog, smooth, textonly, true, user",
|
||||
alias : 'kw2'
|
||||
},
|
||||
statics : {
|
||||
csv : "ARCHIVE, FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_OFFLINE, FILE_ATTRIBUTE_READONLY, FILE_ATTRIBUTE_SYSTEM, FILE_ATTRIBUTE_TEMPORARY, HKCR, HKCU, HKDD, HKEY_CLASSES_ROOT, HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA, HKEY_LOCAL_MACHINE, HKEY_PERFORMANCE_DATA, HKEY_USERS, HKLM, HKPD, HKU, IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES, MB_ABORTRETRYIGNORE, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_DEFBUTTON4, MB_ICONEXCLAMATION, MB_ICONINFORMATION, MB_ICONQUESTION, MB_ICONSTOP, MB_OK, MB_OKCANCEL, MB_RETRYCANCEL, MB_RIGHT, MB_RTLREADING, MB_SETFOREGROUND, MB_TOPMOST, MB_USERICON, MB_YESNO, NORMAL, OFFLINE, READONLY, SHCTX, SHELL_CONTEXT, SYSTEM, TEMPORARY",
|
||||
alias : 'kw3'
|
||||
}
|
||||
};
|
||||
|
||||
/** Set of RegEx patterns to match */
|
||||
this.patterns = {
|
||||
'brackets' : {
|
||||
pattern : this.common.brackets,
|
||||
alias : 'br0'
|
||||
},
|
||||
'commentMultiline' : {
|
||||
pattern : this.common.multiComments,
|
||||
alias : 'co2'
|
||||
},
|
||||
'commentPound' : {
|
||||
pattern : this.common.poundComments,
|
||||
alias : 'co1'
|
||||
},
|
||||
'commentSemicolon' : {
|
||||
pattern : /;.*$/gm,
|
||||
alias : 'co1'
|
||||
},
|
||||
'compilerFlags' : {
|
||||
pattern : /(!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning))/g,
|
||||
alias : 'kw2'
|
||||
},
|
||||
'defines' : {
|
||||
pattern : /[\$]\{{1,2}[0-9a-zA-Z_][\w]*[\}]/gim,
|
||||
alias : 'kw4'
|
||||
},
|
||||
'jumps' : {
|
||||
pattern : /([(\+|\-)]([0-9]+))/g,
|
||||
alias : 'nu0'
|
||||
},
|
||||
'langStrings' : {
|
||||
pattern : /[\$]\({1,2}[0-9a-zA-Z_][\w]*[\)]/gim,
|
||||
alias : 'kw3'
|
||||
},
|
||||
'escapeChars' : {
|
||||
pattern : /([\$]\\(n|r|t|[\$]))/g,
|
||||
alias : 'kw4'
|
||||
},
|
||||
'numbers' : {
|
||||
pattern : /\b((([0-9]+)?\.)?[0-9_]+([e][\-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi,
|
||||
alias : 'nu0'
|
||||
},
|
||||
'pluginCommands' : {
|
||||
pattern : /(([0-9a-zA-Z_]+)[:{2}]([0-9a-zA-Z_]+))/g,
|
||||
alias : 'kw2'
|
||||
},
|
||||
'strings' : {
|
||||
pattern : this.common.strings,
|
||||
alias : 'st0'
|
||||
},
|
||||
'variables' : {
|
||||
pattern : /[\$]{1,2}[0-9a-zA-Z_][\w]*/gim,
|
||||
alias : 'kw4'
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
});
|
76
EnlighterJS/Source/Language/Php.js
Normal file
76
EnlighterJS/Source/Language/Php.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
---
|
||||
description: PHP language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.php]
|
||||
...
|
||||
*/
|
||||
EnlighterJS.Language.php = new Class({
|
||||
|
||||
Extends: EnlighterJS.Language.generic,
|
||||
tokenizerType : 'Standard',
|
||||
|
||||
setupLanguage: function(){
|
||||
|
||||
this.keywords = {
|
||||
// http://php.net/manual/en/reserved.keywords.php
|
||||
keywords: {
|
||||
csv: '__halt_compiler,abstract,and,as,break,callable,case,catch,class,clone,const,continue,declare,default,do,else,elseif,enddeclare,endfor,endforeach,endif,endswitch,endwhile,extends,final,finally,function,global,goto,implements,instanceof,insteadof,interface,namespace,new,or,private,protected,public,static,throw,trait,try,use,var,xor,yield',
|
||||
alias: 'kw1'
|
||||
},
|
||||
|
||||
// http://php.net/manual/en/reserved.other-reserved-words.php
|
||||
reserved: {
|
||||
csv: 'int,float,bool,string,true,false,null,resource,object,mixed,numeric',
|
||||
alias: 'kw4',
|
||||
mod: 'gi'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'keywordsFn': {
|
||||
pattern: /(require_once|include_once|array|die|exit|echo|print|empty|eval|include|isset|list|require|unset|if|switch|while|foreach|for|return)(?:\s*\(|\s+)?/gi,
|
||||
alias: 'kw1'
|
||||
},
|
||||
inherit: {
|
||||
pattern: /(self|parent|\$this)/gi,
|
||||
alias: 'kw4'
|
||||
},
|
||||
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1' },
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co2' },
|
||||
|
||||
'dqStrings': { pattern: this.common.multiLineDoubleQuotedStrings, alias: 'st0' },
|
||||
'sqStrings': { pattern: this.common.multiLineSingleQuotedStrings, alias: 'st1' },
|
||||
|
||||
'heredocs': { pattern: /(<<<\s*?('?)([A-Z0-9]+)\2[^\n]*?\n[\s\S]*?\n\3(?![A-Z0-9\s]))/gim, alias: 'st1' },
|
||||
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][\-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi, alias: 'nu0' },
|
||||
|
||||
'variables': { pattern: /\$[A-Z_][\w]*/gim, alias: 'kw3' },
|
||||
|
||||
'functions': { pattern: this.common.functionCalls, alias: 'me0' },
|
||||
'methods': { pattern: /(?:->|::)([\w]+)/gim, alias: 'me1' },
|
||||
|
||||
'constants': { pattern: /\b[A-Z][A-Z0-9_]+[A-Z]\b/g, alias: 'kw4' },
|
||||
'lconstants': { pattern: /\b__[A-Z][A-Z0-9_]+__\b/g, alias: 're0' },
|
||||
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
'symbols': { pattern: /!|@|&|<|>|=|=>|-|\+/g, alias: 'sy0' }
|
||||
};
|
||||
|
||||
// Delimiters
|
||||
this.delimiters = {
|
||||
start: this.strictRegExp('<?php'),
|
||||
end: this.strictRegExp('?>')
|
||||
};
|
||||
}
|
||||
});
|
106
EnlighterJS/Source/Language/Python.js
Normal file
106
EnlighterJS/Source/Language/Python.js
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
---
|
||||
description: Python language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Italo Maia
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.python]
|
||||
...
|
||||
*/
|
||||
EJS.Language.python = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function()
|
||||
{
|
||||
this.keywords = {
|
||||
reserved:{
|
||||
csv:"and, del, from, not, while, as, elif, global, or, with, assert, else, if, pass, yield, break, except, import, print, class, exec, in, raise, continue, finally, is, return, def, for, lambda, try",
|
||||
alias:'kw1'
|
||||
},
|
||||
functions:{
|
||||
csv:"__import__, abs, all, any, apply, bin, callable, chr, cmp, coerce, compile, delattr, dir, divmod, eval, execfile, filter, format, getattr, globals, hasattr, hash, hex, id, input, intern, isinstance, issubclass, iter, len, locals, map, max, min, next, oct, open, ord, pow, print, range, raw_input, reduce, reload, repr, round, setattr, sorted, sum, unichr, vars, zip",
|
||||
alias:'kw2'
|
||||
},
|
||||
classes:{
|
||||
csv:"ArithmeticError, AssertionError, AttributeError, BaseException, BufferError, BytesWarning, DeprecationWarning, EOFError, EnvironmentError, Exception, FloatingPointError, FutureWarning, GeneratorExit, IOError, ImportError, ImportWarning, IndentationError, IndexError, KeyError, KeyboardInterrupt, LookupError, MemoryError, NameError, NotImplementedError, OSError, OverflowError, PendingDeprecationWarning, ReferenceError, RuntimeError, RuntimeWarning, StandardError, StopIteration, SyntaxError, SyntaxWarning, SystemError, SystemExit, TabError, TypeError, UnboundLocalError, UnicodeDecodeError, UnicodeEncodeError, UnicodeError, UnicodeTranslateError, UnicodeWarning, UserWarning, ValueError, Warning, ZeroDivisionError, basestring, bool, buffer, bytearray, bytes, classmethod, complex, dict, enumerate, file, float, frozenset, int, list, long, object, property, reversed, set, slice, staticmethod, str, super, tuple, type, unicode, xrange",
|
||||
alias:'kw2'
|
||||
}
|
||||
},
|
||||
|
||||
this.patterns = {
|
||||
'poundComments': {
|
||||
pattern: this.common.poundComments,
|
||||
alias:'co1'
|
||||
},
|
||||
/*
|
||||
'multiComments': {
|
||||
pattern: /^=begin[\s\S]*?^=end/gm,
|
||||
alias: 'co2'
|
||||
},*/
|
||||
'multiStringComments1': {
|
||||
pattern: /"""[\s\S]*?"""/gm,
|
||||
alias: 'co2'
|
||||
},
|
||||
'multiStringComments2': {
|
||||
pattern: /'''[\s\S]*?'''/gm,
|
||||
alias: 'co2'
|
||||
},
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
'tickStrings': {
|
||||
pattern: this.delimToRegExp("`","\\","`","gm"),
|
||||
alias: 'st0'
|
||||
},
|
||||
'delimString': {
|
||||
pattern: /(%[q|Q|x]?(\W)[^\2\\\n]*(?:\\.[^\2\\]*)*(\2|\)|\]|\}))/gm,
|
||||
alias: 'st1'
|
||||
},
|
||||
'heredoc': {
|
||||
pattern: /(<<(\'?)([A-Z0-9]+)\2[^\n]*?\n[\s\S]*\n\3(?![\w]))/gim,
|
||||
alias: 'st2'
|
||||
},
|
||||
'variables': {
|
||||
pattern: /(@[A-Za-z_][\w]*|@@[A-Za-z_][\w]*|\$(?:\-[\S]|[\w]+)|\b[A-Z][\w]*)/g,
|
||||
alias: 'kw3'
|
||||
},
|
||||
'rubySymbols': {
|
||||
pattern: /[^:](:[\w]+)/g,
|
||||
alias: 'kw4'
|
||||
},
|
||||
'constants': {
|
||||
pattern: /\b[A-Z][\w]*/g,
|
||||
alias: 'kw3'
|
||||
},
|
||||
'numbers': {
|
||||
pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim,
|
||||
alias: 'nu0'
|
||||
},
|
||||
'properties': {
|
||||
pattern: this.common.properties,
|
||||
alias: 'me0'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
},
|
||||
'delimRegex': {
|
||||
pattern: /(%r(\W)[^\2\\\n]*(?:\\.[^\2\\\n]*?)*(\2|\)|\]|\})[iomx]*)/gm,
|
||||
alias: 're0'
|
||||
},
|
||||
'literalRegex': {
|
||||
pattern: this.delimToRegExp("/","\\","/","g","[iomx]*"),
|
||||
alias: 're0'
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
});
|
41
EnlighterJS/Source/Language/RAW.js
Normal file
41
EnlighterJS/Source/Language/RAW.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
---
|
||||
description: RAW Code
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.raw]
|
||||
...
|
||||
*/
|
||||
EJS.Language.raw = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
initialize: function(code) {
|
||||
this.code = code;
|
||||
},
|
||||
|
||||
getTokens: function(){
|
||||
// create token object
|
||||
var token = (function(text, alias, index){
|
||||
return {
|
||||
text: text,
|
||||
alias: alias,
|
||||
index: index,
|
||||
length: text.length,
|
||||
end: text.length + index
|
||||
}
|
||||
});
|
||||
|
||||
// raw means "no-highlight" - return a single, unknown token with the given sourcecode
|
||||
return [
|
||||
token(this.code, '', 0)
|
||||
];
|
||||
}
|
||||
});
|
62
EnlighterJS/Source/Language/Ruby.js
Normal file
62
EnlighterJS/Source/Language/Ruby.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
---
|
||||
description: Ruby language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.ruby]
|
||||
...
|
||||
*/
|
||||
EJS.Language.ruby = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function()
|
||||
{
|
||||
this.keywords = {
|
||||
reserved: {
|
||||
csv: "__FILE__, __LINE__, alias, and, BEGIN, begin, break, case, class, def, defined, do, else, elsif, END, end, ensure, false, for, if, in, module, next, nil, not, or, redo, rescue, retry, return, self, super, then, true, undef, unless, until, when, while, yield",
|
||||
alias: 'kw1'
|
||||
},
|
||||
functions: {
|
||||
csv: "abort, at_exit, autoload, binding, block_given, callcc, caller, catch, chomp, chop, eval, exec, exit, exit!, fail, fork, format, gets, global_variables, gsub, lambda, proc, load, local_variables, loop, open, p, print, proc, putc, puts, raise, fail, rand, readline, readlines, require, scan, select, set_trace_func, sleep, split, sprintf, format, srand, syscall, system, sub, test, throw, trace_var, trap, untrace_var",
|
||||
alias: 'kw2'
|
||||
},
|
||||
classes: {
|
||||
csv: "Abbrev, ArgumentError, Array, Base64, Benchmark, Benchmark::Tms, Bignum, Binding, CGI, Cookie, HtmlExtension, QueryExtension, Session, FileStore, MemoryStore, Class, Comparable, Complex, ConditionVariable, Continuation, Data, Date, DateTime, Dir, EOFError, Enumerable, Errno, Exception, FalseClass, File, Constants, Stat, FileTest, FileUtils, CopyContext_, DryRun, NoWrite, Verbose, Find, Fixnum, Float, FloatDomainError, GC, Generator, Hash, IO, IOError, Iconv, Failure, IllegalSequence, InvalidCharacter, OutOfRange, IndexError, Integer, Interrupt, Kernel, LoadError, LocalJumpError, Logger, Application, LogDevice, Severity, ShiftingError, Marshal, MatchData, Math, Matrix, Method, Module, Mutex, NameError, NilClass, NoMemoryError, NoMethodError, NotImplementedError, Numeric, Object, ObjectSpace, Observable, Pathname, Precision, Proc, Process, GID, Status, Sys, UID, Queue, Range, RangeError, Regexp, RegexpError, RuntimeError, ScriptError, SecurityError, Set, Shellwords, Signal, SignalException, Singleton, SingletonClassMethods, SizedQueue, SortedSet, StandardError, String, StringScanner, StringScanner::Error, Struct, Symbol, SyncEnumerator, SyntaxError, SystemCallError, SystemExit, SystemStackError, Tempfile, Test, Unit, Thread, ThreadError, ThreadGroup, ThreadsWait, Time, TrueClass, TypeError, UnboundMethod, Vector, YAML, ZeroDivisionError, Zlib, BufError, DataError, Deflate, Error, GzipFile, CRCError, Error, LengthError, NoFooter, GzipReader, GzipWriter, Inflate, MemError, NeedDict, StreamEnd, StreamError, VersionError, ZStream, fatal",
|
||||
alias: 'kw2'
|
||||
}
|
||||
},
|
||||
|
||||
this.patterns = {
|
||||
'poundComments': { pattern: this.common.poundComments, alias: 'co1' },
|
||||
'multiComments': { pattern: /^=begin[\s\S]*?^=end/gm, alias: 'co2' },
|
||||
|
||||
'strings': { pattern: this.common.strings, alias: 'st0' },
|
||||
'tickStrings': { pattern: this.delimToRegExp("`", "\\", "`", "gm"), alias: 'st0' },
|
||||
'delimString': { pattern: /(%[q|Q|x]?(\W)[^\2\\\n]*(?:\\.[^\2\\]*)*(\2|\)|\]|\}))/gm, alias: 'st1' },
|
||||
'heredoc': { pattern: /(<<(\'?)([A-Z0-9]+)\2[^\n]*?\n[\s\S]*\n\3(?![\w]))/gim, alias: 'st2' },
|
||||
|
||||
//'instanceVar': { pattern: /@[A-Z_][\w]*/gi, alias: 'kw3' },
|
||||
//'classVar': { pattern: /@@[A-Z_][\w]*/gi, alias: 'kw3' },
|
||||
//'globalVar': { pattern: /\$(?:\-[\S]|[\w]+)/gi, alias: 'kw3' },
|
||||
'variables': { pattern: /(@[A-Za-z_][\w]*|@@[A-Za-z_][\w]*|\$(?:\-[\S]|[\w]+)|\b[A-Z][\w]*)/g, alias: 'kw3' },
|
||||
'rubySymbols': { pattern: /[^:](:[\w]+)/g, alias: 'kw4' },
|
||||
'constants': { pattern: /\b[A-Z][\w]*/g, alias: 'kw3' },
|
||||
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim, alias: 'nu0' },
|
||||
'properties': { pattern: this.common.properties, alias: 'me0' },
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
|
||||
'delimRegex': { pattern: /(%r(\W)[^\2\\\n]*(?:\\.[^\2\\\n]*?)*(\2|\)|\]|\})[iomx]*)/gm, alias: 're0' },
|
||||
'literalRegex': { pattern: this.delimToRegExp("/", "\\", "/", "g", "[iomx]*"), alias: 're0' }
|
||||
};
|
||||
|
||||
}
|
||||
});
|
65
EnlighterJS/Source/Language/Rust.js
Normal file
65
EnlighterJS/Source/Language/Rust.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
---
|
||||
description: Rust Language https://doc.rust-lang.org
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.rust]
|
||||
...
|
||||
*/
|
||||
EJS.Language.rust = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function() {
|
||||
this.keywords = {
|
||||
// keywords: https://doc.rust-lang.org/syntax/parse/token/keywords/enum.Keyword.html
|
||||
kw: {
|
||||
csv: "As,Break,Crate,Else,Enum,Extern,False,Fn,For,If,Impl,In,Let,Loop,Match,Mod,Move,Mut,Pub,Ref,Return,Static,SelfValue,SelfType,Struct,Super,True,Trait,Type,Unsafe,Use,Virtual,While,Continue,Box,Const,Where,Proc,Alignof,Become,Offsetof,Priv,Pure,Sizeof,Typeof,Unsized,Yield,Do,Abstract,Final,Override,Macro",
|
||||
alias: 'kw1',
|
||||
mod: 'gi'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1'},
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co1'},
|
||||
|
||||
'slashDocComments': { pattern: /(?:^|[^\\])\/\/[\/!].*$/gm, alias: 'co2'},
|
||||
'multiDocComments': { pattern: /\/\*[\*!][\s\S]*?\*\//gm, alias: 'co2'},
|
||||
|
||||
'chars': { pattern: /'.'/gm, alias: 'st0' },
|
||||
'rawStrings': { pattern: /r((#+)".*?"\2)/gm, alias: 'st1' },
|
||||
'strings': { pattern: /("(?:\\.|\\\s*\n|\\s*\r\n|[^\\"])*")/g, alias: 'st1' },
|
||||
|
||||
'directives': { pattern: /^\s*#.*$/gm, alias: 'sy0'},
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
|
||||
// https://doc.rust-lang.org/stable/reference.html#integer-literals
|
||||
'intLiteral': { pattern: /\b([0-9_]+|0o[0-9_]+|0x[A-F0-9_]+|0b[0-1_]+)(u8|i8|u16|i16|u32|i32|u64|i64|isize|usize)?\b/gim, alias: 'nu0' },
|
||||
|
||||
// https://doc.rust-lang.org/stable/reference.html#floating-point-literals
|
||||
'floatLiteral': { pattern: /\b([0-9_]+\.?[0-9_]+?(e\+[0-9_]+)?)(?:f32|f64)?\b/gim, alias: 'nu0' },
|
||||
|
||||
// method definitions
|
||||
'methodDefs': {pattern: /fn\s+([\w]+)\s*(<\w+\s*>)?\(/gm, alias: 'kw2'},
|
||||
|
||||
// method/function calls
|
||||
'funCalls': {pattern: /\b\.?([\w]+)\s*(\(|::)/gm, alias: 'kw3'},
|
||||
|
||||
// macro calls
|
||||
'macro': {pattern: /\b([\w]+)!/gm, alias: 'kw4'},
|
||||
|
||||
'symbols': {
|
||||
pattern: /\+|-|\*|\/|%|!|@|&|\||\^|<|<<|>>|>|=|,|\.|;|\?|:|self/g,
|
||||
alias: 'sy0'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
59
EnlighterJS/Source/Language/Shell.js
Normal file
59
EnlighterJS/Source/Language/Shell.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
---
|
||||
description: Shell/Bash Scripting
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.shell]
|
||||
...
|
||||
*/
|
||||
EJS.Language.shell = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
keywords: {
|
||||
csv: 'if, fi, then, elif, else, for, do, done, until, while, break, continue, case, esac, return, function, in, eq, ne, gt, lt, ge, le',
|
||||
alias: 'kw1'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'comments': {
|
||||
pattern: /((?:^\s*|\s+)#.*$)/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st0'
|
||||
},
|
||||
'backticks': {
|
||||
pattern: /`.*?`/gm,
|
||||
alias: 'st1'
|
||||
},
|
||||
'cases': {
|
||||
pattern: /^\s*\w+\)\s*$/gm,
|
||||
alias: 'kw2'
|
||||
},
|
||||
'def': {
|
||||
pattern: /^(\s*\w+)=/gm,
|
||||
alias: 'kw4'
|
||||
},
|
||||
'vars': {
|
||||
pattern: /(\$\w+)\b/gim,
|
||||
alias: 'kw4'
|
||||
},
|
||||
'functions': {
|
||||
pattern: /^\s*\w+\(\)\s*\{/gm,
|
||||
alias: 'kw3'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
48
EnlighterJS/Source/Language/Sql.js
Normal file
48
EnlighterJS/Source/Language/Sql.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
---
|
||||
description: SQL Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.sql]
|
||||
...
|
||||
*/
|
||||
EJS.Language.sql = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
keywords: {
|
||||
csv: 'savepoint, start, absolute, action, add, after, alter, as, asc, at, authorization, begin, bigint, binary, bit, by, cascade, char, character, check, checkpoint, close, collate, column, commit, committed, connect, connection, constraint, contains, continue, create, cube, current, current_date, current_time, cursor, database, date, deallocate, dec, decimal, declare, default, delete, desc, distinct, double, drop, dynamic, else, end, end-exec, escape, except, exec, execute, false, fetch, first, float, for, force, foreign, forward, free, from, full, function, global, goto, grant, group, grouping, having, hour, ignore, index, inner, insensitive, insert, instead, int, integer, intersect, into, is, isolation, key, last, level, load, local, max, min, minute, modify, move, name, national, nchar, next, no, numeric, of, off, on, only, open, option, order, out, output, partial, password, precision, prepare, primary, prior, privileges, procedure, public, read, real, references, relative, repeatable, restrict, return, returns, revoke, rollback, rollup, rows, rule, schema, scroll, second, section, select, sequence, serializable, set, size, smallint, static, statistics, table, temp, temporary, then, time, timestamp, to, top, transaction, translation, trigger, true, truncate, uncommitted, union, unique, update, values, varchar, varying, view, when, where, with, work',
|
||||
alias: 'kw1',
|
||||
mod: 'gi'
|
||||
},
|
||||
functions: {
|
||||
csv: 'abs, avg, case, cast, coalesce, convert, count, current_timestamp, current_user, day, isnull, left, lower, month, nullif, replace, right, session_user, space, substring, sum, system_user, upper, user, year',
|
||||
alias: 'kw2',
|
||||
mod: 'gi'
|
||||
},
|
||||
operators: {
|
||||
csv: 'all, and, any, between, cross, in, join, like, not, null, or, outer, some, if',
|
||||
alias: 'kw3',
|
||||
mod: 'gi'
|
||||
}
|
||||
},
|
||||
|
||||
this.patterns = {
|
||||
'singleLineComments': {pattern: /--(.*)$/gm, alias: 'co1'},
|
||||
'multiLineComments': {pattern: this.common.multiComments, alias: 'co2'},
|
||||
'multiLineStrings': {pattern: this.common.multiLineStrings, alias: 'st0'},
|
||||
'numbers': {pattern: this.common.numbers, alias: 'nu0'},
|
||||
'columns': {pattern: /`[^`\\]*(?:\\.[^`\\]*)*`/gm, alias: 'kw4'}
|
||||
};
|
||||
}
|
||||
});
|
55
EnlighterJS/Source/Language/Squirrel.js
Normal file
55
EnlighterJS/Source/Language/Squirrel.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
---
|
||||
description: Squirrel Language http://www.squirrel-lang.org/
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
- Devyn Collier Johnson
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.squirrel]
|
||||
...
|
||||
*/
|
||||
EJS.Language.squirrel = new Class({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function() {
|
||||
this.keywords = {
|
||||
reserved: {
|
||||
csv: "base,break,case,catch,class,clone,constructor,continue,const,default,delete,else,enum,extends,false,for,foreach,function,if,in,instanceof,local,null,resume,return,static,switch,this,throw,true,try,typeof,while,yield",
|
||||
alias: 'kw1'
|
||||
},
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'slashComments': { pattern: this.common.slashComments, alias: 'co1'},
|
||||
|
||||
'poundComments': { pattern: this.common.poundComments, alias: 'co1'},
|
||||
|
||||
'multiComments': { pattern: this.common.multiComments, alias: 'co2'},
|
||||
|
||||
'strings': { pattern: this.common.doubleQuotedString, alias: 'st0' },
|
||||
|
||||
//'annotation': { pattern: /@[\W\w_][\w\d_]+/gm, alias: 'st1' },
|
||||
|
||||
// int, float, octals, hex
|
||||
'numbers': { pattern: /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+)\b/gim, alias: 'nu0' },
|
||||
|
||||
// chars are handled as numbers
|
||||
'charnumber': { pattern: this.common.singleQuotedString, alias: 'nu0' },
|
||||
|
||||
'brackets': { pattern: this.common.brackets, alias: 'br0' },
|
||||
|
||||
'functionCalls': { pattern: this.common.functionCalls, alias: 'me0'},
|
||||
|
||||
'methodCalls': { pattern: this.common.methodCalls, alias: 'me1'},
|
||||
|
||||
'properties': { pattern: this.common.properties, alias: 'me1' }
|
||||
};
|
||||
}
|
||||
});
|
92
EnlighterJS/Source/Language/Template.mylang.js
Normal file
92
EnlighterJS/Source/Language/Template.mylang.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
---
|
||||
description: Template to build custom languages for EnlighterJS.
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.mylang]
|
||||
...
|
||||
*/
|
||||
// your language is identified by it`s (lowercase!) classname - for example "mylang" is used
|
||||
// you can try out this example using Development.html - it is not included in regular builds!
|
||||
EnlighterJS.Language.mylang = new Class({
|
||||
|
||||
// every language have to extend the generic language or in case it's a superset the origin language
|
||||
Extends : EnlighterJS.Language.generic,
|
||||
|
||||
// override the setupLanguage() method to configure your language-patterns
|
||||
setupLanguage: function(){
|
||||
// a set of keywords-groups to highlight
|
||||
// you can define multiple keyword-groups within, each containg a list of comma seperated keywords ("csv") and an alias with the matching css-class to highlight
|
||||
// keep these lists AS SMALL AS POSSIBLE - use regex if possible
|
||||
this.keywords = {
|
||||
langElements : {
|
||||
csv : 'if, else, endif, elseif, then',
|
||||
alias : 'kw1'
|
||||
},
|
||||
output: {
|
||||
csv: 'echo',
|
||||
alias: 'kw3'
|
||||
}
|
||||
};
|
||||
|
||||
// a set of patterns used to match your language
|
||||
// some generic patterns are already defined into EnlighterJS.Language.generic - you can access them with this.common
|
||||
// like keywords, each pattern requires an alias with the matching css-class
|
||||
// the tokenizer will take respect to the list ordering (priority)
|
||||
this.patterns = {
|
||||
// mylang uses slash-style-comments
|
||||
'slashComments' : {
|
||||
pattern : this.common.slashComments,
|
||||
alias : 'co1'
|
||||
},
|
||||
|
||||
// single and double quoted strings are used
|
||||
'chars' : {
|
||||
pattern : this.common.singleQuotedString,
|
||||
alias : 'st0'
|
||||
},
|
||||
'strings' : {
|
||||
pattern : this.common.doubleQuotedString,
|
||||
alias : 'st0'
|
||||
},
|
||||
|
||||
// annotations starting with an @
|
||||
'annotation' : {
|
||||
pattern : /@[\W\w_][\w\d_]+/gm,
|
||||
alias : 'st1'
|
||||
},
|
||||
|
||||
// special regex pattern is used to match numbers
|
||||
'numbers' : {
|
||||
pattern : /\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+|0b[0-1_]+)\b/gim,
|
||||
alias : 'nu0'
|
||||
},
|
||||
|
||||
// standard function calls are used
|
||||
'functionCalls' : {
|
||||
pattern : this.common.functionCalls,
|
||||
alias : 'de1'
|
||||
},
|
||||
|
||||
// directives starting with an hash
|
||||
'directives' : {
|
||||
pattern : /#.*$/gm,
|
||||
alias : 'kw2'
|
||||
}
|
||||
};
|
||||
|
||||
// maybe "mylang" is a scripting language and uses start/stop "tags"
|
||||
// to handle arbitrary strings, use this.strictRegExp to escape these sequences
|
||||
this.delimiters = {
|
||||
start : this.strictRegExp('<!##'),
|
||||
end : this.strictRegExp('##!>')
|
||||
};
|
||||
}
|
||||
});
|
65
EnlighterJS/Source/Language/Vhdl.js
Normal file
65
EnlighterJS/Source/Language/Vhdl.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
---
|
||||
description: VHDL Language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.vhdl]
|
||||
...
|
||||
*/
|
||||
EJS.Language.vhdl = new Class ({
|
||||
|
||||
Extends: EJS.Language.generic,
|
||||
|
||||
setupLanguage: function(){
|
||||
this.keywords = {
|
||||
keywords: {
|
||||
csv: 'abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block,body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,entity,exit,file,for,function,generate,generic,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage,literal,loop,map,mod,nand,new,next,nor,not,null,of,on,open,or,others,out,package,port,postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal,shared,sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor',
|
||||
alias: 'kw1',
|
||||
mod: 'gi'
|
||||
},
|
||||
operators: {
|
||||
csv: 'abs,not,mod,rem,sll,srl,sla,sra,rol,ror,and,or,nand,nor,xor,xnor',
|
||||
alias: 'sy0'
|
||||
}
|
||||
};
|
||||
|
||||
this.patterns = {
|
||||
'comments': {
|
||||
pattern: /((?:^\s*|\s+)--.*$)/gm,
|
||||
alias: 'co1'
|
||||
},
|
||||
|
||||
'uses': {
|
||||
pattern: /^\s*(?:use|library)\s*(\S+);/gim,
|
||||
alias: 'kw4'
|
||||
},
|
||||
'functions': {
|
||||
pattern: this.common.functionCalls,
|
||||
alias: 'kw2'
|
||||
},
|
||||
operators: {
|
||||
pattern: /\*\*|\*|\/|\+|\-|&|=|\/=|<|<=|>|>=/g,
|
||||
alias: 'sy0'
|
||||
},
|
||||
'strings': {
|
||||
pattern: this.common.strings,
|
||||
alias: 'st1'
|
||||
},
|
||||
'numbers': {
|
||||
pattern: this.common.numbers,
|
||||
alias: 'nu0'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: this.common.brackets,
|
||||
alias: 'br0'
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
48
EnlighterJS/Source/Language/Xml.js
Normal file
48
EnlighterJS/Source/Language/Xml.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
---
|
||||
description: XML/HTML language
|
||||
|
||||
license: MIT-style
|
||||
|
||||
authors:
|
||||
- Jose Prado
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.Language.xml]
|
||||
...
|
||||
*/
|
||||
EnlighterJS.Language.xml = new Class({
|
||||
|
||||
Extends : EnlighterJS.Language.generic,
|
||||
tokenizerType : 'Xml',
|
||||
|
||||
setupLanguage: function(){
|
||||
// Common HTML patterns
|
||||
this.patterns = {
|
||||
'comments' : {
|
||||
pattern : /(?:<|<)!--[\s\S]*?--(?:>|>)/gim,
|
||||
alias : 'co2'
|
||||
},
|
||||
'cdata' : {
|
||||
pattern : /(?:<|<)!\[CDATA\[[\s\S]*?]](?:>|>)/gim,
|
||||
alias : 'st1'
|
||||
},
|
||||
'closingTags' : {
|
||||
pattern : /(?:<|<)\/[A-Z:_][A-Z0-9:.-]*?(?:>|>)/gi,
|
||||
alias : 'kw1'
|
||||
},
|
||||
'doctype' : {
|
||||
pattern : /(?:<|<)!DOCTYPE[\s\S]+?(?:>|>)/gim,
|
||||
alias : 'st2'
|
||||
},
|
||||
'version' : {
|
||||
pattern : /(?:<|<)\?xml[\s\S]+?\?(?:>|>)/gim,
|
||||
alias : 'kw2'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue