2 """ |
2 """ |
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-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 from pygments.lexer import RegexLexer, include, words |
13 from pygments.lexer import RegexLexer, include, words |
14 from pygments.token import Keyword, Text, Comment, Name |
14 from pygments.token import Keyword, Text, Comment, Name |
15 from pygments.token import String, Number, Punctuation, Operator |
15 from pygments.token import String, Number, Punctuation, Operator |
16 |
16 |
17 __all__ = ['EzhilLexer'] |
17 __all__ = ['EzhilLexer'] |
|
18 |
18 |
19 |
19 class EzhilLexer(RegexLexer): |
20 class EzhilLexer(RegexLexer): |
20 """ |
21 """ |
21 Lexer for `Ezhil, a Tamil script-based programming language <http://ezhillang.org>`_ |
22 Lexer for `Ezhil, a Tamil script-based programming language <http://ezhillang.org>`_ |
22 |
23 |
34 'root': [ |
35 'root': [ |
35 include('keywords'), |
36 include('keywords'), |
36 (r'#.*\n', Comment.Single), |
37 (r'#.*\n', Comment.Single), |
37 (r'[@+/*,^\-%]|[!<>=]=?|&&?|\|\|?', Operator), |
38 (r'[@+/*,^\-%]|[!<>=]=?|&&?|\|\|?', Operator), |
38 (u'இல்', Operator.Word), |
39 (u'இல்', Operator.Word), |
39 (words(('assert', 'max', 'min', |
40 (words((u'assert', u'max', u'min', |
40 'நீளம்','சரம்_இடமாற்று','சரம்_கண்டுபிடி', |
41 u'நீளம்', u'சரம்_இடமாற்று', u'சரம்_கண்டுபிடி', |
41 'பட்டியல்','பின்இணை','வரிசைப்படுத்து', |
42 u'பட்டியல்', u'பின்இணை', u'வரிசைப்படுத்து', |
42 'எடு','தலைகீழ்','நீட்டிக்க','நுழைக்க','வை', |
43 u'எடு', u'தலைகீழ்', u'நீட்டிக்க', u'நுழைக்க', u'வை', |
43 'கோப்பை_திற','கோப்பை_எழுது','கோப்பை_மூடு', |
44 u'கோப்பை_திற', u'கோப்பை_எழுது', u'கோப்பை_மூடு', |
44 'pi','sin','cos','tan','sqrt','hypot','pow','exp','log','log10' |
45 u'pi', u'sin', u'cos', u'tan', u'sqrt', u'hypot', u'pow', |
45 'min','max','exit', |
46 u'exp', u'log', u'log10', u'exit', |
46 ), suffix=r'\b'), Name.Builtin), |
47 ), suffix=r'\b'), Name.Builtin), |
47 (r'(True|False)\b', Keyword.Constant), |
48 (r'(True|False)\b', Keyword.Constant), |
48 (r'[^\S\n]+', Text), |
49 (r'[^\S\n]+', Text), |
49 include('identifier'), |
50 include('identifier'), |
50 include('literal'), |
51 include('literal'), |
60 (r'".*?"', String), |
61 (r'".*?"', String), |
61 (r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float), |
62 (r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float), |
62 (r'(?u)\d+', Number.Integer), |
63 (r'(?u)\d+', Number.Integer), |
63 ] |
64 ] |
64 } |
65 } |
65 |
66 |
66 def __init__(self, **options): |
67 def __init__(self, **options): |
67 super(EzhilLexer, self).__init__(**options) |
68 super(EzhilLexer, self).__init__(**options) |
68 self.encoding = options.get('encoding', 'utf-8') |
69 self.encoding = options.get('encoding', 'utf-8') |