0

Update to 8.0

This commit is contained in:
Rogaboru Kujimoshi
2014-06-08 21:04:39 +04:00
parent 81d0115677
commit a52831ccdb
134 changed files with 10392 additions and 4999 deletions

View File

@@ -1,62 +1,67 @@
/*
Language: Rust
Author: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
Contributors: Roman Shmatov <romanshmatov@gmail.com>
*/
hljs.LANGUAGES['rust'] = function(hljs) {
var TITLE = {
className: 'title',
begin: hljs.UNDERSCORE_IDENT_RE
};
var QUOTE_STRING = {
className: 'string',
begin: '"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE],
relevance: 0
};
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 =
'alt any as assert be bind block bool break char check claim const cont dir do else enum ' +
'export f32 f64 fail false float fn for i16 i32 i64 i8 if iface impl import in int let ' +
'log mod mutable native note of prove pure resource ret self str syntax true type u16 u32 ' +
'u64 u8 uint unchecked unsafe use vec while';
function(hljs) {
return {
defaultMode: {
keywords: KEYWORDS,
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
QUOTE_STRING,
hljs.APOS_STRING_MODE,
NUMBER,
{
className: 'function',
beginWithKeyword: true, end: '(\\(|<)',
keywords: 'fn',
contains: [TITLE]
},
{
className: 'preprocessor',
begin: '#\\[', end: '\\]'
},
{
beginWithKeyword: true, end: '(=|<)',
keywords: 'type',
contains: [TITLE],
illegal: '\\S'
},
{
beginWithKeyword: true, end: '({|<)',
keywords: 'iface enum',
contains: [TITLE],
illegal: '\\S'
}
]
}
aliases: ['rs'],
keywords:
'alignof as be box break const continue crate do else enum extern ' +
'false fn for if impl in let loop match mod mut offsetof once priv ' +
'proc pub pure ref return self sizeof static struct super trait true ' +
'type typeof unsafe unsized use virtual while yield ' +
'int i8 i16 i32 i64 ' +
'uint u8 u32 u64 ' +
'float f32 f64 ' +
'str char bool',
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
{
className: 'string',
begin: /r(#*)".*?"\1(?!#)/
},
{
className: 'string',
begin: /'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/
},
{
begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
},
{
className: 'number',
begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)',
relevance: 0
},
{
className: 'function',
beginKeywords: 'fn', end: '(\\(|<)', excludeEnd: true,
contains: [hljs.UNDERSCORE_TITLE_MODE]
},
{
className: 'preprocessor',
begin: '#\\[', end: '\\]'
},
{
beginKeywords: 'type', end: '(=|<)',
contains: [hljs.UNDERSCORE_TITLE_MODE],
illegal: '\\S'
},
{
beginKeywords: 'trait enum', end: '({|<)',
contains: [hljs.UNDERSCORE_TITLE_MODE],
illegal: '\\S'
},
{
begin: hljs.IDENT_RE + '::'
},
{
begin: '->'
}
]
};
}(hljs);
}