eric6/ThirdParty/Pygments/pygments/lexers/algebra.py

changeset 7701
25f42e208e08
parent 7547
21b0534faebc
child 7983
54c5cfbb1e29
equal deleted inserted replaced
7700:a3cf077a8db3 7701:25f42e208e08
3 pygments.lexers.algebra 3 pygments.lexers.algebra
4 ~~~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for computer algebra systems. 6 Lexers for computer algebra systems.
7 7
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
65 (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number), 65 (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
66 (r'\.[0-9]+(?:e[0-9]+)?', Number), 66 (r'\.[0-9]+(?:e[0-9]+)?', Number),
67 (r'.', Text) 67 (r'.', Text)
68 ], 68 ],
69 } 69 }
70
71 def analyse_text(text):
72 score = 0.0
73
74 # Declaration part
75 if re.search(
76 r"(InstallTrueMethod|Declare(Attribute|Category|Filter|Operation" +
77 r"|GlobalFunction|Synonym|SynonymAttr|Property))", text
78 ):
79 score += 0.7
80
81 # Implementation part
82 if re.search(
83 r"(DeclareRepresentation|Install(GlobalFunction|Method|" +
84 r"ImmediateMethod|OtherMethod)|New(Family|Type)|Objectify)", text
85 ):
86 score += 0.7
87
88 return min(score, 1.0)
70 89
71 90
72 class MathematicaLexer(RegexLexer): 91 class MathematicaLexer(RegexLexer):
73 """ 92 """
74 Lexer for `Mathematica <http://www.wolfram.com/mathematica/>`_ source code. 93 Lexer for `Mathematica <http://www.wolfram.com/mathematica/>`_ source code.

eric ide

mercurial