summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authoramitkummer <49096391+amitkummer@users.noreply.github.com>2021-12-30 16:40:59 +0200
committerGitHub <noreply@github.com>2021-12-30 15:40:59 +0100
commited2bdcdadaff58c183d5127e0af77e72b7b7f501 (patch)
treed627ebf8cb40d2d101428527d3349de9f40ea5ce /pygments
parentdcea4d84a9bd252c6f9f1db4c0116bca30e39ae6 (diff)
downloadpygments-git-ed2bdcdadaff58c183d5127e0af77e72b7b7f501.tar.gz
CFamily: improve function detection (#2008)
Detect function with return types of more than a single word length (like `unsigned int` or `long long`).
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/c_cpp.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py
index 822d12ca..6d765f3f 100644
--- a/pygments/lexers/c_cpp.py
+++ b/pygments/lexers/c_cpp.py
@@ -117,7 +117,7 @@ class CFamilyLexer(RegexLexer):
# functions
(r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
r'(' + _namespaced_ident + r')' # method name
- r'(\s*\([^;]*?\))' # signature
+ r'(\s*\([^;]*?\))' # signature
r'([^;{]*)(\{)',
bygroups(using(this), Name.Function, using(this), using(this),
Punctuation),
@@ -125,10 +125,11 @@ class CFamilyLexer(RegexLexer):
# function declarations
(r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
r'(' + _namespaced_ident + r')' # method name
- r'(\s*\([^;]*?\))' # signature
+ r'(\s*\([^;]*?\))' # signature
r'([^;]*)(;)',
bygroups(using(this), Name.Function, using(this), using(this),
Punctuation)),
+ include('types'),
default('statement'),
],
'statement': [