lcpp, c: Fix signature collection

First, make sure that when calling cppGetc() and cppUngetc() the signature
is properly updated.

Second, make sure that signature is cleared when preparing for new token
read.
This commit is contained in:
Jiří Techet 2017-02-15 00:31:10 +01:00
parent 0a6acff818
commit 8455f8e70d
4 changed files with 14 additions and 2 deletions

View File

@ -175,6 +175,8 @@ extern void cppUngetc (const int c)
Assert (Cpp.ungetch2 == '\0'); Assert (Cpp.ungetch2 == '\0');
Cpp.ungetch2 = Cpp.ungetch; Cpp.ungetch2 = Cpp.ungetch;
Cpp.ungetch = c; Cpp.ungetch = c;
if (collectingSignature)
vStringChop (signature);
} }
static inline int getcAndCollect () static inline int getcAndCollect ()
@ -681,6 +683,8 @@ extern int cppGetc (void)
c = Cpp.ungetch; c = Cpp.ungetch;
Cpp.ungetch = Cpp.ungetch2; Cpp.ungetch = Cpp.ungetch2;
Cpp.ungetch2 = '\0'; Cpp.ungetch2 = '\0';
if (collectingSignature)
vStringPut (signature, c);
return c; /* return here to avoid re-calling debugPutc () */ return c; /* return here to avoid re-calling debugPutc () */
} }
else do else do
@ -1009,3 +1013,9 @@ extern void cppStopCollectingSignature (void)
{ {
collectingSignature = false; collectingSignature = false;
} }
extern void cppClearSignature (void)
{
signature = vStringNewOrClear (signature);
collectingSignature = false;
}

View File

@ -75,5 +75,6 @@ extern int cppSkipOverCComment (void);
extern char *cppGetSignature (void); extern char *cppGetSignature (void);
extern void cppStartCollectingSignature (void); extern void cppStartCollectingSignature (void);
extern void cppStopCollectingSignature (void); extern void cppStopCollectingSignature (void);
extern void cppClearSignature (void);
#endif /* CTAGS_MAIN_GET_H */ #endif /* CTAGS_MAIN_GET_H */

View File

@ -955,6 +955,7 @@ static void reinitStatement (statementInfo *const st, const bool partial)
initToken (st->context); initToken (st->context);
initToken (st->blockName); initToken (st->blockName);
vStringClear (st->parentClasses); vStringClear (st->parentClasses);
cppClearSignature ();
/* Init member info. */ /* Init member info. */
if (! partial) if (! partial)

View File

@ -1,5 +1,5 @@
# format=tagmanager # format=tagmanager
ENTSEQNO<EFBFBD>16<EFBFBD>(eq)<29>0<EFBFBD>FUNCSTS ENTSEQNOÌ16Í(seq)Ö0ÏFUNCSTS
MEMTXTÌ16Í(mail)Ö0Ï MEMTXTÌ16Í(mail)Ö0Ï
MEMTXT<EFBFBD>1024<EFBFBD>(orm_msg)<29>0<EFBFBD>FUNCSTS MEMTXTÌ1024Í(form_msg)Ö0ÏFUNCSTS
MEMTXTÌ1024Í(text)Ö0Ï MEMTXTÌ1024Í(text)Ö0Ï