0

Update to 7.1

This commit is contained in:
Rei
2012-08-14 22:13:27 +08:00
parent c48a19bb3f
commit 7d6da30689
84 changed files with 4179 additions and 2385 deletions

View File

@@ -4,39 +4,15 @@ Description: Erlang is a general-purpose functional language, with strict evalua
Author: Nikolay Zakharov <nikolay.desh@gmail.com>, Dmitry Kovega <arhibot@gmail.com>
*/
hljs.LANGUAGES.erlang = function(){
hljs.LANGUAGES['erlang'] = 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': 1,
'and': 1,
'andalso': 10,
'band': 1,
'begin': 1,
'bnot': 1,
'bor': 1,
'bsl': 1,
'bzr': 1,
'bxor': 1,
'case': 1,
'catch': 1,
'cond': 1,
'div': 1,
'end': 1,
'fun': 1,
'let': 1,
'not': 1,
'of': 1,
'orelse': 10,
'query': 1,
'receive': 1,
'rem': 1,
'try': 1,
'when': 1,
'xor': 1
},
'literal': {'false': 1, 'true': 1}
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 = {
@@ -44,6 +20,11 @@ hljs.LANGUAGES.erlang = function(){
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+'
};
@@ -110,7 +91,7 @@ hljs.LANGUAGES.erlang = function(){
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
@@ -122,7 +103,7 @@ hljs.LANGUAGES.erlang = function(){
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
@@ -134,7 +115,6 @@ hljs.LANGUAGES.erlang = function(){
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)',
endsWithParent: true,
contains: BASIC_MODES
};
return {
@@ -144,19 +124,20 @@ hljs.LANGUAGES.erlang = function(){
contains: [
{
className: 'function',
begin: '^' + BASIC_ATOM_RE + '\\(', end: ';|\\.',
begin: '^' + BASIC_ATOM_RE + '\\s*\\(', end: '->',
returnBegin: true,
illegal: '\\(|#|//|/\\*|\\\\|:',
contains: [
PARAMS,
{
className: 'title', begin: BASIC_ATOM_RE
},
{
keywords: ERLANG_RESERVED,
begin: '->', endsWithParent: true,
contains: BASIC_MODES
}
]
],
starts: {
end: ';|\\.',
keywords: ERLANG_RESERVED,
contains: BASIC_MODES
}
},
COMMENT,
{
@@ -166,31 +147,13 @@ hljs.LANGUAGES.erlang = function(){
excludeEnd: true,
returnBegin: true,
lexems: '-' + hljs.IDENT_RE,
keywords: {
'-module':1,
'-record':1,
'-undef':1,
'-export':1,
'-ifdef':1,
'-ifndef':1,
'-author':1,
'-copyright':1,
'-doc':1,
'-vsn':1,
'-import': 1,
'-include': 1,
'-include_lib': 1,
'-compile': 1,
'-define': 1,
'-else': 1,
'-endif': 1,
'-file': 1,
'-behaviour': 1,
'-behavior': 1
},
keywords:
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior',
contains: [PARAMS]
},
hljs.C_NUMBER_MODE,
NUMBER,
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1, VAR2,
@@ -198,4 +161,4 @@ hljs.LANGUAGES.erlang = function(){
]
}
};
}();
}(hljs);