Вход Регистрация
Файл: error-kitty/node_modules/highlight.js/lib/languages/coffeescript.js
Строк: 139
<?php
module
.exports = function(hljs) {
  var 
KEYWORDS = {
    
keyword:
      
// JS keywords
      
'in if for while finally new do return else break catch instanceof throw try this ' +
      
'switch continue typeof delete debugger super ' +
      
// Coffee keywords
      
'then unless until loop of by when and or is isnt not',
    
literal:
      
// JS literals
      
'true false null undefined ' +
      
// Coffee literals
      
'yes no on off',
    
reserved:
      
'case default function var void with const let enum export import native ' +
      
'__hasProp __extends __slice __bind __indexOf',
    
built_in:
      
'npm require console print module global window document'
  
};
  var 
JS_IDENT_RE '[A-Za-z$_][0-9A-Za-z$_]*';
  var 
TITLE hljs.inherit(hljs.TITLE_MODE, {beginJS_IDENT_RE});
  var 
SUBST = {
    
className'subst',
    
begin: /#{/, end: /}/,
    
keywordsKEYWORDS
  
};
  var 
EXPRESSIONS = [
    
hljs.BINARY_NUMBER_MODE,
    
hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end'(\s*/)?'relevance0}}), // a number tries to eat the following slash to prevent treating it as a regexp
    
{
      
className'string',
      
variants: [
        {
          
begin: /'''/, end: /'''/,
          
contains: [hljs.BACKSLASH_ESCAPE]
        },
        {
          
begin: /'/, end: /'/,
          
contains: [hljs.BACKSLASH_ESCAPE]
        },
        {
          
begin: /"""/, end: /"""/,
          
contains: [hljs.BACKSLASH_ESCAPESUBST]
        },
        {
          
begin: /"/, end: /"/,
          
contains: [hljs.BACKSLASH_ESCAPESUBST]
        }
      ]
    },
    {
      
className'regexp',
      
variants: [
        {
          
begin'///'end'///',
          
contains: [SUBSThljs.HASH_COMMENT_MODE]
        },
        {
          
begin'//[gim]*',
          
relevance0
        
},
        {
          
// regex can't start with space to parse x / 2 / 3 as two divisions
          // regex can't start with *, and it supports an "illegal" in the main mode
          
begin//(?![ *])(\/|.)*?/[gim]*(?=W|$)/
        
}
      ]
    },
    {
      
className'property',
      
begin'@' JS_IDENT_RE
    
},
    {
      
begin'`'end'`',
      
excludeBegintrueexcludeEndtrue,
      
subLanguage'javascript'
    
}
  ];
  
SUBST.contains EXPRESSIONS;

  return {
    
aliases: ['coffee''cson''iced'],
    
keywordsKEYWORDS,
    
illegal//*/,
    
containsEXPRESSIONS.concat([
      {
        
className'comment',
        
begin'###'end'###'
      
},
      
hljs.HASH_COMMENT_MODE,
      {
        
className'function',
        
begin'(^\s*|\B)(' JS_IDENT_RE '\s*=\s*)?(\(.*\))?\s*\B[-=]>'end'[-=]>',
        
returnBegintrue,
        
contains: [
          
TITLE,
          {
            
className'params',
            
begin'\([^\(]'returnBegintrue,
            
/* We need another contained nameless mode to not have every nested
            pair of parens to be called "params" */
            
contains: [{
              
begin: /(/, end: /)/,
              
keywordsKEYWORDS,
              
contains: ['self'].concat(EXPRESSIONS)
            }]
          }
        ]
      },
      {
        
className'class',
        
beginKeywords'class',
        
end'$',
        
illegal: /[:="[]]/,
        contains: [
          {
            beginKeywords: 'extends',
            endsWithParent: true,
            illegal: /[:="
[]]/,
            
contains: [TITLE]
          },
          
TITLE
        
]
      },
      {
        
className'attribute',
        
beginJS_IDENT_RE ':'end':',
        
returnBegintrueexcludeEndtrue,
        
relevance0
      
}
    ])
  };
};
?>
Онлайн: 1
Реклама