Source

syntaxhighlighter / highlighter / js.py

keywords = [
 'break',
 'for',
 'throw',
 'case',
 'function',
 'try',
 'catch',
 'if',
 'typeof',
 'continue',
 'in',
 'var',
 'default',
 'instanceof',
 'void',
 'delete',
 'new',
 'undefined',
 'do',
 'return',
 'while',
 'else',
 'switch',
 'with',
 'finally',
 'this',
 'NaN',
 'Infinity',
 'undefined',
 'print',
 'parseInt',
 'parseFloat',
 'isNaN',
 'isFinite',
 'decodeURI',
 'decodeURIComponent',
 'encodeURI',
 'encodeURIComponent',
 'escape',
 'unescape',
 'version',
 'gc',
 'Object',
 'Function',
 'Number',
 'Boolean',
 'String',
 'Date',
 'Array',
 'RegExp',
 'Error',
 'EvalError',
 'RangeError',
 'ReferenceError',
 'SyntaxError',
 'TypeError',
 'URIError',
 'eval',
 'Math',
 'Enumeration',
 'Variant',
 'QObject',
 'QMetaObject']


syntax =  {'formats': {'builtin': '%(syntax_builtin)s',
             'comment': '%(syntax_comment)s',
             'hexnumber': '%(syntax_number)s',
             'keyword': '%(syntax_keyword)s',
             'number': '%(syntax_number)s',
             'string': '%(syntax_string)s'},
 'partitions': [('comment', '//', '\n'),
                ('comment', "/\*", "\*/", True),
               ],
 'scanner': {None: [('hexnumber', '(0x)([0-9a-fA-F])+?'),
                    ('number', '\\d+(\\.\\d*)?'),
                    ('keyword', keywords, '(^|[^\\.\\w])', '[\x08\\W]'),
					('ident', r'[A-Za-z_][A-Za-z_0-9]*')]}}
			

if __name__ == "__main__":
	import pprint
	pprint.pprint(syntax)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.