diff options
author | Pat Pannuto <pat.pannuto@gmail.com> | 2013-02-14 23:27:13 -0500 |
---|---|---|
committer | Pat Pannuto <pat.pannuto@gmail.com> | 2013-02-14 23:27:13 -0500 |
commit | f504018244f7975b960f8db9eddade22fbea4411 (patch) | |
tree | e353693107012b7b845337dc5ccc3f4a886ae157 /pygments | |
parent | 054c464c70c115f476608a51bb0b4a931d1fa400 (diff) | |
download | pygments-f504018244f7975b960f8db9eddade22fbea4411.tar.gz |
Add lexing support for nesC
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/_mapping.py | 1 | ||||
-rw-r--r-- | pygments/lexers/compiled.py | 30 |
2 files changed, 27 insertions, 4 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 53e09176..1fb14901 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -194,6 +194,7 @@ LEXERS = { 'NSISLexer': ('pygments.lexers.other', 'NSIS', ('nsis', 'nsi', 'nsh'), ('*.nsi', '*.nsh'), ('text/x-nsis',)), 'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM'), ('text/x-nasm',)), 'NemerleLexer': ('pygments.lexers.dotnet', 'Nemerle', ('nemerle',), ('*.n',), ('text/x-nemerle',)), + 'NesCLexer': ('pygments.lexers.compiled', 'nesC', ('nesc',), ('*.nc',), ('text/x-nescsrc',)), 'NewLispLexer': ('pygments.lexers.functional', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl'), ('text/x-newlisp', 'application/x-newlisp')), 'NewspeakLexer': ('pygments.lexers.other', 'Newspeak', ('newspeak',), ('*.ns2',), ('text/x-newspeak',)), 'NginxConfLexer': ('pygments.lexers.text', 'Nginx configuration file', ('nginx',), (), ('text/x-nginx-conf',)), diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 7513a4e1..db95c199 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -23,10 +23,10 @@ from pygments.scanner import Scanner from pygments.lexers.functional import OcamlLexer from pygments.lexers.jvm import JavaLexer, ScalaLexer -__all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'ECLexer', 'DylanLexer', - 'ObjectiveCLexer', 'ObjectiveCppLexer', 'FortranLexer', 'GLShaderLexer', - 'PrologLexer', 'CythonLexer', 'ValaLexer', 'OocLexer', 'GoLexer', - 'FelixLexer', 'AdaLexer', 'Modula2Lexer', 'BlitzMaxLexer', +__all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'ECLexer', 'NesCLexer', + 'DylanLexer', 'ObjectiveCLexer', 'ObjectiveCppLexer', 'FortranLexer', + 'GLShaderLexer', 'PrologLexer', 'CythonLexer', 'ValaLexer', 'OocLexer', + 'GoLexer', 'FelixLexer', 'AdaLexer', 'Modula2Lexer', 'BlitzMaxLexer', 'NimrodLexer', 'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer', 'DylanLidLexer', 'DylanConsoleLexer', 'CobolLexer', 'CobolFreeformatLexer', 'LogosLexer'] @@ -266,6 +266,28 @@ class ECLexer(CLexer): } +class NesCLexer(CLexer): + """ + For nesC source code with preprocessor directives. + """ + name = 'nesC' + aliases = ['nesc'] + filenames = ['*.nc'] + mimetypes = ['text/x-nescsrc'] + + tokens = { + 'statements': [ + (r'(abstract|as|async|atomic|call|command|component|components|' + r'configuration|event|extends|generic|implementation|includes|' + r'interface|module|new|norace|post|provides|signal|task|uses)\b', + Keyword), + (r'(nx_struct|nx_union|nx_int8_t|nx_int16_t|nx_int32_t|nx_int64_t|' + r'nx_uint8_t|nx_uint16_t|nx_uint32_t|nx_uint64_t)\b', + Keyword.Type), + inherit, + ], + } + class DLexer(RegexLexer): """ For D source. |