ThirdParty/Pygments/pygments/lexers/shell.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
equal deleted inserted replaced
5070:4e4651e88674 5072:aab59042fefb
33 """ 33 """
34 34
35 name = 'Bash' 35 name = 'Bash'
36 aliases = ['bash', 'sh', 'ksh', 'shell'] 36 aliases = ['bash', 'sh', 'ksh', 'shell']
37 filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', 37 filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
38 '*.exheres-0', '*.exlib',
38 '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'PKGBUILD'] 39 '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'PKGBUILD']
39 mimetypes = ['application/x-sh', 'application/x-shellscript'] 40 mimetypes = ['application/x-sh', 'application/x-shellscript']
40 41
41 tokens = { 42 tokens = {
42 'root': [ 43 'root': [
47 ], 48 ],
48 'interp': [ 49 'interp': [
49 (r'\$\(\(', Keyword, 'math'), 50 (r'\$\(\(', Keyword, 'math'),
50 (r'\$\(', Keyword, 'paren'), 51 (r'\$\(', Keyword, 'paren'),
51 (r'\$\{#?', String.Interpol, 'curly'), 52 (r'\$\{#?', String.Interpol, 'curly'),
52 (r'\$[a-fA-F_][a-fA-F0-9_]*', Name.Variable), # user variable 53 (r'\$[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable), # user variable
53 (r'\$(?:\d+|[#$?!_*@-])', Name.Variable), # builtin 54 (r'\$(?:\d+|[#$?!_*@-])', Name.Variable), # builtin
54 (r'\$', Text), 55 (r'\$', Text),
55 ], 56 ],
56 'basic': [ 57 'basic': [
57 (r'\b(if|fi|else|while|do|done|for|then|return|function|case|' 58 (r'\b(if|fi|else|while|do|done|for|then|return|function|case|'
211 _label = r'(?:(?:[^%s%s%s+:^]|\^[%s]?[\w\W])*)' % (_nl, _punct, _ws, _nl) 212 _label = r'(?:(?:[^%s%s%s+:^]|\^[%s]?[\w\W])*)' % (_nl, _punct, _ws, _nl)
212 _label_compound = (r'(?:(?:[^%s%s%s+:^)]|\^[%s]?[^)])*)' % 213 _label_compound = (r'(?:(?:[^%s%s%s+:^)]|\^[%s]?[^)])*)' %
213 (_nl, _punct, _ws, _nl)) 214 (_nl, _punct, _ws, _nl))
214 _number = r'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)' % _token_terminator 215 _number = r'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)' % _token_terminator
215 _opword = r'(?:equ|geq|gtr|leq|lss|neq)' 216 _opword = r'(?:equ|geq|gtr|leq|lss|neq)'
216 _string = r'(?:"[^%s"]*"?)' % _nl 217 _string = r'(?:"[^%s"]*(?:"|(?=[%s])))' % (_nl, _nl)
217 _variable = (r'(?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|' 218 _variable = (r'(?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|'
218 r'[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|' 219 r'[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|'
219 r'\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|' 220 r'\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|'
220 r'(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:' 221 r'(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:'
221 r'[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))' % 222 r'[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))' %
222 (_nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl)) 223 (_nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl))
223 _core_token = r'(?:(?:(?:\^[%s]?)?[^%s%s%s])+)' % (_nl, _nl, _punct, _ws) 224 _core_token = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s])+)' % (_nl, _nl, _punct, _ws)
224 _core_token_compound = r'(?:(?:(?:\^[%s]?)?[^%s%s%s)])+)' % (_nl, _nl, 225 _core_token_compound = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s)])+)' % (_nl, _nl,
225 _punct, _ws) 226 _punct, _ws)
226 _token = r'(?:[%s]+|%s)' % (_punct, _core_token) 227 _token = r'(?:[%s]+|%s)' % (_punct, _core_token)
227 _token_compound = r'(?:[%s]+|%s)' % (_punct, _core_token_compound) 228 _token_compound = r'(?:[%s]+|%s)' % (_punct, _core_token_compound)
228 _stoken = (r'(?:[%s]+|(?:%s|%s|%s)+)' % 229 _stoken = (r'(?:[%s]+|(?:%s|%s|%s)+)' %
229 (_punct, _string, _variable, _core_token)) 230 (_punct, _string, _variable, _core_token))
230 231

eric ide

mercurial