eric6/ThirdParty/Pygments/pygments/lexers/idl.py

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.idl 3 pygments.lexers.idl
4 ~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for IDL. 6 Lexers for IDL.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 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
30 30
31 flags = re.IGNORECASE | re.MULTILINE 31 flags = re.IGNORECASE | re.MULTILINE
32 32
33 _RESERVED = ( 33 _RESERVED = (
34 'and', 'begin', 'break', 'case', 'common', 'compile_opt', 34 'and', 'begin', 'break', 'case', 'common', 'compile_opt',
35 'continue', 'do', 'else', 'end', 'endcase', 'elseelse', 35 'continue', 'do', 'else', 'end', 'endcase', 'endelse',
36 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch', 36 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
37 'endwhile', 'eq', 'for', 'foreach', 'forward_function', 37 'endwhile', 'eq', 'for', 'foreach', 'forward_function',
38 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le', 38 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le',
39 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro', 39 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro',
40 'repeat', 'switch', 'then', 'until', 'while', 'xor') 40 'repeat', 'switch', 'then', 'until', 'while', 'xor')
266 (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer), 266 (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer),
267 (r'\b[+\-]?[0-9]+B\b', Number), 267 (r'\b[+\-]?[0-9]+B\b', Number),
268 (r'.', Text), 268 (r'.', Text),
269 ] 269 ]
270 } 270 }
271
272 def analyse_text(text):
273 """endelse seems to be unique to IDL, endswitch is rare at least."""
274 result = 0
275
276 if 'endelse' in text:
277 result += 0.2
278 if 'endswitch' in text:
279 result += 0.01
280
281 return result

eric ide

mercurial