Linux websever 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
Apache/2.4.52 (Ubuntu)
: 192.168.3.70 | : 192.168.1.99
Cant Read [ /etc/named.conf ]
8.1.2-1ubuntu2.23
urlab
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
pygments /
lexers /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
__init__.py
11
KB
-rw-r--r--
_asy_builtins.py
26.65
KB
-rw-r--r--
_cl_builtins.py
13.67
KB
-rw-r--r--
_cocoa_builtins.py
102.72
KB
-rw-r--r--
_csound_builtins.py
17.84
KB
-rw-r--r--
_julia_builtins.py
11.6
KB
-rw-r--r--
_lasso_builtins.py
131.36
KB
-rw-r--r--
_lilypond_builtins.py
101.67
KB
-rw-r--r--
_lua_builtins.py
8.08
KB
-rw-r--r--
_mapping.py
62.33
KB
-rw-r--r--
_mql_builtins.py
24.13
KB
-rw-r--r--
_mysql_builtins.py
23.92
KB
-rw-r--r--
_openedge_builtins.py
48.24
KB
-rw-r--r--
_php_builtins.py
150.72
KB
-rw-r--r--
_postgres_builtins.py
11.9
KB
-rw-r--r--
_scilab_builtins.py
51.15
KB
-rw-r--r--
_sourcemod_builtins.py
26.42
KB
-rw-r--r--
_stan_builtins.py
10.21
KB
-rw-r--r--
_stata_builtins.py
26.59
KB
-rw-r--r--
_tsql_builtins.py
15.1
KB
-rw-r--r--
_usd_builtins.py
1.62
KB
-rw-r--r--
_vbscript_builtins.py
4.13
KB
-rw-r--r--
_vim_builtins.py
55.73
KB
-rw-r--r--
actionscript.py
11.31
KB
-rw-r--r--
agile.py
876
B
-rw-r--r--
algebra.py
7.59
KB
-rw-r--r--
ambient.py
2.54
KB
-rw-r--r--
amdgpu.py
1.57
KB
-rw-r--r--
ampl.py
4.05
KB
-rw-r--r--
apdlexer.py
26.04
KB
-rw-r--r--
apl.py
3.32
KB
-rw-r--r--
archetype.py
11.17
KB
-rw-r--r--
arrow.py
3.47
KB
-rw-r--r--
asc.py
1.54
KB
-rw-r--r--
asm.py
40.19
KB
-rw-r--r--
automation.py
19.34
KB
-rw-r--r--
bare.py
2.97
KB
-rw-r--r--
basic.py
27.22
KB
-rw-r--r--
bdd.py
1.59
KB
-rw-r--r--
bibtex.py
4.62
KB
-rw-r--r--
boa.py
3.87
KB
-rw-r--r--
business.py
27.4
KB
-rw-r--r--
c_cpp.py
15.67
KB
-rw-r--r--
c_like.py
28.45
KB
-rw-r--r--
capnproto.py
2.17
KB
-rw-r--r--
cddl.py
5.2
KB
-rw-r--r--
chapel.py
4.89
KB
-rw-r--r--
clean.py
6.24
KB
-rw-r--r--
compiled.py
1.33
KB
-rw-r--r--
configs.py
39.49
KB
-rw-r--r--
console.py
4.05
KB
-rw-r--r--
crystal.py
15.41
KB
-rw-r--r--
csound.py
16.56
KB
-rw-r--r--
css.py
31.15
KB
-rw-r--r--
d.py
9.61
KB
-rw-r--r--
dalvik.py
4.47
KB
-rw-r--r--
data.py
23.96
KB
-rw-r--r--
devicetree.py
3.92
KB
-rw-r--r--
diff.py
5.04
KB
-rw-r--r--
dotnet.py
28.47
KB
-rw-r--r--
dsls.py
35.45
KB
-rw-r--r--
dylan.py
10.16
KB
-rw-r--r--
ecl.py
6.09
KB
-rw-r--r--
eiffel.py
2.6
KB
-rw-r--r--
elm.py
3.08
KB
-rw-r--r--
elpi.py
5.83
KB
-rw-r--r--
email.py
4.97
KB
-rw-r--r--
erlang.py
18.76
KB
-rw-r--r--
esoteric.py
10.17
KB
-rw-r--r--
ezhil.py
3.27
KB
-rw-r--r--
factor.py
19.12
KB
-rw-r--r--
fantom.py
9.96
KB
-rw-r--r--
felix.py
9.41
KB
-rw-r--r--
floscript.py
2.6
KB
-rw-r--r--
forth.py
6.99
KB
-rw-r--r--
fortran.py
10.07
KB
-rw-r--r--
foxpro.py
25.6
KB
-rw-r--r--
freefem.py
26.43
KB
-rw-r--r--
functional.py
674
B
-rw-r--r--
futhark.py
3.64
KB
-rw-r--r--
gcodelexer.py
826
B
-rw-r--r--
gdscript.py
10.94
KB
-rw-r--r--
go.py
3.65
KB
-rw-r--r--
grammar_notation.py
7.83
KB
-rw-r--r--
graph.py
3.77
KB
-rw-r--r--
graphics.py
38.15
KB
-rw-r--r--
graphviz.py
1.83
KB
-rw-r--r--
gsql.py
3.68
KB
-rw-r--r--
haskell.py
31.98
KB
-rw-r--r--
haxe.py
30.21
KB
-rw-r--r--
hdl.py
21.99
KB
-rw-r--r--
hexdump.py
3.52
KB
-rw-r--r--
html.py
19.34
KB
-rw-r--r--
idl.py
14.87
KB
-rw-r--r--
igor.py
29.87
KB
-rw-r--r--
inferno.py
3.02
KB
-rw-r--r--
installers.py
12.8
KB
-rw-r--r--
int_fiction.py
55.32
KB
-rw-r--r--
iolang.py
1.84
KB
-rw-r--r--
j.py
4.4
KB
-rw-r--r--
javascript.py
58.67
KB
-rw-r--r--
jslt.py
3.61
KB
-rw-r--r--
julia.py
11
KB
-rw-r--r--
jvm.py
70.05
KB
-rw-r--r--
kuin.py
10.5
KB
-rw-r--r--
lilypond.py
8.26
KB
-rw-r--r--
lisp.py
139.4
KB
-rw-r--r--
make.py
7.26
KB
-rw-r--r--
markup.py
26.11
KB
-rw-r--r--
math.py
676
B
-rw-r--r--
matlab.py
129.3
KB
-rw-r--r--
maxima.py
2.65
KB
-rw-r--r--
meson.py
4.33
KB
-rw-r--r--
mime.py
7.36
KB
-rw-r--r--
ml.py
34.47
KB
-rw-r--r--
modeling.py
13.07
KB
-rw-r--r--
modula2.py
51.82
KB
-rw-r--r--
monte.py
6.14
KB
-rw-r--r--
mosel.py
8.97
KB
-rw-r--r--
ncl.py
62.46
KB
-rw-r--r--
nimrod.py
5
KB
-rw-r--r--
nit.py
2.66
KB
-rw-r--r--
nix.py
3.91
KB
-rw-r--r--
oberon.py
4.11
KB
-rw-r--r--
objective.py
22.26
KB
-rw-r--r--
ooc.py
2.91
KB
-rw-r--r--
other.py
1.7
KB
-rw-r--r--
parasail.py
2.65
KB
-rw-r--r--
parsers.py
25.27
KB
-rw-r--r--
pascal.py
31.84
KB
-rw-r--r--
pawn.py
7.96
KB
-rw-r--r--
perl.py
38.16
KB
-rw-r--r--
php.py
12.25
KB
-rw-r--r--
pointless.py
1.92
KB
-rw-r--r--
pony.py
3.17
KB
-rw-r--r--
praat.py
11.99
KB
-rw-r--r--
procfile.py
1.19
KB
-rw-r--r--
prolog.py
12.09
KB
-rw-r--r--
promql.py
4.63
KB
-rw-r--r--
python.py
51.49
KB
-rw-r--r--
qvt.py
5.93
KB
-rw-r--r--
r.py
6.02
KB
-rw-r--r--
rdf.py
15.42
KB
-rw-r--r--
rebol.py
18.16
KB
-rw-r--r--
resource.py
2.83
KB
-rw-r--r--
ride.py
4.93
KB
-rw-r--r--
rita.py
1.16
KB
-rw-r--r--
rnc.py
1.92
KB
-rw-r--r--
roboconf.py
2
KB
-rw-r--r--
robotframework.py
17.99
KB
-rw-r--r--
ruby.py
22.14
KB
-rw-r--r--
rust.py
7.99
KB
-rw-r--r--
sas.py
9.2
KB
-rw-r--r--
savi.py
4.24
KB
-rw-r--r--
scdoc.py
2.19
KB
-rw-r--r--
scripting.py
68.41
KB
-rw-r--r--
sgf.py
2
KB
-rw-r--r--
shell.py
35.06
KB
-rw-r--r--
sieve.py
2.24
KB
-rw-r--r--
slash.py
8.28
KB
-rw-r--r--
smalltalk.py
7.02
KB
-rw-r--r--
smithy.py
2.6
KB
-rw-r--r--
smv.py
2.71
KB
-rw-r--r--
snobol.py
2.67
KB
-rw-r--r--
solidity.py
3.1
KB
-rw-r--r--
sophia.py
3.29
KB
-rw-r--r--
special.py
3.37
KB
-rw-r--r--
spice.py
2.06
KB
-rw-r--r--
sql.py
33.42
KB
-rw-r--r--
srcinfo.py
1.63
KB
-rw-r--r--
stata.py
6.26
KB
-rw-r--r--
supercollider.py
3.61
KB
-rw-r--r--
tcl.py
5.27
KB
-rw-r--r--
teal.py
3.41
KB
-rw-r--r--
templates.py
69.96
KB
-rw-r--r--
teraterm.py
9.65
KB
-rw-r--r--
testing.py
10.52
KB
-rw-r--r--
text.py
1006
B
-rw-r--r--
textedit.py
7.44
KB
-rw-r--r--
textfmts.py
14.8
KB
-rw-r--r--
theorem.py
19.15
KB
-rw-r--r--
thingsdb.py
4.13
KB
-rw-r--r--
tnt.py
10.27
KB
-rw-r--r--
trafficscript.py
1.48
KB
-rw-r--r--
typoscript.py
8.01
KB
-rw-r--r--
unicon.py
18.08
KB
-rw-r--r--
urbi.py
5.9
KB
-rw-r--r--
usd.py
3.37
KB
-rw-r--r--
varnish.py
7.07
KB
-rw-r--r--
verification.py
3.82
KB
-rw-r--r--
web.py
894
B
-rw-r--r--
webassembly.py
5.56
KB
-rw-r--r--
webidl.py
10.23
KB
-rw-r--r--
webmisc.py
39.07
KB
-rw-r--r--
whiley.py
3.89
KB
-rw-r--r--
x10.py
1.84
KB
-rw-r--r--
xorg.py
865
B
-rw-r--r--
yang.py
4.42
KB
-rw-r--r--
zig.py
3.85
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : erlang.py
""" pygments.lexers.erlang ~~~~~~~~~~~~~~~~~~~~~~ Lexers for Erlang. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions, \ include, default from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Generic, Whitespace __all__ = ['ErlangLexer', 'ErlangShellLexer', 'ElixirConsoleLexer', 'ElixirLexer'] line_re = re.compile('.*?\n') class ErlangLexer(RegexLexer): """ For the Erlang functional programming language. Blame Jeremy Thurgood (http://jerith.za.net/). .. versionadded:: 0.9 """ name = 'Erlang' aliases = ['erlang'] filenames = ['*.erl', '*.hrl', '*.es', '*.escript'] mimetypes = ['text/x-erlang'] keywords = ( 'after', 'begin', 'case', 'catch', 'cond', 'end', 'fun', 'if', 'let', 'of', 'query', 'receive', 'try', 'when', ) builtins = ( # See erlang(3) man page 'abs', 'append_element', 'apply', 'atom_to_list', 'binary_to_list', 'bitstring_to_list', 'binary_to_term', 'bit_size', 'bump_reductions', 'byte_size', 'cancel_timer', 'check_process_code', 'delete_module', 'demonitor', 'disconnect_node', 'display', 'element', 'erase', 'exit', 'float', 'float_to_list', 'fun_info', 'fun_to_list', 'function_exported', 'garbage_collect', 'get', 'get_keys', 'group_leader', 'hash', 'hd', 'integer_to_list', 'iolist_to_binary', 'iolist_size', 'is_atom', 'is_binary', 'is_bitstring', 'is_boolean', 'is_builtin', 'is_float', 'is_function', 'is_integer', 'is_list', 'is_number', 'is_pid', 'is_port', 'is_process_alive', 'is_record', 'is_reference', 'is_tuple', 'length', 'link', 'list_to_atom', 'list_to_binary', 'list_to_bitstring', 'list_to_existing_atom', 'list_to_float', 'list_to_integer', 'list_to_pid', 'list_to_tuple', 'load_module', 'localtime_to_universaltime', 'make_tuple', 'md5', 'md5_final', 'md5_update', 'memory', 'module_loaded', 'monitor', 'monitor_node', 'node', 'nodes', 'open_port', 'phash', 'phash2', 'pid_to_list', 'port_close', 'port_command', 'port_connect', 'port_control', 'port_call', 'port_info', 'port_to_list', 'process_display', 'process_flag', 'process_info', 'purge_module', 'put', 'read_timer', 'ref_to_list', 'register', 'resume_process', 'round', 'send', 'send_after', 'send_nosuspend', 'set_cookie', 'setelement', 'size', 'spawn', 'spawn_link', 'spawn_monitor', 'spawn_opt', 'split_binary', 'start_timer', 'statistics', 'suspend_process', 'system_flag', 'system_info', 'system_monitor', 'system_profile', 'term_to_binary', 'tl', 'trace', 'trace_delivered', 'trace_info', 'trace_pattern', 'trunc', 'tuple_size', 'tuple_to_list', 'universaltime_to_localtime', 'unlink', 'unregister', 'whereis' ) operators = r'(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)' word_operators = ( 'and', 'andalso', 'band', 'bnot', 'bor', 'bsl', 'bsr', 'bxor', 'div', 'not', 'or', 'orelse', 'rem', 'xor' ) atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')" variable_re = r'(?:[A-Z_]\w*)' esc_char_re = r'[bdefnrstv\'"\\]' esc_octal_re = r'[0-7][0-7]?[0-7]?' esc_hex_re = r'(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})' esc_ctrl_re = r'\^[a-zA-Z]' escape_re = r'(?:\\(?:'+esc_char_re+r'|'+esc_octal_re+r'|'+esc_hex_re+r'|'+esc_ctrl_re+r'))' macro_re = r'(?:'+variable_re+r'|'+atom_re+r')' base_re = r'(?:[2-9]|[12][0-9]|3[0-6])' tokens = { 'root': [ (r'\s+', Whitespace), (r'(%.*)(\n)', bygroups(Comment, Whitespace)), (words(keywords, suffix=r'\b'), Keyword), (words(builtins, suffix=r'\b'), Name.Builtin), (words(word_operators, suffix=r'\b'), Operator.Word), (r'^-', Punctuation, 'directive'), (operators, Operator), (r'"', String, 'string'), (r'<<', Name.Label), (r'>>', Name.Label), ('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)), ('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()', bygroups(Name.Function, Whitespace, Punctuation)), (r'[+-]?' + base_re + r'#[0-9a-zA-Z]+', Number.Integer), (r'[+-]?\d+', Number.Integer), (r'[+-]?\d+.\d+', Number.Float), (r'[]\[:_@\".{}()|;,]', Punctuation), (variable_re, Name.Variable), (atom_re, Name), (r'\?'+macro_re, Name.Constant), (r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char), (r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label), # Erlang script shebang (r'\A#!.+\n', Comment.Hashbang), # EEP 43: Maps # http://www.erlang.org/eeps/eep-0043.html (r'#\{', Punctuation, 'map_key'), ], 'string': [ (escape_re, String.Escape), (r'"', String, '#pop'), (r'~[0-9.*]*[~#+BPWXb-ginpswx]', String.Interpol), (r'[^"\\~]+', String), (r'~', String), ], 'directive': [ (r'(define)(\s*)(\()('+macro_re+r')', bygroups(Name.Entity, Whitespace, Punctuation, Name.Constant), '#pop'), (r'(record)(\s*)(\()('+macro_re+r')', bygroups(Name.Entity, Whitespace, Punctuation, Name.Label), '#pop'), (atom_re, Name.Entity, '#pop'), ], 'map_key': [ include('root'), (r'=>', Punctuation, 'map_val'), (r':=', Punctuation, 'map_val'), (r'\}', Punctuation, '#pop'), ], 'map_val': [ include('root'), (r',', Punctuation, '#pop'), (r'(?=\})', Punctuation, '#pop'), ], } class ErlangShellLexer(Lexer): """ Shell sessions in erl (for Erlang code). .. versionadded:: 1.1 """ name = 'Erlang erl session' aliases = ['erl'] filenames = ['*.erl-sh'] mimetypes = ['text/x-erl-shellsession'] _prompt_re = re.compile(r'(?:\([\w@_.]+\))?\d+>(?=\s|\Z)') def get_tokens_unprocessed(self, text): erlexer = ErlangLexer(**self.options) curcode = '' insertions = [] for match in line_re.finditer(text): line = match.group() m = self._prompt_re.match(line) if m is not None: end = m.end() insertions.append((len(curcode), [(0, Generic.Prompt, line[:end])])) curcode += line[end:] else: if curcode: yield from do_insertions(insertions, erlexer.get_tokens_unprocessed(curcode)) curcode = '' insertions = [] if line.startswith('*'): yield match.start(), Generic.Traceback, line else: yield match.start(), Generic.Output, line if curcode: yield from do_insertions(insertions, erlexer.get_tokens_unprocessed(curcode)) def gen_elixir_string_rules(name, symbol, token): states = {} states['string_' + name] = [ (r'[^#%s\\]+' % (symbol,), token), include('escapes'), (r'\\.', token), (r'(%s)' % (symbol,), bygroups(token), "#pop"), include('interpol') ] return states def gen_elixir_sigstr_rules(term, term_class, token, interpol=True): if interpol: return [ (r'[^#%s\\]+' % (term_class,), token), include('escapes'), (r'\\.', token), (r'%s[a-zA-Z]*' % (term,), token, '#pop'), include('interpol') ] else: return [ (r'[^%s\\]+' % (term_class,), token), (r'\\.', token), (r'%s[a-zA-Z]*' % (term,), token, '#pop'), ] class ElixirLexer(RegexLexer): """ For the `Elixir language <http://elixir-lang.org>`_. .. versionadded:: 1.5 """ name = 'Elixir' aliases = ['elixir', 'ex', 'exs'] filenames = ['*.ex', '*.eex', '*.exs', '*.leex'] mimetypes = ['text/x-elixir'] KEYWORD = ('fn', 'do', 'end', 'after', 'else', 'rescue', 'catch') KEYWORD_OPERATOR = ('not', 'and', 'or', 'when', 'in') BUILTIN = ( 'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise', 'quote', 'unquote', 'unquote_splicing', 'throw', 'super', ) BUILTIN_DECLARATION = ( 'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop', 'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback', ) BUILTIN_NAMESPACE = ('import', 'require', 'use', 'alias') CONSTANT = ('nil', 'true', 'false') PSEUDO_VAR = ('_', '__MODULE__', '__DIR__', '__ENV__', '__CALLER__') OPERATORS3 = ( '<<<', '>>>', '|||', '&&&', '^^^', '~~~', '===', '!==', '~>>', '<~>', '|~>', '<|>', ) OPERATORS2 = ( '==', '!=', '<=', '>=', '&&', '||', '<>', '++', '--', '|>', '=~', '->', '<-', '|', '.', '=', '~>', '<~', ) OPERATORS1 = ('<', '>', '+', '-', '*', '/', '!', '^', '&') PUNCTUATION = ( '\\\\', '<<', '>>', '=>', '(', ')', ':', ';', ',', '[', ']', ) def get_tokens_unprocessed(self, text): for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): if token is Name: if value in self.KEYWORD: yield index, Keyword, value elif value in self.KEYWORD_OPERATOR: yield index, Operator.Word, value elif value in self.BUILTIN: yield index, Keyword, value elif value in self.BUILTIN_DECLARATION: yield index, Keyword.Declaration, value elif value in self.BUILTIN_NAMESPACE: yield index, Keyword.Namespace, value elif value in self.CONSTANT: yield index, Name.Constant, value elif value in self.PSEUDO_VAR: yield index, Name.Builtin.Pseudo, value else: yield index, token, value else: yield index, token, value def gen_elixir_sigil_rules(): # all valid sigil terminators (excluding heredocs) terminators = [ (r'\{', r'\}', '}', 'cb'), (r'\[', r'\]', r'\]', 'sb'), (r'\(', r'\)', ')', 'pa'), ('<', '>', '>', 'ab'), ('/', '/', '/', 'slas'), (r'\|', r'\|', '|', 'pipe'), ('"', '"', '"', 'quot'), ("'", "'", "'", 'apos'), ] # heredocs have slightly different rules triquotes = [(r'"""', 'triquot'), (r"'''", 'triapos')] token = String.Other states = {'sigils': []} for term, name in triquotes: states['sigils'] += [ (r'(~[a-z])(%s)' % (term,), bygroups(token, String.Heredoc), (name + '-end', name + '-intp')), (r'(~[A-Z])(%s)' % (term,), bygroups(token, String.Heredoc), (name + '-end', name + '-no-intp')), ] states[name + '-end'] = [ (r'[a-zA-Z]+', token, '#pop'), default('#pop'), ] states[name + '-intp'] = [ (r'^(\s*)(' + term + ')', bygroups(Whitespace, String.Heredoc), '#pop'), include('heredoc_interpol'), ] states[name + '-no-intp'] = [ (r'^(\s*)(' + term +')', bygroups(Whitespace, String.Heredoc), '#pop'), include('heredoc_no_interpol'), ] for lterm, rterm, rterm_class, name in terminators: states['sigils'] += [ (r'~[a-z]' + lterm, token, name + '-intp'), (r'~[A-Z]' + lterm, token, name + '-no-intp'), ] states[name + '-intp'] = \ gen_elixir_sigstr_rules(rterm, rterm_class, token) states[name + '-no-intp'] = \ gen_elixir_sigstr_rules(rterm, rterm_class, token, interpol=False) return states op3_re = "|".join(re.escape(s) for s in OPERATORS3) op2_re = "|".join(re.escape(s) for s in OPERATORS2) op1_re = "|".join(re.escape(s) for s in OPERATORS1) ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re) punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION) alnum = r'\w' name_re = r'(?:\.\.\.|[a-z_]%s*[!?]?)' % alnum modname_re = r'[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*' % {'alnum': alnum} complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re) special_atom_re = r'(?:\.\.\.|<<>>|%\{\}|%|\{\})' long_hex_char_re = r'(\\x\{)([\da-fA-F]+)(\})' hex_char_re = r'(\\x[\da-fA-F]{1,2})' escape_char_re = r'(\\[abdefnrstv])' tokens = { 'root': [ (r'\s+', Whitespace), (r'#.*$', Comment.Single), # Various kinds of characters (r'(\?)' + long_hex_char_re, bygroups(String.Char, String.Escape, Number.Hex, String.Escape)), (r'(\?)' + hex_char_re, bygroups(String.Char, String.Escape)), (r'(\?)' + escape_char_re, bygroups(String.Char, String.Escape)), (r'\?\\?.', String.Char), # '::' has to go before atoms (r':::', String.Symbol), (r'::', Operator), # atoms (r':' + special_atom_re, String.Symbol), (r':' + complex_name_re, String.Symbol), (r':"', String.Symbol, 'string_double_atom'), (r":'", String.Symbol, 'string_single_atom'), # [keywords: ...] (r'(%s|%s)(:)(?=\s|\n)' % (special_atom_re, complex_name_re), bygroups(String.Symbol, Punctuation)), # @attributes (r'@' + name_re, Name.Attribute), # identifiers (name_re, Name), (r'(%%?)(%s)' % (modname_re,), bygroups(Punctuation, Name.Class)), # operators and punctuation (op3_re, Operator), (op2_re, Operator), (punctuation_re, Punctuation), (r'&\d', Name.Entity), # anon func arguments (op1_re, Operator), # numbers (r'0b[01]+', Number.Bin), (r'0o[0-7]+', Number.Oct), (r'0x[\da-fA-F]+', Number.Hex), (r'\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?', Number.Float), (r'\d(_?\d)*', Number.Integer), # strings and heredocs (r'(""")(\s*)', bygroups(String.Heredoc, Whitespace), 'heredoc_double'), (r"(''')(\s*)$", bygroups(String.Heredoc, Whitespace), 'heredoc_single'), (r'"', String.Double, 'string_double'), (r"'", String.Single, 'string_single'), include('sigils'), (r'%\{', Punctuation, 'map_key'), (r'\{', Punctuation, 'tuple'), ], 'heredoc_double': [ (r'^(\s*)(""")', bygroups(Whitespace, String.Heredoc), '#pop'), include('heredoc_interpol'), ], 'heredoc_single': [ (r"^\s*'''", String.Heredoc, '#pop'), include('heredoc_interpol'), ], 'heredoc_interpol': [ (r'[^#\\\n]+', String.Heredoc), include('escapes'), (r'\\.', String.Heredoc), (r'\n+', String.Heredoc), include('interpol'), ], 'heredoc_no_interpol': [ (r'[^\\\n]+', String.Heredoc), (r'\\.', String.Heredoc), (r'\n+', Whitespace), ], 'escapes': [ (long_hex_char_re, bygroups(String.Escape, Number.Hex, String.Escape)), (hex_char_re, String.Escape), (escape_char_re, String.Escape), ], 'interpol': [ (r'#\{', String.Interpol, 'interpol_string'), ], 'interpol_string': [ (r'\}', String.Interpol, "#pop"), include('root') ], 'map_key': [ include('root'), (r':', Punctuation, 'map_val'), (r'=>', Punctuation, 'map_val'), (r'\}', Punctuation, '#pop'), ], 'map_val': [ include('root'), (r',', Punctuation, '#pop'), (r'(?=\})', Punctuation, '#pop'), ], 'tuple': [ include('root'), (r'\}', Punctuation, '#pop'), ], } tokens.update(gen_elixir_string_rules('double', '"', String.Double)) tokens.update(gen_elixir_string_rules('single', "'", String.Single)) tokens.update(gen_elixir_string_rules('double_atom', '"', String.Symbol)) tokens.update(gen_elixir_string_rules('single_atom', "'", String.Symbol)) tokens.update(gen_elixir_sigil_rules()) class ElixirConsoleLexer(Lexer): """ For Elixir interactive console (iex) output like: .. sourcecode:: iex iex> [head | tail] = [1,2,3] [1,2,3] iex> head 1 iex> tail [2,3] iex> [head | tail] [1,2,3] iex> length [head | tail] 3 .. versionadded:: 1.5 """ name = 'Elixir iex session' aliases = ['iex'] mimetypes = ['text/x-elixir-shellsession'] _prompt_re = re.compile(r'(iex|\.{3})((?:\([\w@_.]+\))?\d+|\(\d+\))?> ') def get_tokens_unprocessed(self, text): exlexer = ElixirLexer(**self.options) curcode = '' in_error = False insertions = [] for match in line_re.finditer(text): line = match.group() if line.startswith('** '): in_error = True insertions.append((len(curcode), [(0, Generic.Error, line[:-1])])) curcode += line[-1:] else: m = self._prompt_re.match(line) if m is not None: in_error = False end = m.end() insertions.append((len(curcode), [(0, Generic.Prompt, line[:end])])) curcode += line[end:] else: if curcode: yield from do_insertions( insertions, exlexer.get_tokens_unprocessed(curcode)) curcode = '' insertions = [] token = Generic.Error if in_error else Generic.Output yield match.start(), token, line if curcode: yield from do_insertions( insertions, exlexer.get_tokens_unprocessed(curcode))
Close