ThirdParty/Pygments/pygments/lexers/math.py

Mon, 25 Mar 2013 03:11:06 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Mon, 25 Mar 2013 03:11:06 +0100
branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2426
da76c71624de
child 3145
a9de05d4a22f
permissions
-rw-r--r--

Script changes: Future import added, super calls modified and unicode behavior for str.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 pygments.lexers.math
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 ~~~~~~~~~~~~~~~~~~~~
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 Lexers for math languages.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 :license: BSD, see LICENSE for details.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2426
diff changeset
12 from __future__ import unicode_literals # __IGNORE_WARNING__
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2426
diff changeset
13
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import re
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
16 from pygments.util import shebang_matches
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
17 from pygments.lexer import Lexer, RegexLexer, bygroups, include, \
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
18 combined, do_insertions
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from pygments.token import Comment, String, Punctuation, Keyword, Name, \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 Operator, Number, Text, Generic
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 from pygments.lexers.agile import PythonLexer
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
23 from pygments.lexers import _scilab_builtins
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
24 from pygments.lexers import _stan_builtins
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
26 __all__ = ['JuliaLexer', 'JuliaConsoleLexer', 'MuPADLexer', 'MatlabLexer',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
27 'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer', 'NumPyLexer',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
28 'RConsoleLexer', 'SLexer', 'JagsLexer', 'BugsLexer', 'StanLexer',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
29 'IDLLexer', 'RdLexer']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
30
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
31
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
32 class JuliaLexer(RegexLexer):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
33 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
34 For `Julia <http://julialang.org/>`_ source code.
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
35
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
36 *New in Pygments 1.6.*
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
37 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
38 name = 'Julia'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
39 aliases = ['julia','jl']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
40 filenames = ['*.jl']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
41 mimetypes = ['text/x-julia','application/x-julia']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
42
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
43 builtins = [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
44 'exit','whos','edit','load','is','isa','isequal','typeof','tuple',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
45 'ntuple','uid','hash','finalizer','convert','promote','subtype',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
46 'typemin','typemax','realmin','realmax','sizeof','eps','promote_type',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
47 'method_exists','applicable','invoke','dlopen','dlsym','system',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
48 'error','throw','assert','new','Inf','Nan','pi','im',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
49 ]
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
50
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
51 tokens = {
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
52 'root': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
53 (r'\n', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
54 (r'[^\S\n]+', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
55 (r'#.*$', Comment),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
56 (r'[]{}:(),;[@]', Punctuation),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
57 (r'\\\n', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
58 (r'\\', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
59
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
60 # keywords
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
61 (r'(begin|while|for|in|return|break|continue|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
62 r'macro|quote|let|if|elseif|else|try|catch|end|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
63 r'bitstype|ccall|do|using|module|import|export|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
64 r'importall|baremodule)\b', Keyword),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
65 (r'(local|global|const)\b', Keyword.Declaration),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
66 (r'(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
67 r'|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
68 Keyword.Type),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
69
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
70 # functions
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
71 (r'(function)((?:\s|\\\s)+)',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
72 bygroups(Keyword,Name.Function), 'funcname'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
73
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
74 # types
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
75 (r'(type|typealias|abstract)((?:\s|\\\s)+)',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
76 bygroups(Keyword,Name.Class), 'typename'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
77
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
78 # operators
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
79 (r'==|!=|<=|>=|->|&&|\|\||::|<:|[-~+/*%=<>&^|.?!$]', Operator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
80 (r'\.\*|\.\^|\.\\|\.\/|\\', Operator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
81
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
82 # builtins
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
83 ('(' + '|'.join(builtins) + r')\b', Name.Builtin),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
84
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
85 # backticks
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
86 (r'`(?s).*?`', String.Backtick),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
87
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
88 # chars
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
89 (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
90 r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
91
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
92 # try to match trailing transpose
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
93 (r'(?<=[.\w\)\]])\'+', Operator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
94
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
95 # strings
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
96 (r'(?:[IL])"', String, 'string'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
97 (r'[E]?"', String, combined('stringescape', 'string')),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
98
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
99 # names
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
100 (r'@[a-zA-Z0-9_.]+', Name.Decorator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
101 (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
102
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
103 # numbers
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
104 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
105 (r'\d+[eEf][+-]?[0-9]+', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
106 (r'0b[01]+', Number.Binary),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
107 (r'0o[0-7]+', Number.Oct),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
108 (r'0x[a-fA-F0-9]+', Number.Hex),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
109 (r'\d+', Number.Integer)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
110 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
111
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
112 'funcname': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
113 ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
114 ('\([^\s\w{]{1,2}\)', Operator, '#pop'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
115 ('[^\s\w{]{1,2}', Operator, '#pop'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
116 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
117
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
118 'typename': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
119 ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
120 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
121
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
122 'stringescape': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
123 (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
124 r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
125 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
126
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
127 'string': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
128 (r'"', String, '#pop'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
129 (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
130 (r'\$(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
131 String.Interpol),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
132 (r'[^\\"$]+', String),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
133 # quotes, dollar signs, and backslashes must be parsed one at a time
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
134 (r'["\\]', String),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
135 # unhandled string formatting sign
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
136 (r'\$', String)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
137 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
138 }
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
139
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
140 def analyse_text(text):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
141 return shebang_matches(text, r'julia')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
142
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
143
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
144 line_re = re.compile('.*?\n')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
145
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
146 class JuliaConsoleLexer(Lexer):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
147 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
148 For Julia console sessions. Modeled after MatlabSessionLexer.
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
149
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
150 *New in Pygments 1.6.*
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
151 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
152 name = 'Julia console'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
153 aliases = ['jlcon']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
154
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
155 def get_tokens_unprocessed(self, text):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
156 jllexer = JuliaLexer(**self.options)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
157
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
158 curcode = ''
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
159 insertions = []
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
160
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
161 for match in line_re.finditer(text):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
162 line = match.group()
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
163
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
164 if line.startswith('julia>'):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
165 insertions.append((len(curcode),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
166 [(0, Generic.Prompt, line[:3])]))
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
167 curcode += line[3:]
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
168
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
169 elif line.startswith(' '):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
170
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
171 idx = len(curcode)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
172
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
173 # without is showing error on same line as before...?
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
174 line = "\n" + line
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
175 token = (0, Generic.Traceback, line)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
176 insertions.append((idx, [token]))
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
177
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
178 else:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
179 if curcode:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
180 for item in do_insertions(
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
181 insertions, jllexer.get_tokens_unprocessed(curcode)):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
182 yield item
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
183 curcode = ''
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
184 insertions = []
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
185
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
186 yield match.start(), Generic.Output, line
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
187
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
188 if curcode: # or item:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
189 for item in do_insertions(
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
190 insertions, jllexer.get_tokens_unprocessed(curcode)):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
191 yield item
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 class MuPADLexer(RegexLexer):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 A `MuPAD <http://www.mupad.com>`_ lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 Contributed by Christopher Creutzig <christopher@creutzig.de>.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 *New in Pygments 0.8.*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 name = 'MuPAD'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 aliases = ['mupad']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 filenames = ['*.mu']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 tokens = {
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 'root' : [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 (r'//.*?$', Comment.Single),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 (r'/\*', Comment.Multiline, 'comment'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 (r'"(?:[^"\\]|\\.)*"', String),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 (r'\(|\)|\[|\]|\{|\}', Punctuation),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 (r'''(?x)\b(?:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 next|break|end|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 axiom|end_axiom|category|end_category|domain|end_domain|inherits|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 if|%if|then|elif|else|end_if|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 case|of|do|otherwise|end_case|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 while|end_while|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 repeat|until|end_repeat|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 for|from|to|downto|step|end_for|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 proc|local|option|save|begin|end_proc|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 delete|frame
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 )\b''', Keyword),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 (r'''(?x)\b(?:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 DOM_ARRAY|DOM_BOOL|DOM_COMPLEX|DOM_DOMAIN|DOM_EXEC|DOM_EXPR|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 DOM_FAIL|DOM_FLOAT|DOM_FRAME|DOM_FUNC_ENV|DOM_HFARRAY|DOM_IDENT|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 DOM_INT|DOM_INTERVAL|DOM_LIST|DOM_NIL|DOM_NULL|DOM_POLY|DOM_PROC|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 DOM_PROC_ENV|DOM_RAT|DOM_SET|DOM_STRING|DOM_TABLE|DOM_VAR
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 )\b''', Name.Class),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 (r'''(?x)\b(?:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 PI|EULER|E|CATALAN|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 NIL|FAIL|undefined|infinity|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 TRUE|FALSE|UNKNOWN
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 )\b''',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 Name.Constant),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 (r'\b(?:dom|procname)\b', Name.Builtin.Pseudo),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 (r'\.|,|:|;|=|\+|-|\*|/|\^|@|>|<|\$|\||!|\'|%|~=', Operator),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 (r'''(?x)\b(?:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 and|or|not|xor|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 assuming|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 div|mod|
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 union|minus|intersect|in|subset
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 )\b''',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 Operator.Word),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 (r'\b(?:I|RDN_INF|RD_NINF|RD_NAN)\b', Number),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 #(r'\b(?:adt|linalg|newDomain|hold)\b', Name.Builtin),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 (r'''(?x)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 ((?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
247 (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)(\s*)([(])''',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
248 bygroups(Name.Function, Text, Punctuation)),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 (r'''(?x)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 (?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*''', Name.Variable),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 (r'\.[0-9]+(?:e[0-9]+)?', Number),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 (r'.', Text)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 ],
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 'comment' : [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 (r'[^*/]', Comment.Multiline),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 (r'/\*', Comment.Multiline, '#push'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 (r'\*/', Comment.Multiline, '#pop'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 (r'[*/]', Comment.Multiline)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 ]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 }
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 class MatlabLexer(RegexLexer):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 """
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
267 For Matlab source code.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 *New in Pygments 0.10.*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 name = 'Matlab'
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
272 aliases = ['matlab']
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 filenames = ['*.m']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 mimetypes = ['text/matlab']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 # These lists are generated automatically.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 # Run the following in bash shell:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 # for f in elfun specfun elmat; do
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 # echo -n "$f = "
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 # matlab -nojvm -r "help $f;exit;" | perl -ne \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 # 'push(@c,$1) if /^ (\w+)\s+-/; END {print q{["}.join(q{","},@c).qq{"]\n};}'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 # done
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 # elfun: Elementary math functions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 # specfun: Special Math functions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 # elmat: Elementary matrices and matrix manipulation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 # taken from Matlab version 7.4.0.336 (R2007a)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 elfun = ["sin","sind","sinh","asin","asind","asinh","cos","cosd","cosh",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 "acos","acosd","acosh","tan","tand","tanh","atan","atand","atan2",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 "atanh","sec","secd","sech","asec","asecd","asech","csc","cscd",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 "csch","acsc","acscd","acsch","cot","cotd","coth","acot","acotd",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "acoth","hypot","exp","expm1","log","log1p","log10","log2","pow2",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 "realpow","reallog","realsqrt","sqrt","nthroot","nextpow2","abs",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 "angle","complex","conj","imag","real","unwrap","isreal","cplxpair",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 "fix","floor","ceil","round","mod","rem","sign"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 specfun = ["airy","besselj","bessely","besselh","besseli","besselk","beta",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 "betainc","betaln","ellipj","ellipke","erf","erfc","erfcx",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 "erfinv","expint","gamma","gammainc","gammaln","psi","legendre",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 "cross","dot","factor","isprime","primes","gcd","lcm","rat",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 "rats","perms","nchoosek","factorial","cart2sph","cart2pol",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 "pol2cart","sph2cart","hsv2rgb","rgb2hsv"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 elmat = ["zeros","ones","eye","repmat","rand","randn","linspace","logspace",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 "freqspace","meshgrid","accumarray","size","length","ndims","numel",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 "disp","isempty","isequal","isequalwithequalnans","cat","reshape",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 "diag","blkdiag","tril","triu","fliplr","flipud","flipdim","rot90",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 "find","end","sub2ind","ind2sub","bsxfun","ndgrid","permute",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 "ipermute","shiftdim","circshift","squeeze","isscalar","isvector",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 "ans","eps","realmax","realmin","pi","i","inf","nan","isnan",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 "isinf","isfinite","j","why","compan","gallery","hadamard","hankel",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 "hilb","invhilb","magic","pascal","rosser","toeplitz","vander",
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 "wilkinson"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 tokens = {
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 'root': [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 # line starting with '!' is sent as a system command. not sure what
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 # label to use...
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 (r'^!.*', String.Other),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
322 (r'%\{\s*\n', Comment.Multiline, 'blockcomment'),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 (r'%.*$', Comment),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 (r'^\s*function', Keyword, 'deffunc'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325
808
8f85926125ef Updated Pygments to version 1.4.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 684
diff changeset
326 # from 'iskeyword' on version 7.11 (R2010):
8f85926125ef Updated Pygments to version 1.4.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 684
diff changeset
327 (r'(break|case|catch|classdef|continue|else|elseif|end|enumerated|'
8f85926125ef Updated Pygments to version 1.4.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 684
diff changeset
328 r'events|for|function|global|if|methods|otherwise|parfor|'
8f85926125ef Updated Pygments to version 1.4.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 684
diff changeset
329 r'persistent|properties|return|spmd|switch|try|while)\b', Keyword),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 ("(" + "|".join(elfun+specfun+elmat) + r')\b', Name.Builtin),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
333 # line continuation with following comment:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
334 (r'\.\.\..*$', Comment),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
335
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 # operators:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 # operators requiring escape for re:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 # punctuation:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 (r'=|:|;', Punctuation),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 # quote can be transpose, instead of string:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 # (not great, but handles common cases...)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 (r'(?<=[\w\)\]])\'', Operator),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
349 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
350 (r'\d+[eEf][+-]?[0-9]+', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
351 (r'\d+', Number.Integer),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
352
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 (r'(?<![\w\)\]])\'', String, 'string'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 (r'.', Text),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 ],
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 'string': [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 (r'[^\']*\'', String, '#pop')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 ],
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
360 'blockcomment': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
361 (r'^\s*%\}', Comment.Multiline, '#pop'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
362 (r'^.*\n', Comment.Multiline),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
363 (r'.', Comment.Multiline),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
364 ],
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 'deffunc': [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 Text.Whitespace, Name.Function, Punctuation, Text,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 Punctuation, Text.Whitespace), '#pop'),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 ],
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 }
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 def analyse_text(text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 if re.match('^\s*%', text, re.M): # comment
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 return 0.9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 elif re.match('^!\w+', text, re.M): # system cmd
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 return 0.9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 return 0.1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
380
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 line_re = re.compile('.*?\n')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 class MatlabSessionLexer(Lexer):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 """
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
385 For Matlab sessions. Modeled after PythonConsoleLexer.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 Contributed by Ken Schutte <kschutte@csail.mit.edu>.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 *New in Pygments 0.10.*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 name = 'Matlab session'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 aliases = ['matlabsession']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 def get_tokens_unprocessed(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 mlexer = MatlabLexer(**self.options)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 curcode = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 insertions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 for match in line_re.finditer(text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 line = match.group()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 if line.startswith('>>'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 insertions.append((len(curcode),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 [(0, Generic.Prompt, line[:3])]))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 curcode += line[3:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 elif line.startswith('???'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 idx = len(curcode)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 # without is showing error on same line as before...?
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 line = "\n" + line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 token = (0, Generic.Traceback, line)
808
8f85926125ef Updated Pygments to version 1.4.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 684
diff changeset
414 insertions.append((idx, [token]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 if curcode:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 for item in do_insertions(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 insertions, mlexer.get_tokens_unprocessed(curcode)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 yield item
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 curcode = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 insertions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 yield match.start(), Generic.Output, line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 if curcode: # or item:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 for item in do_insertions(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 insertions, mlexer.get_tokens_unprocessed(curcode)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 yield item
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
432 class OctaveLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
433 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
434 For GNU Octave source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
435
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
436 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
437 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
438 name = 'Octave'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
439 aliases = ['octave']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
440 filenames = ['*.m']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
441 mimetypes = ['text/octave']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
442
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
443 # These lists are generated automatically.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
444 # Run the following in bash shell:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
445 #
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
446 # First dump all of the Octave manual into a plain text file:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
447 #
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
448 # $ info octave --subnodes -o octave-manual
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
449 #
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
450 # Now grep through it:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
451
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
452 # for i in \
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
453 # "Built-in Function" "Command" "Function File" \
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
454 # "Loadable Function" "Mapping Function";
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
455 # do
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
456 # perl -e '@name = qw('"$i"');
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
457 # print lc($name[0]),"_kw = [\n"';
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
458 #
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
459 # perl -n -e 'print "\"$1\",\n" if /-- '"$i"': .* (\w*) \(/;' \
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
460 # octave-manual | sort | uniq ;
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
461 # echo "]" ;
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
462 # echo;
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
463 # done
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
464
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
465 # taken from Octave Mercurial changeset 8cc154f45e37 (30-jan-2011)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
466
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
467 builtin_kw = [ "addlistener", "addpath", "addproperty", "all",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
468 "and", "any", "argnames", "argv", "assignin",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
469 "atexit", "autoload",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
470 "available_graphics_toolkits", "beep_on_error",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
471 "bitand", "bitmax", "bitor", "bitshift", "bitxor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
472 "cat", "cell", "cellstr", "char", "class", "clc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
473 "columns", "command_line_path",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
474 "completion_append_char", "completion_matches",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
475 "complex", "confirm_recursive_rmdir", "cputime",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
476 "crash_dumps_octave_core", "ctranspose", "cumprod",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
477 "cumsum", "debug_on_error", "debug_on_interrupt",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
478 "debug_on_warning", "default_save_options",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
479 "dellistener", "diag", "diff", "disp",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
480 "doc_cache_file", "do_string_escapes", "double",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
481 "drawnow", "e", "echo_executing_commands", "eps",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
482 "eq", "errno", "errno_list", "error", "eval",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
483 "evalin", "exec", "exist", "exit", "eye", "false",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
484 "fclear", "fclose", "fcntl", "fdisp", "feof",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
485 "ferror", "feval", "fflush", "fgetl", "fgets",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
486 "fieldnames", "file_in_loadpath", "file_in_path",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
487 "filemarker", "filesep", "find_dir_in_path",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
488 "fixed_point_format", "fnmatch", "fopen", "fork",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
489 "formula", "fprintf", "fputs", "fread", "freport",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
490 "frewind", "fscanf", "fseek", "fskipl", "ftell",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
491 "functions", "fwrite", "ge", "genpath", "get",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
492 "getegid", "getenv", "geteuid", "getgid",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
493 "getpgrp", "getpid", "getppid", "getuid", "glob",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
494 "gt", "gui_mode", "history_control",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
495 "history_file", "history_size",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
496 "history_timestamp_format_string", "home",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
497 "horzcat", "hypot", "ifelse",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
498 "ignore_function_time_stamp", "inferiorto",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
499 "info_file", "info_program", "inline", "input",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
500 "intmax", "intmin", "ipermute",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
501 "is_absolute_filename", "isargout", "isbool",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
502 "iscell", "iscellstr", "ischar", "iscomplex",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
503 "isempty", "isfield", "isfloat", "isglobal",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
504 "ishandle", "isieee", "isindex", "isinteger",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
505 "islogical", "ismatrix", "ismethod", "isnull",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
506 "isnumeric", "isobject", "isreal",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
507 "is_rooted_relative_filename", "issorted",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
508 "isstruct", "isvarname", "kbhit", "keyboard",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
509 "kill", "lasterr", "lasterror", "lastwarn",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
510 "ldivide", "le", "length", "link", "linspace",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
511 "logical", "lstat", "lt", "make_absolute_filename",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
512 "makeinfo_program", "max_recursion_depth", "merge",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
513 "methods", "mfilename", "minus", "mislocked",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
514 "mkdir", "mkfifo", "mkstemp", "mldivide", "mlock",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
515 "mouse_wheel_zoom", "mpower", "mrdivide", "mtimes",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
516 "munlock", "nargin", "nargout",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
517 "native_float_format", "ndims", "ne", "nfields",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
518 "nnz", "norm", "not", "numel", "nzmax",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
519 "octave_config_info", "octave_core_file_limit",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
520 "octave_core_file_name",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
521 "octave_core_file_options", "ones", "or",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
522 "output_max_field_width", "output_precision",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
523 "page_output_immediately", "page_screen_output",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
524 "path", "pathsep", "pause", "pclose", "permute",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
525 "pi", "pipe", "plus", "popen", "power",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
526 "print_empty_dimensions", "printf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
527 "print_struct_array_contents", "prod",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
528 "program_invocation_name", "program_name",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
529 "putenv", "puts", "pwd", "quit", "rats", "rdivide",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
530 "readdir", "readlink", "read_readline_init_file",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
531 "realmax", "realmin", "rehash", "rename",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
532 "repelems", "re_read_readline_init_file", "reset",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
533 "reshape", "resize", "restoredefaultpath",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
534 "rethrow", "rmdir", "rmfield", "rmpath", "rows",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
535 "save_header_format_string", "save_precision",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
536 "saving_history", "scanf", "set", "setenv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
537 "shell_cmd", "sighup_dumps_octave_core",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
538 "sigterm_dumps_octave_core", "silent_functions",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
539 "single", "size", "size_equal", "sizemax",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
540 "sizeof", "sleep", "source", "sparse_auto_mutate",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
541 "split_long_rows", "sprintf", "squeeze", "sscanf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
542 "stat", "stderr", "stdin", "stdout", "strcmp",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
543 "strcmpi", "string_fill_char", "strncmp",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
544 "strncmpi", "struct", "struct_levels_to_print",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
545 "strvcat", "subsasgn", "subsref", "sum", "sumsq",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
546 "superiorto", "suppress_verbose_help_message",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
547 "symlink", "system", "tic", "tilde_expand",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
548 "times", "tmpfile", "tmpnam", "toc", "toupper",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
549 "transpose", "true", "typeinfo", "umask", "uminus",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
550 "uname", "undo_string_escapes", "unlink", "uplus",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
551 "upper", "usage", "usleep", "vec", "vectorize",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
552 "vertcat", "waitpid", "warning", "warranty",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
553 "whos_line_format", "yes_or_no", "zeros",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
554 "inf", "Inf", "nan", "NaN"]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
555
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
556 command_kw = [ "close", "load", "who", "whos", ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
557
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
558 function_kw = [ "accumarray", "accumdim", "acosd", "acotd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
559 "acscd", "addtodate", "allchild", "ancestor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
560 "anova", "arch_fit", "arch_rnd", "arch_test",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
561 "area", "arma_rnd", "arrayfun", "ascii", "asctime",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
562 "asecd", "asind", "assert", "atand",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
563 "autoreg_matrix", "autumn", "axes", "axis", "bar",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
564 "barh", "bartlett", "bartlett_test", "beep",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
565 "betacdf", "betainv", "betapdf", "betarnd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
566 "bicgstab", "bicubic", "binary", "binocdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
567 "binoinv", "binopdf", "binornd", "bitcmp",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
568 "bitget", "bitset", "blackman", "blanks",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
569 "blkdiag", "bone", "box", "brighten", "calendar",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
570 "cast", "cauchy_cdf", "cauchy_inv", "cauchy_pdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
571 "cauchy_rnd", "caxis", "celldisp", "center", "cgs",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
572 "chisquare_test_homogeneity",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
573 "chisquare_test_independence", "circshift", "cla",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
574 "clabel", "clf", "clock", "cloglog", "closereq",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
575 "colon", "colorbar", "colormap", "colperm",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
576 "comet", "common_size", "commutation_matrix",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
577 "compan", "compare_versions", "compass",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
578 "computer", "cond", "condest", "contour",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
579 "contourc", "contourf", "contrast", "conv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
580 "convhull", "cool", "copper", "copyfile", "cor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
581 "corrcoef", "cor_test", "cosd", "cotd", "cov",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
582 "cplxpair", "cross", "cscd", "cstrcat", "csvread",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
583 "csvwrite", "ctime", "cumtrapz", "curl", "cut",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
584 "cylinder", "date", "datenum", "datestr",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
585 "datetick", "datevec", "dblquad", "deal",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
586 "deblank", "deconv", "delaunay", "delaunayn",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
587 "delete", "demo", "detrend", "diffpara", "diffuse",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
588 "dir", "discrete_cdf", "discrete_inv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
589 "discrete_pdf", "discrete_rnd", "display",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
590 "divergence", "dlmwrite", "dos", "dsearch",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
591 "dsearchn", "duplication_matrix", "durbinlevinson",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
592 "ellipsoid", "empirical_cdf", "empirical_inv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
593 "empirical_pdf", "empirical_rnd", "eomday",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
594 "errorbar", "etime", "etreeplot", "example",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
595 "expcdf", "expinv", "expm", "exppdf", "exprnd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
596 "ezcontour", "ezcontourf", "ezmesh", "ezmeshc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
597 "ezplot", "ezpolar", "ezsurf", "ezsurfc", "factor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
598 "factorial", "fail", "fcdf", "feather", "fftconv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
599 "fftfilt", "fftshift", "figure", "fileattrib",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
600 "fileparts", "fill", "findall", "findobj",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
601 "findstr", "finv", "flag", "flipdim", "fliplr",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
602 "flipud", "fpdf", "fplot", "fractdiff", "freqz",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
603 "freqz_plot", "frnd", "fsolve",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
604 "f_test_regression", "ftp", "fullfile", "fzero",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
605 "gamcdf", "gaminv", "gampdf", "gamrnd", "gca",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
606 "gcbf", "gcbo", "gcf", "genvarname", "geocdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
607 "geoinv", "geopdf", "geornd", "getfield", "ginput",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
608 "glpk", "gls", "gplot", "gradient",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
609 "graphics_toolkit", "gray", "grid", "griddata",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
610 "griddatan", "gtext", "gunzip", "gzip", "hadamard",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
611 "hamming", "hankel", "hanning", "hggroup",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
612 "hidden", "hilb", "hist", "histc", "hold", "hot",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
613 "hotelling_test", "housh", "hsv", "hurst",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
614 "hygecdf", "hygeinv", "hygepdf", "hygernd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
615 "idivide", "ifftshift", "image", "imagesc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
616 "imfinfo", "imread", "imshow", "imwrite", "index",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
617 "info", "inpolygon", "inputname", "interpft",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
618 "interpn", "intersect", "invhilb", "iqr", "isa",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
619 "isdefinite", "isdir", "is_duplicate_entry",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
620 "isequal", "isequalwithequalnans", "isfigure",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
621 "ishermitian", "ishghandle", "is_leap_year",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
622 "isletter", "ismac", "ismember", "ispc", "isprime",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
623 "isprop", "isscalar", "issquare", "isstrprop",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
624 "issymmetric", "isunix", "is_valid_file_id",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
625 "isvector", "jet", "kendall",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
626 "kolmogorov_smirnov_cdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
627 "kolmogorov_smirnov_test", "kruskal_wallis_test",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
628 "krylov", "kurtosis", "laplace_cdf", "laplace_inv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
629 "laplace_pdf", "laplace_rnd", "legend", "legendre",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
630 "license", "line", "linkprop", "list_primes",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
631 "loadaudio", "loadobj", "logistic_cdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
632 "logistic_inv", "logistic_pdf", "logistic_rnd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
633 "logit", "loglog", "loglogerr", "logm", "logncdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
634 "logninv", "lognpdf", "lognrnd", "logspace",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
635 "lookfor", "ls_command", "lsqnonneg", "magic",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
636 "mahalanobis", "manova", "matlabroot",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
637 "mcnemar_test", "mean", "meansq", "median", "menu",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
638 "mesh", "meshc", "meshgrid", "meshz", "mexext",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
639 "mget", "mkpp", "mode", "moment", "movefile",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
640 "mpoles", "mput", "namelengthmax", "nargchk",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
641 "nargoutchk", "nbincdf", "nbininv", "nbinpdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
642 "nbinrnd", "nchoosek", "ndgrid", "newplot", "news",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
643 "nonzeros", "normcdf", "normest", "norminv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
644 "normpdf", "normrnd", "now", "nthroot", "null",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
645 "ocean", "ols", "onenormest", "optimget",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
646 "optimset", "orderfields", "orient", "orth",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
647 "pack", "pareto", "parseparams", "pascal", "patch",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
648 "pathdef", "pcg", "pchip", "pcolor", "pcr",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
649 "peaks", "periodogram", "perl", "perms", "pie",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
650 "pink", "planerot", "playaudio", "plot",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
651 "plotmatrix", "plotyy", "poisscdf", "poissinv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
652 "poisspdf", "poissrnd", "polar", "poly",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
653 "polyaffine", "polyarea", "polyderiv", "polyfit",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
654 "polygcd", "polyint", "polyout", "polyreduce",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
655 "polyval", "polyvalm", "postpad", "powerset",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
656 "ppder", "ppint", "ppjumps", "ppplot", "ppval",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
657 "pqpnonneg", "prepad", "primes", "print",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
658 "print_usage", "prism", "probit", "qp", "qqplot",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
659 "quadcc", "quadgk", "quadl", "quadv", "quiver",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
660 "qzhess", "rainbow", "randi", "range", "rank",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
661 "ranks", "rat", "reallog", "realpow", "realsqrt",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
662 "record", "rectangle_lw", "rectangle_sw",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
663 "rectint", "refresh", "refreshdata",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
664 "regexptranslate", "repmat", "residue", "ribbon",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
665 "rindex", "roots", "rose", "rosser", "rotdim",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
666 "rref", "run", "run_count", "rundemos", "run_test",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
667 "runtests", "saveas", "saveaudio", "saveobj",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
668 "savepath", "scatter", "secd", "semilogx",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
669 "semilogxerr", "semilogy", "semilogyerr",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
670 "setaudio", "setdiff", "setfield", "setxor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
671 "shading", "shift", "shiftdim", "sign_test",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
672 "sinc", "sind", "sinetone", "sinewave", "skewness",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
673 "slice", "sombrero", "sortrows", "spaugment",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
674 "spconvert", "spdiags", "spearman", "spectral_adf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
675 "spectral_xdf", "specular", "speed", "spencer",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
676 "speye", "spfun", "sphere", "spinmap", "spline",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
677 "spones", "sprand", "sprandn", "sprandsym",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
678 "spring", "spstats", "spy", "sqp", "stairs",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
679 "statistics", "std", "stdnormal_cdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
680 "stdnormal_inv", "stdnormal_pdf", "stdnormal_rnd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
681 "stem", "stft", "strcat", "strchr", "strjust",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
682 "strmatch", "strread", "strsplit", "strtok",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
683 "strtrim", "strtrunc", "structfun", "studentize",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
684 "subplot", "subsindex", "subspace", "substr",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
685 "substruct", "summer", "surf", "surface", "surfc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
686 "surfl", "surfnorm", "svds", "swapbytes",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
687 "sylvester_matrix", "symvar", "synthesis", "table",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
688 "tand", "tar", "tcdf", "tempdir", "tempname",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
689 "test", "text", "textread", "textscan", "tinv",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
690 "title", "toeplitz", "tpdf", "trace", "trapz",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
691 "treelayout", "treeplot", "triangle_lw",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
692 "triangle_sw", "tril", "trimesh", "triplequad",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
693 "triplot", "trisurf", "triu", "trnd", "tsearchn",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
694 "t_test", "t_test_regression", "type", "unidcdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
695 "unidinv", "unidpdf", "unidrnd", "unifcdf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
696 "unifinv", "unifpdf", "unifrnd", "union", "unique",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
697 "unix", "unmkpp", "unpack", "untabify", "untar",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
698 "unwrap", "unzip", "u_test", "validatestring",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
699 "vander", "var", "var_test", "vech", "ver",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
700 "version", "view", "voronoi", "voronoin",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
701 "waitforbuttonpress", "wavread", "wavwrite",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
702 "wblcdf", "wblinv", "wblpdf", "wblrnd", "weekday",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
703 "welch_test", "what", "white", "whitebg",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
704 "wienrnd", "wilcoxon_test", "wilkinson", "winter",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
705 "xlabel", "xlim", "ylabel", "yulewalker", "zip",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
706 "zlabel", "z_test", ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
707
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
708 loadable_kw = [ "airy", "amd", "balance", "besselh", "besseli",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
709 "besselj", "besselk", "bessely", "bitpack",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
710 "bsxfun", "builtin", "ccolamd", "cellfun",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
711 "cellslices", "chol", "choldelete", "cholinsert",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
712 "cholinv", "cholshift", "cholupdate", "colamd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
713 "colloc", "convhulln", "convn", "csymamd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
714 "cummax", "cummin", "daspk", "daspk_options",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
715 "dasrt", "dasrt_options", "dassl", "dassl_options",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
716 "dbclear", "dbdown", "dbstack", "dbstatus",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
717 "dbstop", "dbtype", "dbup", "dbwhere", "det",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
718 "dlmread", "dmperm", "dot", "eig", "eigs",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
719 "endgrent", "endpwent", "etree", "fft", "fftn",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
720 "fftw", "filter", "find", "full", "gcd",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
721 "getgrent", "getgrgid", "getgrnam", "getpwent",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
722 "getpwnam", "getpwuid", "getrusage", "givens",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
723 "gmtime", "gnuplot_binary", "hess", "ifft",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
724 "ifftn", "inv", "isdebugmode", "issparse", "kron",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
725 "localtime", "lookup", "lsode", "lsode_options",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
726 "lu", "luinc", "luupdate", "matrix_type", "max",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
727 "min", "mktime", "pinv", "qr", "qrdelete",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
728 "qrinsert", "qrshift", "qrupdate", "quad",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
729 "quad_options", "qz", "rand", "rande", "randg",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
730 "randn", "randp", "randperm", "rcond", "regexp",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
731 "regexpi", "regexprep", "schur", "setgrent",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
732 "setpwent", "sort", "spalloc", "sparse", "spparms",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
733 "sprank", "sqrtm", "strfind", "strftime",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
734 "strptime", "strrep", "svd", "svd_driver", "syl",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
735 "symamd", "symbfact", "symrcm", "time", "tsearch",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
736 "typecast", "urlread", "urlwrite", ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
737
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
738 mapping_kw = [ "abs", "acos", "acosh", "acot", "acoth", "acsc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
739 "acsch", "angle", "arg", "asec", "asech", "asin",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
740 "asinh", "atan", "atanh", "beta", "betainc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
741 "betaln", "bincoeff", "cbrt", "ceil", "conj", "cos",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
742 "cosh", "cot", "coth", "csc", "csch", "erf", "erfc",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
743 "erfcx", "erfinv", "exp", "finite", "fix", "floor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
744 "fmod", "gamma", "gammainc", "gammaln", "imag",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
745 "isalnum", "isalpha", "isascii", "iscntrl",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
746 "isdigit", "isfinite", "isgraph", "isinf",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
747 "islower", "isna", "isnan", "isprint", "ispunct",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
748 "isspace", "isupper", "isxdigit", "lcm", "lgamma",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
749 "log", "lower", "mod", "real", "rem", "round",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
750 "roundb", "sec", "sech", "sign", "sin", "sinh",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
751 "sqrt", "tan", "tanh", "toascii", "tolower", "xor",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
752 ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
753
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
754 builtin_consts = [ "EDITOR", "EXEC_PATH", "I", "IMAGE_PATH", "NA",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
755 "OCTAVE_HOME", "OCTAVE_VERSION", "PAGER",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
756 "PAGER_FLAGS", "SEEK_CUR", "SEEK_END", "SEEK_SET",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
757 "SIG", "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
758 "S_ISLNK", "S_ISREG", "S_ISSOCK", "WCONTINUE",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
759 "WCOREDUMP", "WEXITSTATUS", "WIFCONTINUED",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
760 "WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG",
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
761 "WSTOPSIG", "WTERMSIG", "WUNTRACED", ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
762
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
763 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
764 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
765 #We should look into multiline comments
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
766 (r'[%#].*$', Comment),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
767 (r'^\s*function', Keyword, 'deffunc'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
768
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
769 # from 'iskeyword' on hg changeset 8cc154f45e37
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
770 (r'(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
771 r'elseif|end|end_try_catch|end_unwind_protect|endclassdef|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
772 r'endevents|endfor|endfunction|endif|endmethods|endproperties|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
773 r'endswitch|endwhile|events|for|function|get|global|if|methods|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
774 r'otherwise|persistent|properties|return|set|static|switch|try|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
775 r'until|unwind_protect|unwind_protect_cleanup|while)\b', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
776
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
777 ("(" + "|".join( builtin_kw + command_kw
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
778 + function_kw + loadable_kw
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
779 + mapping_kw) + r')\b', Name.Builtin),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
780
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
781 ("(" + "|".join(builtin_consts) + r')\b', Name.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
782
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
783 # operators in Octave but not Matlab:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
784 (r'-=|!=|!|/=|--', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
785 # operators:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
786 (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
787 # operators in Octave but not Matlab requiring escape for re:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
788 (r'\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*',Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
789 # operators requiring escape for re:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
790 (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
791
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
792
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
793 # punctuation:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
794 (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
795 (r'=|:|;', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
796
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
797 (r'"[^"]*"', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
798
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
799 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
800 (r'\d+[eEf][+-]?[0-9]+', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
801 (r'\d+', Number.Integer),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
802
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
803 # quote can be transpose, instead of string:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
804 # (not great, but handles common cases...)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
805 (r'(?<=[\w\)\]])\'', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
806 (r'(?<![\w\)\]])\'', String, 'string'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
807
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
808 ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
809 (r'.', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
810 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
811 'string': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
812 (r"[^']*'", String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
813 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
814 'deffunc': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
815 (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
816 bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
817 Text.Whitespace, Name.Function, Punctuation, Text,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
818 Punctuation, Text.Whitespace), '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
819 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
820 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
821
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
822 def analyse_text(text):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
823 if re.match('^\s*[%#]', text, re.M): #Comment
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
824 return 0.1
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
825
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
826
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
827 class ScilabLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
828 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
829 For Scilab source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
830
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
831 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
832 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
833 name = 'Scilab'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
834 aliases = ['scilab']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
835 filenames = ['*.sci', '*.sce', '*.tst']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
836 mimetypes = ['text/scilab']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
837
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
838 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
839 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
840 (r'//.*?$', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
841 (r'^\s*function', Keyword, 'deffunc'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
842
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
843 (r'(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
844 r'elseif|end|end_try_catch|end_unwind_protect|endclassdef|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
845 r'endevents|endfor|endfunction|endif|endmethods|endproperties|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
846 r'endswitch|endwhile|events|for|function|get|global|if|methods|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
847 r'otherwise|persistent|properties|return|set|static|switch|try|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
848 r'until|unwind_protect|unwind_protect_cleanup|while)\b', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
849
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
850 ("(" + "|".join(_scilab_builtins.functions_kw +
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
851 _scilab_builtins.commands_kw +
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
852 _scilab_builtins.macros_kw
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
853 ) + r')\b', Name.Builtin),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
854
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
855 (r'(%s)\b' % "|".join(map(re.escape, _scilab_builtins.builtin_consts)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
856 Name.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
857
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
858 # operators:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
859 (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
860 # operators requiring escape for re:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
861 (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
862
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
863 # punctuation:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
864 (r'[\[\](){}@.,=:;]', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
865
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
866 (r'"[^"]*"', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
867
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
868 # quote can be transpose, instead of string:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
869 # (not great, but handles common cases...)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
870 (r'(?<=[\w\)\]])\'', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
871 (r'(?<![\w\)\]])\'', String, 'string'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
872
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
873 (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
874 (r'\d+[eEf][+-]?[0-9]+', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
875 (r'\d+', Number.Integer),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
876
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
877 ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
878 (r'.', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
879 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
880 'string': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
881 (r"[^']*'", String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
882 (r'.', String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
883 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
884 'deffunc': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
885 (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
886 bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
887 Text.Whitespace, Name.Function, Punctuation, Text,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
888 Punctuation, Text.Whitespace), '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
889 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
890 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
891
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
892
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 class NumPyLexer(PythonLexer):
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
894 """
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 A Python lexer recognizing Numerical Python builtins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897 *New in Pygments 0.10.*
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 808
diff changeset
898 """
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 name = 'NumPy'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 aliases = ['numpy']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 # override the mimetypes to not inherit them from python
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 mimetypes = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 filenames = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 EXTRA_KEYWORDS = set([
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 'abs', 'absolute', 'accumulate', 'add', 'alen', 'all', 'allclose',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 'alltrue', 'alterdot', 'amax', 'amin', 'angle', 'any', 'append',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 'apply_along_axis', 'apply_over_axes', 'arange', 'arccos', 'arccosh',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'argmax', 'argmin',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 'argsort', 'argwhere', 'around', 'array', 'array2string', 'array_equal',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 'array_equiv', 'array_repr', 'array_split', 'array_str', 'arrayrange',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 'asanyarray', 'asarray', 'asarray_chkfinite', 'ascontiguousarray',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 'asfarray', 'asfortranarray', 'asmatrix', 'asscalar', 'astype',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 'atleast_1d', 'atleast_2d', 'atleast_3d', 'average', 'bartlett',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 'base_repr', 'beta', 'binary_repr', 'bincount', 'binomial',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'blackman',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 'bmat', 'broadcast', 'byte_bounds', 'bytes', 'byteswap', 'c_',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 'can_cast', 'ceil', 'choose', 'clip', 'column_stack', 'common_type',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 'compare_chararrays', 'compress', 'concatenate', 'conj', 'conjugate',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 'convolve', 'copy', 'corrcoef', 'correlate', 'cos', 'cosh', 'cov',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 'cross', 'cumprod', 'cumproduct', 'cumsum', 'delete', 'deprecate',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 'diag', 'diagflat', 'diagonal', 'diff', 'digitize', 'disp', 'divide',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 'dot', 'dsplit', 'dstack', 'dtype', 'dump', 'dumps', 'ediff1d', 'empty',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'extract', 'eye',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 'fabs', 'fastCopyAndTranspose', 'fft', 'fftfreq', 'fftshift', 'fill',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 'finfo', 'fix', 'flat', 'flatnonzero', 'flatten', 'fliplr', 'flipud',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 'floor', 'floor_divide', 'fmod', 'frexp', 'fromarrays', 'frombuffer',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 'fromfile', 'fromfunction', 'fromiter', 'frompyfunc', 'fromstring',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 'generic', 'get_array_wrap', 'get_include', 'get_numarray_include',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 'get_numpy_include', 'get_printoptions', 'getbuffer', 'getbufsize',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 'geterr', 'geterrcall', 'geterrobj', 'getfield', 'gradient', 'greater',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 'greater_equal', 'gumbel', 'hamming', 'hanning', 'histogram',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 'histogram2d', 'histogramdd', 'hsplit', 'hstack', 'hypot', 'i0',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 'identity', 'ifft', 'imag', 'index_exp', 'indices', 'inf', 'info',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 'inner', 'insert', 'int_asbuffer', 'interp', 'intersect1d',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 'intersect1d_nu', 'inv', 'invert', 'iscomplex', 'iscomplexobj',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 'isfinite', 'isfortran', 'isinf', 'isnan', 'isneginf', 'isposinf',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 'isreal', 'isrealobj', 'isscalar', 'issctype', 'issubclass_',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 'issubdtype', 'issubsctype', 'item', 'itemset', 'iterable', 'ix_',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 'kaiser', 'kron', 'ldexp', 'left_shift', 'less', 'less_equal', 'lexsort',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 'linspace', 'load', 'loads', 'loadtxt', 'log', 'log10', 'log1p', 'log2',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'logspace',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 'lstsq', 'mat', 'matrix', 'max', 'maximum', 'maximum_sctype',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 'may_share_memory', 'mean', 'median', 'meshgrid', 'mgrid', 'min',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 'minimum', 'mintypecode', 'mod', 'modf', 'msort', 'multiply', 'nan',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 'nan_to_num', 'nanargmax', 'nanargmin', 'nanmax', 'nanmin', 'nansum',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 'ndenumerate', 'ndim', 'ndindex', 'negative', 'newaxis', 'newbuffer',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 'newbyteorder', 'nonzero', 'not_equal', 'obj2sctype', 'ogrid', 'ones',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 'ones_like', 'outer', 'permutation', 'piecewise', 'pinv', 'pkgload',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 'place', 'poisson', 'poly', 'poly1d', 'polyadd', 'polyder', 'polydiv',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 'polyfit', 'polyint', 'polymul', 'polysub', 'polyval', 'power', 'prod',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 'product', 'ptp', 'put', 'putmask', 'r_', 'randint', 'random_integers',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 'random_sample', 'ranf', 'rank', 'ravel', 'real', 'real_if_close',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 'recarray', 'reciprocal', 'reduce', 'remainder', 'repeat', 'require',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 'reshape', 'resize', 'restoredot', 'right_shift', 'rint', 'roll',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 'rollaxis', 'roots', 'rot90', 'round', 'round_', 'row_stack', 's_',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 'sample', 'savetxt', 'sctype2char', 'searchsorted', 'seed', 'select',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 'set_numeric_ops', 'set_printoptions', 'set_string_function',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 'setbufsize', 'setdiff1d', 'seterr', 'seterrcall', 'seterrobj',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 'setfield', 'setflags', 'setmember1d', 'setxor1d', 'shape',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 'show_config', 'shuffle', 'sign', 'signbit', 'sin', 'sinc', 'sinh',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 'size', 'slice', 'solve', 'sometrue', 'sort', 'sort_complex', 'source',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 'split', 'sqrt', 'square', 'squeeze', 'standard_normal', 'std',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 'subtract', 'sum', 'svd', 'swapaxes', 'take', 'tan', 'tanh', 'tensordot',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 'test', 'tile', 'tofile', 'tolist', 'tostring', 'trace', 'transpose',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 'trapz', 'tri', 'tril', 'trim_zeros', 'triu', 'true_divide', 'typeDict',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 'typename', 'uniform', 'union1d', 'unique', 'unique1d', 'unravel_index',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 'unwrap', 'vander', 'var', 'vdot', 'vectorize', 'view', 'vonmises',
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 'vsplit', 'vstack', 'weibull', 'where', 'who', 'zeros', 'zeros_like'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 ])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 def get_tokens_unprocessed(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 for index, token, value in \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 PythonLexer.get_tokens_unprocessed(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 if token is Name and value in self.EXTRA_KEYWORDS:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 yield index, Keyword.Pseudo, value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 yield index, token, value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982
684
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
983 class RConsoleLexer(Lexer):
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
984 """
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
985 For R console transcripts or R CMD BATCH output files.
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
986 """
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
987
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
988 name = 'RConsole'
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
989 aliases = ['rconsole', 'rout']
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
990 filenames = ['*.Rout']
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
991
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
992 def get_tokens_unprocessed(self, text):
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
993 slexer = SLexer(**self.options)
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
994
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
995 current_code_block = ''
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
996 insertions = []
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
997
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
998 for match in line_re.finditer(text):
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
999 line = match.group()
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1000 if line.startswith('>') or line.startswith('+'):
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1001 # Colorize the prompt as such,
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1002 # then put rest of line into current_code_block
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1003 insertions.append((len(current_code_block),
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1004 [(0, Generic.Prompt, line[:2])]))
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1005 current_code_block += line[2:]
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1006 else:
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1007 # We have reached a non-prompt line!
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1008 # If we have stored prompt lines, need to process them first.
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1009 if current_code_block:
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1010 # Weave together the prompts and highlight code.
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1011 for item in do_insertions(insertions,
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1012 slexer.get_tokens_unprocessed(current_code_block)):
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1013 yield item
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1014 # Reset vars for next code block.
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1015 current_code_block = ''
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1016 insertions = []
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1017 # Now process the actual line itself, this is output from R.
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1018 yield match.start(), Generic.Output, line
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1019
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1020 # If we happen to end on a code block with nothing after it, need to
2f29a0b6e1c7 Updated Pygments to version 1.3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1021 # process the last code block. This is neither