trunk/c.c:
trunk/get.c: trunk/get.h: (bug #1515910) add support for C# verbatim string literals such as @"C:\" which causes ctags 5.6 to swallow everything up to the next ". trunk/Test/bug1611054.cs: add a test case. git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@525 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
parent
837dc20f84
commit
652cc550b5
|
@ -0,0 +1,8 @@
|
|||
class C {
|
||||
public String a() {
|
||||
return @"c:\";
|
||||
}
|
||||
// this tag is missing in ctags 5.6
|
||||
public void b() {
|
||||
}
|
||||
}
|
2
c.c
2
c.c
|
@ -2761,7 +2761,7 @@ static boolean findCTags (const unsigned int passCount)
|
|||
boolean retry;
|
||||
|
||||
Assert (passCount < 3);
|
||||
cppInit ((boolean) (passCount > 1));
|
||||
cppInit ((boolean) (passCount > 1), isLanguage (Lang_csharp));
|
||||
Signature = vStringNew ();
|
||||
|
||||
exception = (exception_t) setjmp (Exception);
|
||||
|
|
21
get.c
21
get.c
|
@ -63,6 +63,7 @@ enum eState {
|
|||
typedef struct sCppState {
|
||||
int ungetch, ungetch2; /* ungotten characters, if any */
|
||||
boolean resolveRequired; /* must resolve if/else/elif/endif branch */
|
||||
boolean hasAtLiteralStrings; /* supports @"c:\" strings */
|
||||
struct sDirective {
|
||||
enum eState state; /* current directive being processed */
|
||||
boolean accept; /* is a directive syntatically permitted? */
|
||||
|
@ -83,6 +84,7 @@ static boolean BraceFormat = FALSE;
|
|||
static cppState Cpp = {
|
||||
'\0', '\0', /* ungetch characters */
|
||||
FALSE, /* resolveRequired */
|
||||
FALSE, /* hasAtLiteralStrings */
|
||||
{
|
||||
DRCTV_NONE, /* state */
|
||||
FALSE, /* accept */
|
||||
|
@ -106,13 +108,14 @@ extern unsigned int getDirectiveNestLevel (void)
|
|||
return Cpp.directive.nestLevel;
|
||||
}
|
||||
|
||||
extern void cppInit (const boolean state)
|
||||
extern void cppInit (const boolean state, const boolean hasAtLiteralStrings)
|
||||
{
|
||||
BraceFormat = state;
|
||||
|
||||
Cpp.ungetch = '\0';
|
||||
Cpp.ungetch2 = '\0';
|
||||
Cpp.resolveRequired = FALSE;
|
||||
Cpp.hasAtLiteralStrings = hasAtLiteralStrings;
|
||||
|
||||
Cpp.directive.state = DRCTV_NONE;
|
||||
Cpp.directive.accept = TRUE;
|
||||
|
@ -477,13 +480,13 @@ static int skipOverCplusComment (void)
|
|||
/* Skips to the end of a string, returning a special character to
|
||||
* symbolically represent a generic string.
|
||||
*/
|
||||
static int skipToEndOfString (void)
|
||||
static int skipToEndOfString (boolean ignoreBackslash)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = fileGetc ()) != EOF)
|
||||
{
|
||||
if (c == BACKSLASH)
|
||||
if (c == BACKSLASH && ! ignoreBackslash)
|
||||
fileGetc (); /* throw away next character, too */
|
||||
else if (c == DOUBLE_QUOTE)
|
||||
break;
|
||||
|
@ -564,7 +567,7 @@ process:
|
|||
|
||||
case DOUBLE_QUOTE:
|
||||
Cpp.directive.accept = FALSE;
|
||||
c = skipToEndOfString ();
|
||||
c = skipToEndOfString (FALSE);
|
||||
break;
|
||||
|
||||
case '#':
|
||||
|
@ -639,6 +642,16 @@ process:
|
|||
} break;
|
||||
|
||||
default:
|
||||
if (c == '@' && Cpp.hasAtLiteralStrings)
|
||||
{
|
||||
int next = fileGetc ();
|
||||
if (next == DOUBLE_QUOTE)
|
||||
{
|
||||
Cpp.directive.accept = FALSE;
|
||||
c = skipToEndOfString (TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Cpp.directive.accept = FALSE;
|
||||
if (directive)
|
||||
ignore = handleDirective (c);
|
||||
|
|
2
get.h
2
get.h
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
extern boolean isBraceFormat (void);
|
||||
extern unsigned int getDirectiveNestLevel (void);
|
||||
extern void cppInit (const boolean state);
|
||||
extern void cppInit (const boolean state, const boolean hasAtLiteralStrings);
|
||||
extern void cppTerminate (void);
|
||||
extern void cppBeginStatement (void);
|
||||
extern void cppEndStatement (void);
|
||||
|
|
Loading…
Reference in New Issue