1/* 2Language: Python 3*/ 4 5hljs.LANGUAGES.python = { 6 defaultMode: { 7 lexems: [hljs.UNDERSCORE_IDENT_RE], 8 illegal: '(</|->)', 9 contains: ['comment', 'string', 'function', 'class', 'number', 'decorator'], 10 keywords: { 11 'keyword': {'and': 1, 'elif': 1, 'is': 1, 'global': 1, 'as': 1, 'in': 1, 'if': 1, 'from': 1, 'raise': 1, 'for': 1, 'except': 1, 'finally': 1, 'print': 1, 'import': 1, 'pass': 1, 'return': 1, 'exec': 1, 'else': 1, 'break': 1, 'not': 1, 'with': 1, 'class': 1, 'assert': 1, 'yield': 1, 'try': 1, 'while': 1, 'continue': 1, 'del': 1, 'or': 1, 'def': 1, 'lambda': 1}, 12 'built_in': {'None': 1, 'True': 1, 'False': 1, 'Ellipsis': 1, 'NotImplemented': 1} 13 } 14 }, 15 modes: [ 16 { 17 className: 'function', 18 lexems: [hljs.UNDERSCORE_IDENT_RE], 19 begin: '\\bdef ', end: ':', 20 illegal: '$', 21 keywords: {'def': 1}, 22 contains: ['title', 'params'], 23 relevance: 10 24 }, 25 { 26 className: 'class', 27 lexems: [hljs.UNDERSCORE_IDENT_RE], 28 begin: '\\bclass ', end: ':', 29 illegal: '[${]', 30 keywords: {'class': 1}, 31 contains: ['title', 'params',], 32 relevance: 10 33 }, 34 { 35 className: 'title', 36 begin: hljs.UNDERSCORE_IDENT_RE, end: '^' 37 }, 38 { 39 className: 'params', 40 begin: '\\(', end: '\\)', 41 contains: ['string'] 42 }, 43 hljs.HASH_COMMENT_MODE, 44 hljs.C_NUMBER_MODE, 45 { 46 className: 'string', 47 begin: 'u?r?\'\'\'', end: '\'\'\'', 48 relevance: 10 49 }, 50 { 51 className: 'string', 52 begin: 'u?r?"""', end: '"""', 53 relevance: 10 54 }, 55 hljs.APOS_STRING_MODE, 56 hljs.QUOTE_STRING_MODE, 57 hljs.BACKSLASH_ESCAPE, 58 { 59 className: 'string', 60 begin: '(u|r|ur)\'', end: '\'', 61 contains: ['escape'], 62 relevance: 10 63 }, 64 { 65 className: 'string', 66 begin: '(u|r|ur)"', end: '"', 67 contains: ['escape'], 68 relevance: 10 69 }, 70 { 71 className: 'decorator', 72 begin: '@', end: '$' 73 } 74 ] 75}; 76