3 pygments.lexers.supercollider |
3 pygments.lexers.supercollider |
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexer for SuperCollider |
6 Lexer for SuperCollider |
7 |
7 |
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
14 from pygments.lexer import RegexLexer, include, words |
14 from pygments.lexer import RegexLexer, include, words, default |
15 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ |
15 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ |
16 Number, Punctuation |
16 Number, Punctuation |
17 |
17 |
18 __all__ = ['SuperColliderLexer'] |
18 __all__ = ['SuperColliderLexer'] |
19 |
19 |
41 'slashstartsregex': [ |
41 'slashstartsregex': [ |
42 include('commentsandwhitespace'), |
42 include('commentsandwhitespace'), |
43 (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' |
43 (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' |
44 r'([gim]+\b|\B)', String.Regex, '#pop'), |
44 r'([gim]+\b|\B)', String.Regex, '#pop'), |
45 (r'(?=/)', Text, ('#pop', 'badregex')), |
45 (r'(?=/)', Text, ('#pop', 'badregex')), |
46 (r'', Text, '#pop') |
46 default('#pop'), |
47 ], |
47 ], |
48 'badregex': [ |
48 'badregex': [ |
49 (r'\n', Text, '#pop') |
49 (r'\n', Text, '#pop') |
50 ], |
50 ], |
51 'root': [ |
51 'root': [ |
72 'transient', 'volatile'), suffix=r'\b'), |
72 'transient', 'volatile'), suffix=r'\b'), |
73 Keyword.Reserved), |
73 Keyword.Reserved), |
74 (words(('true', 'false', 'nil', 'inf'), suffix=r'\b'), Keyword.Constant), |
74 (words(('true', 'false', 'nil', 'inf'), suffix=r'\b'), Keyword.Constant), |
75 (words(( |
75 (words(( |
76 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Number', |
76 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Number', |
77 'Object', 'Packages', 'RegExp', 'String', 'Error', |
77 'Object', 'Packages', 'RegExp', 'String', |
78 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'super', |
78 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'super', |
79 'thisFunctionDef', 'thisFunction', 'thisMethod', 'thisProcess', |
79 'thisFunctionDef', 'thisFunction', 'thisMethod', 'thisProcess', |
80 'thisThread', 'this'), suffix=r'\b'), |
80 'thisThread', 'this'), suffix=r'\b'), |
81 Name.Builtin), |
81 Name.Builtin), |
82 (r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other), |
82 (r'[$a-zA-Z_]\w*', Name.Other), |
83 (r'\\?[$a-zA-Z_][a-zA-Z0-9_]*', String.Symbol), |
83 (r'\\?[$a-zA-Z_]\w*', String.Symbol), |
84 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), |
84 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), |
85 (r'0x[0-9a-fA-F]+', Number.Hex), |
85 (r'0x[0-9a-fA-F]+', Number.Hex), |
86 (r'[0-9]+', Number.Integer), |
86 (r'[0-9]+', Number.Integer), |
87 (r'"(\\\\|\\"|[^"])*"', String.Double), |
87 (r'"(\\\\|\\"|[^"])*"', String.Double), |
88 (r"'(\\\\|\\'|[^'])*'", String.Single), |
88 (r"'(\\\\|\\'|[^'])*'", String.Single), |