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/csound.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/csound.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/csound.py | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/csound.py b/contrib/python/Pygments/py3/pygments/lexers/csound.py index a871de8d725..c8fc4c815bf 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/csound.py +++ b/contrib/python/Pygments/py3/pygments/lexers/csound.py @@ -4,7 +4,7 @@ Lexers for Csound languages. - :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. """ @@ -13,7 +13,7 @@ import re from pygments.lexer import RegexLexer, bygroups, default, include, using, words from pygments.token import Comment, Error, Keyword, Name, Number, Operator, Punctuation, \ String, Text, Whitespace -from pygments.lexers._csound_builtins import OPCODES, DEPRECATED_OPCODES, REMOVED_OPCODES +from pygments.lexers._csound_builtins import OPCODES, DEPRECATED_OPCODES, REMOVED_OPCODES from pygments.lexers.html import HtmlLexer from pygments.lexers.python import PythonLexer from pygments.lexers.scripting import LuaLexer @@ -34,7 +34,7 @@ class CsoundLexer(RegexLexer): 'preprocessor directives': [ (r'#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+', Comment.Preproc), - (r'#includestr', Comment.Preproc, 'includestr directive'), + (r'#includestr', Comment.Preproc, 'includestr directive'), (r'#include', Comment.Preproc, 'include directive'), (r'#[ \t]*define', Comment.Preproc, 'define directive'), (r'#(?:ifn?def|undef)\b', Comment.Preproc, 'macro directive') @@ -44,10 +44,10 @@ class CsoundLexer(RegexLexer): include('whitespace'), (r'([^ \t]).*?\1', String, '#pop') ], - 'includestr directive': [ - include('whitespace'), - (r'"', String, ('#pop', 'quoted string')) - ], + 'includestr directive': [ + include('whitespace'), + (r'"', String, ('#pop', 'quoted string')) + ], 'define directive': [ (r'\n', Whitespace), @@ -118,13 +118,13 @@ class CsoundLexer(RegexLexer): (r'\d+', Number.Integer) ], - 'quoted string': [ - (r'"', String, '#pop'), - (r'[^"$]+', String), - include('macro uses'), - (r'[$]', String) - ], - + 'quoted string': [ + (r'"', String, '#pop'), + (r'[^"$]+', String), + include('macro uses'), + (r'[$]', String) + ], + 'braced string': [ # Do nothing. This must be defined in subclasses. ] @@ -133,7 +133,7 @@ class CsoundLexer(RegexLexer): class CsoundScoreLexer(CsoundLexer): """ - For `Csound <https://csound.com>`_ scores. + For `Csound <https://csound.com>`_ scores. .. versionadded:: 2.1 """ @@ -148,14 +148,14 @@ class CsoundScoreLexer(CsoundLexer): include('whitespace and macro uses'), include('preprocessor directives'), - (r'[aBbCdefiqstvxy]', Keyword), + (r'[aBbCdefiqstvxy]', Keyword), # There is also a w statement that is generated internally and should not be # used; see https://github.com/csound/csound/issues/750. (r'z', Keyword.Constant), # z is a constant equal to 800,000,000,000. 800 billion seconds is about # 25,367.8 years. See also - # https://csound.com/docs/manual/ScoreTop.html and + # https://csound.com/docs/manual/ScoreTop.html and # https://github.com/csound/csound/search?q=stof+path%3AEngine+filename%3Asread.c. (r'([nNpP][pP])(\d+)', bygroups(Keyword, Number.Integer)), @@ -188,8 +188,8 @@ class CsoundScoreLexer(CsoundLexer): include('root') ], - # Braced strings are not allowed in Csound scores, but this is needed because the - # superclass includes it. + # Braced strings are not allowed in Csound scores, but this is needed because the + # superclass includes it. 'braced string': [ (r'\}\}', String, '#pop'), (r'[^}]|\}(?!\})', String) @@ -199,7 +199,7 @@ class CsoundScoreLexer(CsoundLexer): class CsoundOrchestraLexer(CsoundLexer): """ - For `Csound <https://csound.com>`_ orchestras. + For `Csound <https://csound.com>`_ orchestras. .. versionadded:: 2.1 """ @@ -216,25 +216,25 @@ class CsoundOrchestraLexer(CsoundLexer): yield match.start(), Name.Function, opcode def name_callback(lexer, match): - type_annotation_token = Keyword.Type - + type_annotation_token = Keyword.Type + name = match.group(1) - if name in OPCODES or name in DEPRECATED_OPCODES or name in REMOVED_OPCODES: + if name in OPCODES or name in DEPRECATED_OPCODES or name in REMOVED_OPCODES: yield match.start(), Name.Builtin, name elif name in lexer.user_defined_opcodes: yield match.start(), Name.Function, name else: - type_annotation_token = Name - name_match = re.search(r'^(g?[afikSw])(\w+)', name) - if name_match: - yield name_match.start(1), Keyword.Type, name_match.group(1) - yield name_match.start(2), Name, name_match.group(2) + type_annotation_token = Name + name_match = re.search(r'^(g?[afikSw])(\w+)', name) + if name_match: + yield name_match.start(1), Keyword.Type, name_match.group(1) + yield name_match.start(2), Name, name_match.group(2) else: yield match.start(), Name, name - if match.group(2): - yield match.start(2), Punctuation, match.group(2) - yield match.start(3), type_annotation_token, match.group(3) + if match.group(2): + yield match.start(2), Punctuation, match.group(2) + yield match.start(3), type_annotation_token, match.group(3) tokens = { 'root': [ @@ -329,24 +329,24 @@ class CsoundOrchestraLexer(CsoundLexer): (r'\\(?:[\\abnrt"]|[0-7]{1,3})', String.Escape) ], # Format specifiers are highlighted in all strings, even though only - # fprintks https://csound.com/docs/manual/fprintks.html - # fprints https://csound.com/docs/manual/fprints.html - # printf/printf_i https://csound.com/docs/manual/printf.html - # printks https://csound.com/docs/manual/printks.html - # prints https://csound.com/docs/manual/prints.html - # sprintf https://csound.com/docs/manual/sprintf.html - # sprintfk https://csound.com/docs/manual/sprintfk.html - # work with strings that contain format specifiers. In addition, these opcodes’ - # handling of format specifiers is inconsistent: - # - fprintks and fprints accept %a and %A specifiers, and accept %s specifiers - # starting in Csound 6.15.0. - # - printks and prints accept %a and %A specifiers, but don’t accept %s - # specifiers. - # - printf, printf_i, sprintf, and sprintfk don’t accept %a and %A specifiers, - # but accept %s specifiers. + # fprintks https://csound.com/docs/manual/fprintks.html + # fprints https://csound.com/docs/manual/fprints.html + # printf/printf_i https://csound.com/docs/manual/printf.html + # printks https://csound.com/docs/manual/printks.html + # prints https://csound.com/docs/manual/prints.html + # sprintf https://csound.com/docs/manual/sprintf.html + # sprintfk https://csound.com/docs/manual/sprintfk.html + # work with strings that contain format specifiers. In addition, these opcodes’ + # handling of format specifiers is inconsistent: + # - fprintks and fprints accept %a and %A specifiers, and accept %s specifiers + # starting in Csound 6.15.0. + # - printks and prints accept %a and %A specifiers, but don’t accept %s + # specifiers. + # - printf, printf_i, sprintf, and sprintfk don’t accept %a and %A specifiers, + # but accept %s specifiers. # See https://github.com/csound/csound/issues/747 for more information. 'format specifiers': [ - (r'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]', String.Interpol), + (r'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]', String.Interpol), (r'%%', String.Escape) ], @@ -374,7 +374,7 @@ class CsoundOrchestraLexer(CsoundLexer): 'Csound score opcode': [ include('whitespace and macro uses'), - (r'"', String, 'quoted string'), + (r'"', String, 'quoted string'), (r'\{\{', String, 'Csound score'), (r'\n', Whitespace, '#pop') ], @@ -385,7 +385,7 @@ class CsoundOrchestraLexer(CsoundLexer): 'Python opcode': [ include('whitespace and macro uses'), - (r'"', String, 'quoted string'), + (r'"', String, 'quoted string'), (r'\{\{', String, 'Python'), (r'\n', Whitespace, '#pop') ], @@ -396,7 +396,7 @@ class CsoundOrchestraLexer(CsoundLexer): 'Lua opcode': [ include('whitespace and macro uses'), - (r'"', String, 'quoted string'), + (r'"', String, 'quoted string'), (r'\{\{', String, 'Lua'), (r'\n', Whitespace, '#pop') ], @@ -409,7 +409,7 @@ class CsoundOrchestraLexer(CsoundLexer): class CsoundDocumentLexer(RegexLexer): """ - For `Csound <https://csound.com>`_ documents. + For `Csound <https://csound.com>`_ documents. .. versionadded:: 2.1 """ |