diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 14:39:19 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 14:39:19 +0300 |
commit | c04b663c7bb4b750deeb8f48f620497ec13da8fa (patch) | |
tree | 151ebc8bfdd2ad918caf5e6e2d8013e14272ddf8 /contrib/python/Pygments/py3/pygments/lexers/pascal.py | |
parent | 0d55ca22c507d18c2f35718687e0b06d9915397b (diff) | |
download | ydb-c04b663c7bb4b750deeb8f48f620497ec13da8fa.tar.gz |
intermediate changes
ref:2d4f292087954c9344efdabb7b2a67f466263c65
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/pascal.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/pascal.py | 144 |
1 files changed, 4 insertions, 140 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/pascal.py b/contrib/python/Pygments/py3/pygments/lexers/pascal.py index 0d1ac3fdb7a..2253a22e7cb 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/pascal.py +++ b/contrib/python/Pygments/py3/pygments/lexers/pascal.py @@ -4,7 +4,7 @@ Lexers for Pascal family languages. - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -20,12 +20,12 @@ from pygments.scanner import Scanner # compatibility import from pygments.lexers.modula2 import Modula2Lexer -__all__ = ['DelphiLexer', 'AdaLexer'] +__all__ = ['DelphiLexer'] class DelphiLexer(Lexer): """ - For `Delphi <http://www.borland.com/delphi/>`_ (Borland Object Pascal), + For Delphi (Borland Object Pascal), Turbo Pascal and Free Pascal source code. Additional options accepted: @@ -363,7 +363,7 @@ class DelphiLexer(Lexer): elif lowercase_name in self.keywords: token = Keyword # if we are in a special block and a - # block ending keyword occours (and the parenthesis + # block ending keyword occurs (and the parenthesis # is balanced) we end the current block context if (in_function_block or in_property_block) and \ lowercase_name in self.BLOCK_KEYWORDS and \ @@ -505,139 +505,3 @@ class DelphiLexer(Lexer): if scanner.match.strip(): was_dot = scanner.match == '.' yield scanner.start_pos, token, scanner.match or '' - - -class AdaLexer(RegexLexer): - """ - For Ada source code. - - .. versionadded:: 1.3 - """ - - name = 'Ada' - aliases = ['ada', 'ada95', 'ada2005'] - filenames = ['*.adb', '*.ads', '*.ada'] - mimetypes = ['text/x-ada'] - - flags = re.MULTILINE | re.IGNORECASE - - tokens = { - 'root': [ - (r'[^\S\n]+', Text), - (r'--.*?\n', Comment.Single), - (r'[^\S\n]+', Text), - (r'function|procedure|entry', Keyword.Declaration, 'subprogram'), - (r'(subtype|type)(\s+)(\w+)', - bygroups(Keyword.Declaration, Text, Keyword.Type), 'type_def'), - (r'task|protected', Keyword.Declaration), - (r'(subtype)(\s+)', bygroups(Keyword.Declaration, Text)), - (r'(end)(\s+)', bygroups(Keyword.Reserved, Text), 'end'), - (r'(pragma)(\s+)(\w+)', bygroups(Keyword.Reserved, Text, - Comment.Preproc)), - (r'(true|false|null)\b', Keyword.Constant), - (words(( - 'Address', 'Byte', 'Boolean', 'Character', 'Controlled', 'Count', - 'Cursor', 'Duration', 'File_Mode', 'File_Type', 'Float', 'Generator', - 'Integer', 'Long_Float', 'Long_Integer', 'Long_Long_Float', - 'Long_Long_Integer', 'Natural', 'Positive', 'Reference_Type', - 'Short_Float', 'Short_Integer', 'Short_Short_Float', - 'Short_Short_Integer', 'String', 'Wide_Character', 'Wide_String'), - suffix=r'\b'), - Keyword.Type), - (r'(and(\s+then)?|in|mod|not|or(\s+else)|rem)\b', Operator.Word), - (r'generic|private', Keyword.Declaration), - (r'package', Keyword.Declaration, 'package'), - (r'array\b', Keyword.Reserved, 'array_def'), - (r'(with|use)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), - (r'(\w+)(\s*)(:)(\s*)(constant)', - bygroups(Name.Constant, Text, Punctuation, Text, - Keyword.Reserved)), - (r'<<\w+>>', Name.Label), - (r'(\w+)(\s*)(:)(\s*)(declare|begin|loop|for|while)', - bygroups(Name.Label, Text, Punctuation, Text, Keyword.Reserved)), - (words(( - 'abort', 'abs', 'abstract', 'accept', 'access', 'aliased', 'all', - 'array', 'at', 'begin', 'body', 'case', 'constant', 'declare', - 'delay', 'delta', 'digits', 'do', 'else', 'elsif', 'end', 'entry', - 'exception', 'exit', 'interface', 'for', 'goto', 'if', 'is', 'limited', - 'loop', 'new', 'null', 'of', 'or', 'others', 'out', 'overriding', - 'pragma', 'protected', 'raise', 'range', 'record', 'renames', 'requeue', - 'return', 'reverse', 'select', 'separate', 'some', 'subtype', - 'synchronized', 'task', 'tagged', 'terminate', 'then', 'type', 'until', - 'when', 'while', 'xor'), prefix=r'\b', suffix=r'\b'), - Keyword.Reserved), - (r'"[^"]*"', String), - include('attribute'), - include('numbers'), - (r"'[^']'", String.Character), - (r'(\w+)(\s*|[(,])', bygroups(Name, using(this))), - (r"(<>|=>|:=|[()|:;,.'])", Punctuation), - (r'[*<>+=/&-]', Operator), - (r'\n+', Text), - ], - 'numbers': [ - (r'[0-9_]+#[0-9a-f_\.]+#', Number.Hex), - (r'[0-9_]+\.[0-9_]*', Number.Float), - (r'[0-9_]+', Number.Integer), - ], - 'attribute': [ - (r"(')(\w+)", bygroups(Punctuation, Name.Attribute)), - ], - 'subprogram': [ - (r'\(', Punctuation, ('#pop', 'formal_part')), - (r';', Punctuation, '#pop'), - (r'is\b', Keyword.Reserved, '#pop'), - (r'"[^"]+"|\w+', Name.Function), - include('root'), - ], - 'end': [ - ('(if|case|record|loop|select)', Keyword.Reserved), - (r'"[^"]+"|[\w.]+', Name.Function), - (r'\s+', Text), - (';', Punctuation, '#pop'), - ], - 'type_def': [ - (r';', Punctuation, '#pop'), - (r'\(', Punctuation, 'formal_part'), - (r'with|and|use', Keyword.Reserved), - (r'array\b', Keyword.Reserved, ('#pop', 'array_def')), - (r'record\b', Keyword.Reserved, ('record_def')), - (r'(null record)(;)', bygroups(Keyword.Reserved, Punctuation), '#pop'), - include('root'), - ], - 'array_def': [ - (r';', Punctuation, '#pop'), - (r'(\w+)(\s+)(range)', bygroups(Keyword.Type, Text, Keyword.Reserved)), - include('root'), - ], - 'record_def': [ - (r'end record', Keyword.Reserved, '#pop'), - include('root'), - ], - 'import': [ - (r'[\w.]+', Name.Namespace, '#pop'), - default('#pop'), - ], - 'formal_part': [ - (r'\)', Punctuation, '#pop'), - (r'\w+', Name.Variable), - (r',|:[^=]', Punctuation), - (r'(in|not|null|out|access)\b', Keyword.Reserved), - include('root'), - ], - 'package': [ - ('body', Keyword.Declaration), - (r'is\s+new|renames', Keyword.Reserved), - ('is', Keyword.Reserved, '#pop'), - (';', Punctuation, '#pop'), - (r'\(', Punctuation, 'package_instantiation'), - (r'([\w.]+)', Name.Class), - include('root'), - ], - 'package_instantiation': [ - (r'("[^"]+"|\w+)(\s+)(=>)', bygroups(Name.Variable, Text, Punctuation)), - (r'[\w.\'"]', Text), - (r'\)', Punctuation, '#pop'), - include('root'), - ], - } |