3 pygments.lexers.ezhil |
3 pygments.lexers.ezhil |
4 ~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Pygments lexers for Ezhil language. |
6 Pygments lexers for Ezhil language. |
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 from pygments.lexer import RegexLexer, include, words |
13 from pygments.lexer import RegexLexer, include, words |
62 (r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float), |
62 (r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float), |
63 (r'(?u)\d+', Number.Integer), |
63 (r'(?u)\d+', Number.Integer), |
64 ] |
64 ] |
65 } |
65 } |
66 |
66 |
|
67 def analyse_text(text): |
|
68 """This language uses Tamil-script. We'll assume that if there's a |
|
69 decent amount of Tamil-characters, it's this language. This assumption |
|
70 is obviously horribly off if someone uses string literals in tamil |
|
71 in another language.""" |
|
72 if len(re.findall(r'[\u0b80-\u0bff]', text)) > 10: |
|
73 return 0.25 |
|
74 |
67 def __init__(self, **options): |
75 def __init__(self, **options): |
68 super().__init__(**options) |
76 super().__init__(**options) |
69 self.encoding = options.get('encoding', 'utf-8') |
77 self.encoding = options.get('encoding', 'utf-8') |