1/* 2Language: Javascript 3*/ 4 5hljs.LANGUAGES.javascript = { 6 defaultMode: { 7 lexems: [hljs.UNDERSCORE_IDENT_RE], 8 contains: ['string', 'comment', 'number', 'regexp_container', 'function'], 9 keywords: { 10 'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1}, 11 'literal': {'true': 1, 'false': 1, 'null': 1} 12 } 13 }, 14 modes: [ 15 hljs.C_LINE_COMMENT_MODE, 16 hljs.C_BLOCK_COMMENT_MODE, 17 hljs.C_NUMBER_MODE, 18 hljs.APOS_STRING_MODE, 19 hljs.QUOTE_STRING_MODE, 20 hljs.BACKSLASH_ESCAPE, 21 { 22 className: 'regexp_container', 23 begin: '(' + hljs.RE_STARTERS_RE + '|case|return|throw)\\s*', end: '^', noMarkup: true, 24 lexems: [hljs.IDENT_RE], 25 keywords: {'return': 1, 'throw': 1, 'case': 1}, 26 contains: ['comment', 'regexp'], 27 relevance: 0 28 }, 29 { 30 className: 'regexp', 31 begin: '/.*?[^\\\\/]/[gim]*', end: '^' 32 }, 33 { 34 className: 'function', 35 begin: '\\bfunction\\b', end: '{', 36 lexems: [hljs.UNDERSCORE_IDENT_RE], 37 keywords: {'function': 1}, 38 contains: ['title', 'params'] 39 }, 40 { 41 className: 'title', 42 begin: '[A-Za-z$_][0-9A-Za-z$_]*', end: '^' 43 }, 44 { 45 className: 'params', 46 begin: '\\(', end: '\\)', 47 contains: ['string', 'comment'] 48 } 49 ] 50}; 51