diff options
author | Nathan Whetsell <nathan.whetsell@gmail.com> | 2016-12-11 12:22:55 -0500 |
---|---|---|
committer | Nathan Whetsell <nathan.whetsell@gmail.com> | 2016-12-11 12:22:55 -0500 |
commit | 7f77d1e84d3916c15e6dd9fbf24274be3f2a570f (patch) | |
tree | e5c074d2e3357b98cf96eea6a856a407d95f9450 /pygments/lexers/csound.py | |
parent | 909ac7663b45d6e4f6063641f2bbf9c379f1f26a (diff) | |
download | pygments-git-7f77d1e84d3916c15e6dd9fbf24274be3f2a570f.tar.gz |
Match Csound preprocessor
Diffstat (limited to 'pygments/lexers/csound.py')
-rw-r--r-- | pygments/lexers/csound.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/pygments/lexers/csound.py b/pygments/lexers/csound.py index 7976dd22..36003603 100644 --- a/pygments/lexers/csound.py +++ b/pygments/lexers/csound.py @@ -33,9 +33,9 @@ class CsoundLexer(RegexLexer): ], 'macro use': [ - (r'(\$\w+\.?)(\()', bygroups(Comment.Preproc, Punctuation), + (r'(\$[A-Z_a-z]\w*\.?)(\()', bygroups(Comment.Preproc, Punctuation), 'function macro use'), - (r'\$\w+(\.|\b)', Comment.Preproc) + (r'\$[A-Z_a-z]\w*(\.|\b)', Comment.Preproc) ], 'function macro use': [ (r"((?:\\['\)]|[^'\)])+)(')", bygroups(Comment.Preproc, Punctuation)), @@ -49,8 +49,8 @@ class CsoundLexer(RegexLexer): 'preprocessor directives': [ (r'#(e(nd(if)?|lse)|ifn?def|undef)\b|##', Comment.Preproc), - (r'#include\b', Comment.Preproc, 'include'), - (r'#[ \t]*define\b', Comment.Preproc, 'macro name'), + (r'#include', Comment.Preproc, 'include'), + (r'#[ \t]*define', Comment.Preproc, 'macro name'), (r'@+[ \t]*\d*', Comment.Preproc) ], @@ -61,9 +61,9 @@ class CsoundLexer(RegexLexer): 'macro name': [ include('whitespace'), - (r'(\w+)(\()', bygroups(Comment.Preproc, Text), + (r'([A-Z_a-z]\w*)(\()', bygroups(Comment.Preproc, Text), 'function macro parameter list'), - (r'\w+', Comment.Preproc, 'object macro definition after name') + (r'[A-Z_a-z]\w*', Comment.Preproc, 'object macro definition after name') ], 'object macro definition after name': [ include('whitespace'), @@ -74,8 +74,9 @@ class CsoundLexer(RegexLexer): (r'#', Punctuation, '#pop:3') ], 'function macro parameter list': [ - (r"(\w+)(['#])", bygroups(Comment.Preproc, Punctuation)), - (r'(\w+)(\))', bygroups(Comment.Preproc, Punctuation), + include('whitespace'), + (r"([A-Z_a-z]\w*)(['#])", bygroups(Comment.Preproc, Punctuation)), + (r'([A-Z_a-z]\w*)(\))', bygroups(Comment.Preproc, Punctuation), 'function macro definition after parameter list') ], 'function macro definition after parameter list': [ |