diff options
author | gentoo90 <gentoo90@gmail.com> | 2012-11-12 22:43:49 +0200 |
---|---|---|
committer | gentoo90 <gentoo90@gmail.com> | 2012-11-12 22:43:49 +0200 |
commit | ac3a4fd843833d232eafab8e846d4540e425663d (patch) | |
tree | a427f0de3d5658a6aaae8a542b5986e8448413bf | |
parent | d3bbefabe17d137c8e217395fb7233505baad129 (diff) | |
download | pygments-ac3a4fd843833d232eafab8e846d4540e425663d.tar.gz |
String highlighting and other fixes in RPMSpecLexer
-rw-r--r-- | pygments/lexers/other.py | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index 08486748..df5570e1 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -3161,6 +3161,12 @@ class SourcePawnLexer(RegexLexer): class RPMSpecLexer(RegexLexer): + """ + For RPM *.spec files + + *New in Pygments 1.6.* + """ + name = 'RPMSpec' aliases = ['spec'] filenames = ['*.spec'] @@ -3191,11 +3197,16 @@ class RPMSpecLexer(RegexLexer): (r'\n', Text), (r'.', Text), ], + 'str_double': [ + (r'"', String.Double, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + include('resolvable'), + (r'.', String.Double), + ], 'rpm': [ - (r'%define.*\n', Comment.Preproc), - (r'%\{\!\?.*%define.*\}', Comment.Preproc), - (r'^(?:Name|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|U[Rr][Ll]|' - r'Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[A-Za-z]+Req|' + include('preproc'), + (r'(?i)^(?:Name|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|URL|' + r'Distribution|Prefix|Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[A-Za-z]+Req|' r'Obsoletes|Provides|Conflicts|Build[A-Za-z]+|[A-Za-z]+Arch|Auto[A-Za-z]+):\s*', Generic.Heading, 'header'), (r'^%description', Name.Decorator, 'description'), @@ -3206,12 +3217,21 @@ class RPMSpecLexer(RegexLexer): (r'%(?:attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|' r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)', Keyword), + include('resolvable'), + (r"'.*'", String.Single), + (r'"', String.Double, 'str_double'), + (r'.', Text), + ], + 'preproc': [ + (r'%define.*\n', Comment.Preproc), + (r'%\{\!\?.*%define.*\}', Comment.Preproc), + (r'%(if(?:n?arch)?|else(?:if)?|endif)', Comment.Preproc, 'header'), + ], + 'resolvable': [ (r'%\{?__[a-z_]+\}?', Name.Function), (r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo), (r'%\{\?[A-Za-z0-9_]+\}', Name.Variable), (r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global), (r'%\{[a-zA-Z][a-zA-Z0-9_]+\}', Keyword.Constant), - (r'%(ifarch|ifnarch|if|else|elseif|endif)', Keyword.Preproc, 'header'), - (r'.', Text), - ], + ] } |