Update hirust.js

f0b3f257ab9bef1adf87d672ee5050a924215d96
Alexis Sellier committed ago 1 parent 1caf2258
js/hirust.js +7 -3
6 6
//
7 7
8 8
// All elements which match this will be syntax highlighted.
9 9
var selector = hirust || '.language-rust';
10 10
11 -
var keywords = ('fn pub if else for while break match struct type let impl ref mut use mod self '
12 -
               +'continue return true false panic! loop').split(' '),
11 +
var keywords = ('fn pub if else for while break match struct enum type let impl use mod self '
12 +
               +'continue return true false loop in unsafe where crate super').split(' '),
13 13
    special  = ('Ok Err Result').split(' ');
14 14
15 15
// Syntax definition.
16 16
//
17 17
// The key becomes the class name of the <span> around the matched block of code.
18 18
var syntax = [
19 19
  ['comment', /(\/\/[^\n]*)/g],
20 -
  ['string' , /("(?:(?!")[^\\\n]|\\.)*"|'(?:(?!')[^\\\n]|\\.)*')/g],
20 +
  ['string' , /("(?:(?!")[^\\\n]|\\.)*"|'[^\\\n']')/g],
21 +
  ['attr'   , /(#\[[^\]]+\])/g],
21 22
  ['number' , /\b([0-9]+(?:\.[0-9]+)?)\b/g],
23 +
  ['ref'    , /(&mut\b|\bmut\b|&)\b/g],
24 +
  ['op'     , /(::|\.\.)/g],
25 +
  ['macro'  , /\b(println!|eprintln!|panic!|assert!|assert_eq!)/g],
22 26
  ['keyword', new(RegExp)('\\b(' + keywords.join('|') + ')\\b', 'g')],
23 27
  ['special', new(RegExp)('\\b(' + special.join('|') + ')\\b', 'g')]
24 28
];
25 29
var nodes, table = {};
26 30