diff options
author | shadchin <[email protected]> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/Pygments/py3/pygments/lexers/modula2.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/modula2.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/modula2.py | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/modula2.py b/contrib/python/Pygments/py3/pygments/lexers/modula2.py index cad2f4fd408..b4d98c03cb2 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/modula2.py +++ b/contrib/python/Pygments/py3/pygments/lexers/modula2.py @@ -4,7 +4,7 @@ Multi-Dialect Lexer for Modula-2. - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -227,8 +227,8 @@ class Modula2Lexer(RegexLexer): (r'[0-9A-F]+H', Number.Hex), ], 'string_literals': [ - (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), - (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), + (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), ], 'digraph_operators': [ # Dot Product Operator @@ -1546,34 +1546,34 @@ class Modula2Lexer(RegexLexer): # substitute lexemes when in Algol mode if self.algol_publication_mode: if value == '#': - value = '≠' + value = '≠' elif value == '<=': - value = '≤' + value = '≤' elif value == '>=': - value = '≥' + value = '≥' elif value == '==': - value = '≡' + value = '≡' elif value == '*.': - value = '•' + value = '•' # return result yield index, token, value - - def analyse_text(text): - """It's Pascal-like, but does not use FUNCTION -- uses PROCEDURE - instead.""" - - # Check if this looks like Pascal, if not, bail out early - if not ('(*' in text and '*)' in text and ':=' in text): - return - - result = 0 - # Procedure is in Modula2 - if re.search(r'\bPROCEDURE\b', text): - result += 0.6 - - # FUNCTION is only valid in Pascal, but not in Modula2 - if re.search(r'\bFUNCTION\b', text): - result = 0.0 - - return result + + def analyse_text(text): + """It's Pascal-like, but does not use FUNCTION -- uses PROCEDURE + instead.""" + + # Check if this looks like Pascal, if not, bail out early + if not ('(*' in text and '*)' in text and ':=' in text): + return + + result = 0 + # Procedure is in Modula2 + if re.search(r'\bPROCEDURE\b', text): + result += 0.6 + + # FUNCTION is only valid in Pascal, but not in Modula2 + if re.search(r'\bFUNCTION\b', text): + result = 0.0 + + return result |