Accurately detecting function calls
I have a small problem in a little project I'm doing that attempts to accurately detect function calls (not definitions) in an editor window. I only have access to the lines of text in the editor (Eg. Editor->GetLineText()) so I've wrote a few routines for tokenising the line, removing newlines, and concatenating until I receive a semicolon just in case a call goes over a single line.
Now I need an accurate way of detecting what is a function call. I don't want to use a full lexical analyser, as it seems overkill, and I've no interest in understanding what the written code does, don't care about casts, etc.
I was thinking of the following: A non-reserved name followed immediately by an opening bracket is a function call with the name being the name of the function. This should exclude stuff like "for(" "switch(" and "if(" for example, but I'm concerned that it'll fall over with function pointers:
float (*GetPtr1(const char opCode))(float, float)
Maybe If I check for the asterix before the name, it'll cure that.
Oh, and I'm posting this here because I don't care about parsing C++ code. So no need to worry about namespaces or classes. All code is standard ansi-compliant C code (apart from the parser itself, which is all C++).