summaryrefslogtreecommitdiffstats
path: root/usr.bin/vgrind
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-10-18 17:23:33 +0000
committerjoerg <joerg@FreeBSD.org>1996-10-18 17:23:33 +0000
commit49f79cab93eb0dbc3fec225e6a07922fbd8a767e (patch)
tree02719197ee39358e0ec5e055a8df55fc2c83928b /usr.bin/vgrind
parent591c888b2abec0576497dc5d0c6c987aa485c772 (diff)
downloadFreeBSD-src-49f79cab93eb0dbc3fec225e6a07922fbd8a767e.zip
FreeBSD-src-49f79cab93eb0dbc3fec225e6a07922fbd8a767e.tar.gz
Slightly improve the C and C++ support. Allow for function return
types being on the same line as the function name, this finally closes PR # bin/1785. Also allow :: and ~ as part of the function name, for C++. Still, C++ operator overloading will not be recognized as a valid function name. Fixing this would require a major overhaul of the \p recognition parser.
Diffstat (limited to 'usr.bin/vgrind')
-rw-r--r--usr.bin/vgrind/regexp.c7
-rw-r--r--usr.bin/vgrind/vgrindefs.src6
2 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/vgrind/regexp.c b/usr.bin/vgrind/regexp.c
index 472b6d4..d606620 100644
--- a/usr.bin/vgrind/regexp.c
+++ b/usr.bin/vgrind/regexp.c
@@ -458,7 +458,12 @@ expmatch (s, re, mstring)
/* not optional and we still matched */
return (NIL);
}
- if (!isalnum(*s1) && *s1 != '_')
+ if (!(isalnum(*s1) || *s1 == '_' ||
+ /* C++ destructor */
+ *s1 == '~' ||
+ /* C++ scope operator */
+ (strlen(s1) > 1 && *s1 == ':' && s1[1] == ':' &&
+ (s1++, TRUE))))
return (NIL);
if (*s1 == '\\')
_escaped = _escaped ? FALSE : TRUE;
diff --git a/usr.bin/vgrind/vgrindefs.src b/usr.bin/vgrind/vgrindefs.src
index a5e12ee..c19e836 100644
--- a/usr.bin/vgrind/vgrindefs.src
+++ b/usr.bin/vgrind/vgrindefs.src
@@ -33,7 +33,8 @@
#
C|c:\
- :pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):bb={:be=}:cb=/*:ce=*/:sb=":se=\e":lb=':\
+ :pb=^\a?\d?*?\d?\p\d?\(\a?\)(\d|{):\
+ :bb={:be=}:cb=/*:ce=*/:sb=":se=\e":lb=':\
:le=\e':tl:\
:kw=asm auto break case char continue default do double else enum\
extern float for fortran goto if int long register return short\
@@ -134,7 +135,8 @@ yacc|Yacc|y:\
#else #endif #if #ifdef #ifndef #include #undef # define else endif\
if ifdef ifndef include undef:
C++|c++:\
- :pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):bb={:be=}:cb=/*:ce=*/:ab=//:\
+ :pb=^\a?\d?*?\d?\p\d?\(\a?\)(\d|{):\
+ :bb={:be=}:cb=/*:ce=*/:ab=//:\
:ae=$:sb=":se=\e":lb=':\
:le=\e':tl:\
:kw=asm auto break case char continue default do double else enum\
OpenPOWER on IntegriCloud