summaryrefslogtreecommitdiff
path: root/pygments/lexers/compiled.py
diff options
context:
space:
mode:
authorwsfulton <devnull@localhost>2013-02-10 01:55:15 +0000
committerwsfulton <devnull@localhost>2013-02-10 01:55:15 +0000
commit0fcd1fd766562bd0499a3b3662877e592c8b454c (patch)
tree22324ba81a9d292ab5ad89ba4194ea2131e3aa63 /pygments/lexers/compiled.py
parent054c464c70c115f476608a51bb0b4a931d1fa400 (diff)
downloadpygments-0fcd1fd766562bd0499a3b3662877e592c8b454c.tar.gz
Add support for SWIG - http://www.swig.org. SWIG is an extension to C++ hence the implementation is derived from CppLexer with additions to identify SWIG's special variables, such as _type, and the SWIG directives which begin with %.
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r--pygments/lexers/compiled.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index 7513a4e1..14b2f7c7 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -29,7 +29,7 @@ __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'ECLexer', 'DylanLexer
'FelixLexer', 'AdaLexer', 'Modula2Lexer', 'BlitzMaxLexer',
'NimrodLexer', 'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer',
'DylanLidLexer', 'DylanConsoleLexer', 'CobolLexer',
- 'CobolFreeformatLexer', 'LogosLexer']
+ 'SwigLexer', 'CobolFreeformatLexer', 'LogosLexer']
class CFamilyLexer(RegexLexer):
@@ -231,6 +231,27 @@ class CppLexer(CFamilyLexer):
return 0.1
+class SwigLexer(CppLexer):
+ """
+ For `SWIG <http://www.swig.org/>`_ source code.
+ """
+ name = 'SWIG'
+ aliases = ['swig']
+ filenames = ['*.swg', '*.i']
+ mimetypes = []
+ priority = 0.1
+
+ tokens = {
+ 'statements': [
+ (r'(%[a-z_]+)\b', Name.Tag),
+ ('[$][*]*[&]?[a-zA-Z0-9_]+', Name),
+ inherit,
+ ],
+ }
+ def analyse_text(text):
+ return 0.1
+
+
class ECLexer(CLexer):
"""
For eC source code with preprocessor directives.