aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py3/pygments/lexers/resource.py
diff options
context:
space:
mode:
authorilezhankin <ilezhankin@yandex-team.ru>2022-02-10 16:45:56 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:56 +0300
commit62a805381e41500fbc7914c37c71ab040a098f4e (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/python/Pygments/py3/pygments/lexers/resource.py
parent1d125034f06575234f83f24f08677955133f140e (diff)
downloadydb-62a805381e41500fbc7914c37c71ab040a098f4e.tar.gz
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/resource.py')
-rw-r--r--contrib/python/Pygments/py3/pygments/lexers/resource.py158
1 files changed, 79 insertions, 79 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/resource.py b/contrib/python/Pygments/py3/pygments/lexers/resource.py
index 0223375bcc..3ed176a181 100644
--- a/contrib/python/Pygments/py3/pygments/lexers/resource.py
+++ b/contrib/python/Pygments/py3/pygments/lexers/resource.py
@@ -1,84 +1,84 @@
-"""
- pygments.lexers.resource
- ~~~~~~~~~~~~~~~~~~~~~~~~
-
- Lexer for resource definition files.
-
+"""
+ pygments.lexers.resource
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for resource definition files.
+
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
- :license: BSD, see LICENSE for details.
-"""
-
-import re
-
-from pygments.lexer import RegexLexer, bygroups, words
-from pygments.token import Comment, String, Number, Operator, Text, \
- Keyword, Name
-
-__all__ = ['ResourceLexer']
-
-
-class ResourceLexer(RegexLexer):
- """Lexer for `ICU Resource bundles
- <http://userguide.icu-project.org/locale/resources>`_.
-
- .. versionadded:: 2.0
- """
- name = 'ResourceBundle'
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import RegexLexer, bygroups, words
+from pygments.token import Comment, String, Number, Operator, Text, \
+ Keyword, Name
+
+__all__ = ['ResourceLexer']
+
+
+class ResourceLexer(RegexLexer):
+ """Lexer for `ICU Resource bundles
+ <http://userguide.icu-project.org/locale/resources>`_.
+
+ .. versionadded:: 2.0
+ """
+ name = 'ResourceBundle'
aliases = ['resourcebundle', 'resource']
filenames = []
-
- _types = (':table', ':array', ':string', ':bin', ':import', ':intvector',
- ':int', ':alias')
-
- flags = re.MULTILINE | re.IGNORECASE
- tokens = {
- 'root': [
- (r'//.*?$', Comment),
- (r'"', String, 'string'),
- (r'-?\d+', Number.Integer),
- (r'[,{}]', Operator),
- (r'([^\s{:]+)(\s*)(%s?)' % '|'.join(_types),
- bygroups(Name, Text, Keyword)),
- (r'\s+', Text),
- (words(_types), Keyword),
- ],
- 'string': [
- (r'(\\x[0-9a-f]{2}|\\u[0-9a-f]{4}|\\U00[0-9a-f]{6}|'
- r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\\{|[^"{\\])+', String),
- (r'\{', String.Escape, 'msgname'),
- (r'"', String, '#pop')
- ],
- 'msgname': [
- (r'([^{},]+)(\s*)', bygroups(Name, String.Escape), ('#pop', 'message'))
- ],
- 'message': [
- (r'\{', String.Escape, 'msgname'),
- (r'\}', String.Escape, '#pop'),
- (r'(,)(\s*)([a-z]+)(\s*\})',
- bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'),
- (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)',
- bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
- String.Escape, Operator.Word, String.Escape, Operator,
- String.Escape, Number.Integer, String.Escape), 'choice'),
- (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)',
- bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
- String.Escape), 'choice'),
- (r'\s+', String.Escape)
- ],
- 'choice': [
- (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*\{)',
- bygroups(Operator, Number.Integer, String.Escape), 'message'),
- (r'([a-z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'),
- (r'\}', String.Escape, ('#pop', '#pop')),
- (r'\s+', String.Escape)
- ],
- 'str': [
- (r'\}', String.Escape, '#pop'),
- (r'\{', String.Escape, 'msgname'),
- (r'[^{}]+', String)
- ]
- }
-
- def analyse_text(text):
+
+ _types = (':table', ':array', ':string', ':bin', ':import', ':intvector',
+ ':int', ':alias')
+
+ flags = re.MULTILINE | re.IGNORECASE
+ tokens = {
+ 'root': [
+ (r'//.*?$', Comment),
+ (r'"', String, 'string'),
+ (r'-?\d+', Number.Integer),
+ (r'[,{}]', Operator),
+ (r'([^\s{:]+)(\s*)(%s?)' % '|'.join(_types),
+ bygroups(Name, Text, Keyword)),
+ (r'\s+', Text),
+ (words(_types), Keyword),
+ ],
+ 'string': [
+ (r'(\\x[0-9a-f]{2}|\\u[0-9a-f]{4}|\\U00[0-9a-f]{6}|'
+ r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\\{|[^"{\\])+', String),
+ (r'\{', String.Escape, 'msgname'),
+ (r'"', String, '#pop')
+ ],
+ 'msgname': [
+ (r'([^{},]+)(\s*)', bygroups(Name, String.Escape), ('#pop', 'message'))
+ ],
+ 'message': [
+ (r'\{', String.Escape, 'msgname'),
+ (r'\}', String.Escape, '#pop'),
+ (r'(,)(\s*)([a-z]+)(\s*\})',
+ bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'),
+ (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)',
+ bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
+ String.Escape, Operator.Word, String.Escape, Operator,
+ String.Escape, Number.Integer, String.Escape), 'choice'),
+ (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)',
+ bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
+ String.Escape), 'choice'),
+ (r'\s+', String.Escape)
+ ],
+ 'choice': [
+ (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*\{)',
+ bygroups(Operator, Number.Integer, String.Escape), 'message'),
+ (r'([a-z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'),
+ (r'\}', String.Escape, ('#pop', '#pop')),
+ (r'\s+', String.Escape)
+ ],
+ 'str': [
+ (r'\}', String.Escape, '#pop'),
+ (r'\{', String.Escape, 'msgname'),
+ (r'[^{}]+', String)
+ ]
+ }
+
+ def analyse_text(text):
if text.startswith('root:table'):
return 1.0