diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/Pygments/py3/pygments/lexers/modula2.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 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 b4d98c03cb..cad2f4fd40 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 |