diff options
author | Georg Brandl <georg@python.org> | 2021-11-09 08:41:57 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2021-11-09 08:43:18 +0100 |
commit | 3ef93d89ebb04373d2887b6be45b482c0887d9d2 (patch) | |
tree | fcdd82ee79093189ccce358160d14af766ee096a /pygments/lexers/installers.py | |
parent | 961007bcadded9b15c2647e74fec2be4173205cb (diff) | |
download | pygments-git-3ef93d89ebb04373d2887b6be45b482c0887d9d2.tar.gz |
Debian control: more regex simplification
Diffstat (limited to 'pygments/lexers/installers.py')
-rw-r--r-- | pygments/lexers/installers.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/pygments/lexers/installers.py b/pygments/lexers/installers.py index 801c2931..804f5973 100644 --- a/pygments/lexers/installers.py +++ b/pygments/lexers/installers.py @@ -279,9 +279,12 @@ class DebianControlLexer(RegexLexer): tokens = { 'root': [ (r'^(Description)', Keyword, 'description'), - (r'^(Maintainer|Uploaders)(:\s*)', bygroups(Keyword, Text), 'maintainer'), - (r'^((Build-|Pre-)?Depends(-Indep|-Arch)?)', Keyword, 'depends'), - (r'^(Recommends|Suggests|Enhances)', Keyword, 'depends'), + (r'^(Maintainer|Uploaders)(:\s*)', bygroups(Keyword, Text), + 'maintainer'), + (r'^((?:Build-|Pre-)?Depends(?:-Indep|-Arch)?)(:\s*)', + bygroups(Keyword, Text), 'depends'), + (r'^(Recommends|Suggests|Enhances)(:\s*)', bygroups(Keyword, Text), + 'depends'), (r'^((?:Python-)?Version)(:\s*)(\S+)$', bygroups(Keyword, Text, Number)), (r'^((?:Installed-)?Size)(:\s*)(\S+)$', @@ -306,21 +309,18 @@ class DebianControlLexer(RegexLexer): default('#pop'), ], 'depends': [ - (r':\s*', Text), - (r'(\$)(\{)(\w+\s*:\s*\w+)', bygroups(Operator, Text, Name.Entity)), + (r'(\$)(\{)(\w+\s*:\s*\w+)(\})', + bygroups(Operator, Text, Name.Entity, Text)), (r'\(', Text, 'depend_vers'), - (r',', Text), (r'\|', Operator), - (r'[\s]+', Text), - (r'[})]\s*$', Text, '#pop'), - (r'\}', Text), - (r'[^,]$', Name.Function, '#pop'), - (r'([+.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)), + (r',\n', Text), + (r'\n', Text, '#pop'), + (r'[,\s]', Text), + (r'[+.a-zA-Z0-9-]+', Name.Function), (r'\[.*?\]', Name.Entity), ], 'depend_vers': [ - (r'\),', Text, '#pop'), - (r'\)[^,]', Text, '#pop:2'), - (r'([><=]+)(\s*)([^)]+)', bygroups(Operator, Text, Number)) + (r'\)', Text, '#pop'), + (r'([><=]+)(\s*)([^)]+)', bygroups(Operator, Text, Number)), ] } |