ThirdParty/Pygments/pygments/lexers/julia.py

changeset 4697
c2e9bf425554
parent 4172
4f20dba37ab6
child 5072
aab59042fefb
equal deleted inserted replaced
4696:bf4d19a7cade 4697:c2e9bf425554
3 pygments.lexers.julia 3 pygments.lexers.julia
4 ~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for the Julia language. 6 Lexers for the Julia language.
7 7
8 :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2015 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 Lexer, RegexLexer, bygroups, combined, do_insertions 14 from pygments.lexer import Lexer, RegexLexer, bygroups, combined, do_insertions
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, Generic 16 Number, Punctuation, Generic
17 from pygments.util import shebang_matches 17 from pygments.util import shebang_matches, unirange
18 18
19 __all__ = ['JuliaLexer', 'JuliaConsoleLexer'] 19 __all__ = ['JuliaLexer', 'JuliaConsoleLexer']
20 20
21 21
22 class JuliaLexer(RegexLexer): 22 class JuliaLexer(RegexLexer):
27 """ 27 """
28 name = 'Julia' 28 name = 'Julia'
29 aliases = ['julia', 'jl'] 29 aliases = ['julia', 'jl']
30 filenames = ['*.jl'] 30 filenames = ['*.jl']
31 mimetypes = ['text/x-julia', 'application/x-julia'] 31 mimetypes = ['text/x-julia', 'application/x-julia']
32
33 flags = re.MULTILINE | re.UNICODE
32 34
33 builtins = [ 35 builtins = [
34 'exit', 'whos', 'edit', 'load', 'is', 'isa', 'isequal', 'typeof', 'tuple', 36 'exit', 'whos', 'edit', 'load', 'is', 'isa', 'isequal', 'typeof', 'tuple',
35 'ntuple', 'uid', 'hash', 'finalizer', 'convert', 'promote', 'subtype', 37 'ntuple', 'uid', 'hash', 'finalizer', 'convert', 'promote', 'subtype',
36 'typemin', 'typemax', 'realmin', 'realmax', 'sizeof', 'eps', 'promote_type', 38 'typemin', 'typemax', 'realmin', 'realmax', 'sizeof', 'eps', 'promote_type',
87 (r'(?:[IL])"', String, 'string'), 89 (r'(?:[IL])"', String, 'string'),
88 (r'[E]?"', String, combined('stringescape', 'string')), 90 (r'[E]?"', String, combined('stringescape', 'string')),
89 91
90 # names 92 # names
91 (r'@[\w.]+', Name.Decorator), 93 (r'@[\w.]+', Name.Decorator),
92 (r'[a-zA-Z_]\w*', Name), 94 (u'(?:[a-zA-Z_\u00A1-\uffff]|%s)(?:[a-zA-Z_0-9\u00A1-\uffff]|%s)*!*' %
95 ((unirange(0x10000, 0x10ffff),)*2), Name),
93 96
94 # numbers 97 # numbers
95 (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float), 98 (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float),
96 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float), 99 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
97 (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float), 100 (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float),

eric ide

mercurial