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

@@ -3,50 +3,43 @@ Language: Lua
Author: Andrew Fedorov <dmmdrs@mail.ru>
*/
hljs.LANGUAGES.lua = function() {
hljs.LANGUAGES['lua'] = function(hljs) {
var OPENING_LONG_BRACKET = '\\[=*\\[';
var CLOSING_LONG_BRACKET = '\\]=*\\]';
var LONG_BRACKETS = {
begin: OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET
};
LONG_BRACKETS.contains = [LONG_BRACKETS];
var COMMENT1 = {
className: 'comment',
begin: '--(?!' + OPENING_LONG_BRACKET + ')', end: '$'
};
var COMMENT2 = {
className: 'comment',
begin: '--' + OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET,
contains: [LONG_BRACKETS],
relevance: 10
begin: OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET,
contains: ['self']
};
var COMMENTS = [
{
className: 'comment',
begin: '--(?!' + OPENING_LONG_BRACKET + ')', end: '$'
},
{
className: 'comment',
begin: '--' + OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET,
contains: [LONG_BRACKETS],
relevance: 10
}
]
return {
defaultMode: {
lexems: hljs.UNDERSCORE_IDENT_RE,
keywords: {
'keyword': {
'and': 1, 'break': 1, 'do': 1, 'else': 1, 'elseif': 1, 'end': 1,
'false': 1, 'for': 1, 'if': 1, 'in': 1, 'local': 1, 'nil': 1,
'not': 1, 'or': 1, 'repeat': 1, 'return': 1, 'then': 1, 'true': 1,
'until': 1, 'while': 1
},
'built_in': {
'_G': 1, '_VERSION': 1, 'assert': 1, 'collectgarbage': 1, 'dofile': 1,
'error': 1, 'getfenv': 1, 'getmetatable': 1, 'ipairs': 1, 'load': 1,
'loadfile': 1, 'loadstring': 1, 'module': 1, 'next': 1, 'pairs': 1,
'pcall': 1, 'print': 1, 'rawequal': 1, 'rawget': 1, 'rawset': 1,
'require': 1, 'select': 1, 'setfenv': 1, 'setmetatable': 1,
'tonumber': 1, 'tostring': 1, 'type': 1, 'unpack': 1, 'xpcall': 1,
'coroutine': 1, 'debug': 1, 'io': 1, 'math': 1, 'os': 1, 'package': 1,
'string': 1, 'table': 1
}
keyword:
'and break do else elseif end false for if in local nil not or repeat return then ' +
'true until while',
built_in:
'_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load ' +
'loadfile loadstring module next pairs pcall print rawequal rawget rawset require ' +
'select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug ' +
'io math os package string table'
},
contains: [
COMMENT1, COMMENT2,
contains: COMMENTS.concat([
{
className: 'function',
begin: '\\bfunction\\b', end: '\\)',
keywords: {'function': 1},
beginWithKeyword: true, end: '\\)',
keywords: 'function',
contains: [
{
className: 'title',
@@ -55,10 +48,9 @@ hljs.LANGUAGES.lua = function() {
{
className: 'params',
begin: '\\(', endsWithParent: true,
contains: [COMMENT1, COMMENT2]
},
COMMENT1, COMMENT2
]
contains: COMMENTS
}
].concat(COMMENTS)
},
hljs.C_NUMBER_MODE,
hljs.APOS_STRING_MODE,
@@ -69,7 +61,7 @@ hljs.LANGUAGES.lua = function() {
contains: [LONG_BRACKETS],
relevance: 10
}
]
])
}
};
}();
}(hljs);