aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py')
-rw-r--r--contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py174
1 files changed, 87 insertions, 87 deletions
diff --git a/contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py b/contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py
index 2f3100ef1b..66d3eb3639 100644
--- a/contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py
+++ b/contrib/python/Pygments/py2/pygments/lexers/grammar_notation.py
@@ -5,19 +5,19 @@
Lexers for grammer notations like BNF.
- :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-import re
+import re
-from pygments.lexer import RegexLexer, bygroups, include, this, using, words
-from pygments.token import Comment, Keyword, Literal, Name, Number, \
- Operator, Punctuation, String, Text
+from pygments.lexer import RegexLexer, bygroups, include, this, using, words
+from pygments.token import Comment, Keyword, Literal, Name, Number, \
+ Operator, Punctuation, String, Text
+
+__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer']
-__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer']
-
class BnfLexer(RegexLexer):
"""
This lexer is for grammer notations which are similar to
@@ -131,83 +131,83 @@ class AbnfLexer(RegexLexer):
(r'.', Text),
],
}
-
-
-class JsgfLexer(RegexLexer):
- """
- For `JSpeech Grammar Format <https://www.w3.org/TR/jsgf/>`_
- grammars.
-
- .. versionadded:: 2.2
- """
- name = 'JSGF'
- aliases = ['jsgf']
- filenames = ['*.jsgf']
- mimetypes = ['application/jsgf', 'application/x-jsgf', 'text/jsgf']
-
- flags = re.MULTILINE | re.UNICODE
-
- tokens = {
- 'root': [
- include('comments'),
- include('non-comments'),
- ],
- 'comments': [
- (r'/\*\*(?!/)', Comment.Multiline, 'documentation comment'),
- (r'/\*[\w\W]*?\*/', Comment.Multiline),
- (r'//.*', Comment.Single),
- ],
- 'non-comments': [
- (r'\A#JSGF[^;]*', Comment.Preproc),
- (r'\s+', Text),
- (r';', Punctuation),
- (r'[=|()\[\]*+]', Operator),
- (r'/[^/]+/', Number.Float),
- (r'"', String.Double, 'string'),
- (r'\{', String.Other, 'tag'),
- (words(('import', 'public'), suffix=r'\b'), Keyword.Reserved),
- (r'grammar\b', Keyword.Reserved, 'grammar name'),
- (r'(<)(NULL|VOID)(>)',
- bygroups(Punctuation, Name.Builtin, Punctuation)),
- (r'<', Punctuation, 'rulename'),
- (r'\w+|[^\s;=|()\[\]*+/"{<\w]+', Text),
- ],
- 'string': [
- (r'"', String.Double, '#pop'),
- (r'\\.', String.Escape),
- (r'[^\\"]+', String.Double),
- ],
- 'tag': [
- (r'\}', String.Other, '#pop'),
- (r'\\.', String.Escape),
- (r'[^\\}]+', String.Other),
- ],
- 'grammar name': [
- (r';', Punctuation, '#pop'),
- (r'\s+', Text),
- (r'\.', Punctuation),
- (r'[^;\s.]+', Name.Namespace),
- ],
- 'rulename': [
- (r'>', Punctuation, '#pop'),
- (r'\*', Punctuation),
- (r'\s+', Text),
- (r'([^.>]+)(\s*)(\.)', bygroups(Name.Namespace, Text, Punctuation)),
- (r'[^.>]+', Name.Constant),
- ],
- 'documentation comment': [
- (r'\*/', Comment.Multiline, '#pop'),
- (r'(^\s*\*?\s*)(@(?:example|see)\s+)'
- r'([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))',
- bygroups(Comment.Multiline, Comment.Special,
- using(this, state='example'))),
- (r'(^\s*\*?\s*)(@\S*)',
- bygroups(Comment.Multiline, Comment.Special)),
- (r'[^*\n@]+|\w|\W', Comment.Multiline),
- ],
- 'example': [
- (r'\n\s*\*', Comment.Multiline),
- include('non-comments'),
- (r'.', Comment.Multiline),
- ],
- }
+
+
+class JsgfLexer(RegexLexer):
+ """
+ For `JSpeech Grammar Format <https://www.w3.org/TR/jsgf/>`_
+ grammars.
+
+ .. versionadded:: 2.2
+ """
+ name = 'JSGF'
+ aliases = ['jsgf']
+ filenames = ['*.jsgf']
+ mimetypes = ['application/jsgf', 'application/x-jsgf', 'text/jsgf']
+
+ flags = re.MULTILINE | re.UNICODE
+
+ tokens = {
+ 'root': [
+ include('comments'),
+ include('non-comments'),
+ ],
+ 'comments': [
+ (r'/\*\*(?!/)', Comment.Multiline, 'documentation comment'),
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
+ (r'//.*', Comment.Single),
+ ],
+ 'non-comments': [
+ (r'\A#JSGF[^;]*', Comment.Preproc),
+ (r'\s+', Text),
+ (r';', Punctuation),
+ (r'[=|()\[\]*+]', Operator),
+ (r'/[^/]+/', Number.Float),
+ (r'"', String.Double, 'string'),
+ (r'\{', String.Other, 'tag'),
+ (words(('import', 'public'), suffix=r'\b'), Keyword.Reserved),
+ (r'grammar\b', Keyword.Reserved, 'grammar name'),
+ (r'(<)(NULL|VOID)(>)',
+ bygroups(Punctuation, Name.Builtin, Punctuation)),
+ (r'<', Punctuation, 'rulename'),
+ (r'\w+|[^\s;=|()\[\]*+/"{<\w]+', Text),
+ ],
+ 'string': [
+ (r'"', String.Double, '#pop'),
+ (r'\\.', String.Escape),
+ (r'[^\\"]+', String.Double),
+ ],
+ 'tag': [
+ (r'\}', String.Other, '#pop'),
+ (r'\\.', String.Escape),
+ (r'[^\\}]+', String.Other),
+ ],
+ 'grammar name': [
+ (r';', Punctuation, '#pop'),
+ (r'\s+', Text),
+ (r'\.', Punctuation),
+ (r'[^;\s.]+', Name.Namespace),
+ ],
+ 'rulename': [
+ (r'>', Punctuation, '#pop'),
+ (r'\*', Punctuation),
+ (r'\s+', Text),
+ (r'([^.>]+)(\s*)(\.)', bygroups(Name.Namespace, Text, Punctuation)),
+ (r'[^.>]+', Name.Constant),
+ ],
+ 'documentation comment': [
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'(^\s*\*?\s*)(@(?:example|see)\s+)'
+ r'([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))',
+ bygroups(Comment.Multiline, Comment.Special,
+ using(this, state='example'))),
+ (r'(^\s*\*?\s*)(@\S*)',
+ bygroups(Comment.Multiline, Comment.Special)),
+ (r'[^*\n@]+|\w|\W', Comment.Multiline),
+ ],
+ 'example': [
+ (r'\n\s*\*', Comment.Multiline),
+ include('non-comments'),
+ (r'.', Comment.Multiline),
+ ],
+ }