Fixed a bug in the C++ grammar - the tokenizer now properly recognizes macro definitions which are followed by a multiline comment.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4436 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2006-06-23 06:00:38 +00:00
parent f64d95ecce
commit c65f2380c9
4 changed files with 523 additions and 514 deletions

View File

@ -6,7 +6,8 @@ Fixed bug 1498910 - AssignmentInOperand no longer has a typo in the message.
Fixed bug 1498960 - DontImportJavaLang no longer reports static imports of java.lang members.
Fixed bug 1417106 - MissingBreakInSwitch no longer flags stmts where every case has either a return or a throw.
Fixed bug 1412529 - UncommentedEmptyConstructor no longer flags private constructors.
Fixed a bug in AvoidProtectedFieldInFinalClass - it no longer reports false positives for protected fields in inner classes.
Fixed a bug in AvoidProtectedFieldInFinalClass - it no longer reports false positives for protected fields in inner classes.
Fixed a bug in the C++ grammar - the tokenizer now properly recognizes macro definitions which are followed by a multiline comment.
Applied patch 1481024 (fulfilling RFE 1490181)- NOPMD messages can now be reported with a user specified msg, e.g., //NOPMD - this is expected
Added JSP support to the copy/paste detector.

View File

@ -140,7 +140,7 @@ SKIP :
|
"//" : IN_LINE_COMMENT
|
"/*" : IN_COMMENT
"/*" : IN_COMMENT
|
"#" : PREPROCESSOR_OUTPUT
}
@ -168,6 +168,7 @@ SKIP :
<PREPROCESSOR_OUTPUT> SKIP:
{
"\n" : DEFAULT
| "/*" : IN_COMMENT
}
<PREPROCESSOR_OUTPUT> MORE:

View File

@ -4,122 +4,122 @@ package net.sourceforge.pmd.cpd.cppast;
public interface CPPParserConstants {
int EOF = 0;
int LCURLYBRACE = 16;
int RCURLYBRACE = 17;
int LSQUAREBRACKET = 18;
int RSQUAREBRACKET = 19;
int LPARENTHESIS = 20;
int RPARENTHESIS = 21;
int SCOPE = 22;
int COLON = 23;
int SEMICOLON = 24;
int COMMA = 25;
int QUESTIONMARK = 26;
int ELLIPSIS = 27;
int ASSIGNEQUAL = 28;
int TIMESEQUAL = 29;
int DIVIDEEQUAL = 30;
int MODEQUAL = 31;
int PLUSEQUAL = 32;
int MINUSEQUAL = 33;
int SHIFTLEFTEQUAL = 34;
int SHIFTRIGHTEQUAL = 35;
int BITWISEANDEQUAL = 36;
int BITWISEXOREQUAL = 37;
int BITWISEOREQUAL = 38;
int OR = 39;
int AND = 40;
int BITWISEOR = 41;
int BITWISEXOR = 42;
int AMPERSAND = 43;
int EQUAL = 44;
int NOTEQUAL = 45;
int LESSTHAN = 46;
int GREATERTHAN = 47;
int LESSTHANOREQUALTO = 48;
int GREATERTHANOREQUALTO = 49;
int SHIFTLEFT = 50;
int SHIFTRIGHT = 51;
int PLUS = 52;
int MINUS = 53;
int STAR = 54;
int DIVIDE = 55;
int MOD = 56;
int PLUSPLUS = 57;
int MINUSMINUS = 58;
int TILDE = 59;
int NOT = 60;
int DOT = 61;
int POINTERTO = 62;
int DOTSTAR = 63;
int ARROWSTAR = 64;
int AUTO = 65;
int BREAK = 66;
int CASE = 67;
int CATCH = 68;
int CHAR = 69;
int CONST = 70;
int CONTINUE = 71;
int _DEFAULT = 72;
int DELETE = 73;
int DO = 74;
int DOUBLE = 75;
int ELSE = 76;
int ENUM = 77;
int EXTERN = 78;
int FLOAT = 79;
int FOR = 80;
int FRIEND = 81;
int GOTO = 82;
int IF = 83;
int INLINE = 84;
int INT = 85;
int LONG = 86;
int NEW = 87;
int PRIVATE = 88;
int PROTECTED = 89;
int PUBLIC = 90;
int REDECLARED = 91;
int REGISTER = 92;
int RETURN = 93;
int SHORT = 94;
int SIGNED = 95;
int SIZEOF = 96;
int STATIC = 97;
int STRUCT = 98;
int CLASS = 99;
int SWITCH = 100;
int TEMPLATE = 101;
int THIS = 102;
int TRY = 103;
int TYPEDEF = 104;
int UNION = 105;
int UNSIGNED = 106;
int VIRTUAL = 107;
int VOID = 108;
int VOLATILE = 109;
int WHILE = 110;
int OPERATOR = 111;
int TRUETOK = 112;
int FALSETOK = 113;
int THROW = 114;
int OCTALINT = 115;
int OCTALLONG = 116;
int UNSIGNED_OCTALINT = 117;
int UNSIGNED_OCTALLONG = 118;
int DECIMALINT = 119;
int DECIMALLONG = 120;
int UNSIGNED_DECIMALINT = 121;
int UNSIGNED_DECIMALLONG = 122;
int HEXADECIMALINT = 123;
int HEXADECIMALLONG = 124;
int UNSIGNED_HEXADECIMALINT = 125;
int UNSIGNED_HEXADECIMALLONG = 126;
int FLOATONE = 127;
int FLOATTWO = 128;
int CHARACTER = 129;
int STRING = 130;
int ID = 132;
int LCURLYBRACE = 17;
int RCURLYBRACE = 18;
int LSQUAREBRACKET = 19;
int RSQUAREBRACKET = 20;
int LPARENTHESIS = 21;
int RPARENTHESIS = 22;
int SCOPE = 23;
int COLON = 24;
int SEMICOLON = 25;
int COMMA = 26;
int QUESTIONMARK = 27;
int ELLIPSIS = 28;
int ASSIGNEQUAL = 29;
int TIMESEQUAL = 30;
int DIVIDEEQUAL = 31;
int MODEQUAL = 32;
int PLUSEQUAL = 33;
int MINUSEQUAL = 34;
int SHIFTLEFTEQUAL = 35;
int SHIFTRIGHTEQUAL = 36;
int BITWISEANDEQUAL = 37;
int BITWISEXOREQUAL = 38;
int BITWISEOREQUAL = 39;
int OR = 40;
int AND = 41;
int BITWISEOR = 42;
int BITWISEXOR = 43;
int AMPERSAND = 44;
int EQUAL = 45;
int NOTEQUAL = 46;
int LESSTHAN = 47;
int GREATERTHAN = 48;
int LESSTHANOREQUALTO = 49;
int GREATERTHANOREQUALTO = 50;
int SHIFTLEFT = 51;
int SHIFTRIGHT = 52;
int PLUS = 53;
int MINUS = 54;
int STAR = 55;
int DIVIDE = 56;
int MOD = 57;
int PLUSPLUS = 58;
int MINUSMINUS = 59;
int TILDE = 60;
int NOT = 61;
int DOT = 62;
int POINTERTO = 63;
int DOTSTAR = 64;
int ARROWSTAR = 65;
int AUTO = 66;
int BREAK = 67;
int CASE = 68;
int CATCH = 69;
int CHAR = 70;
int CONST = 71;
int CONTINUE = 72;
int _DEFAULT = 73;
int DELETE = 74;
int DO = 75;
int DOUBLE = 76;
int ELSE = 77;
int ENUM = 78;
int EXTERN = 79;
int FLOAT = 80;
int FOR = 81;
int FRIEND = 82;
int GOTO = 83;
int IF = 84;
int INLINE = 85;
int INT = 86;
int LONG = 87;
int NEW = 88;
int PRIVATE = 89;
int PROTECTED = 90;
int PUBLIC = 91;
int REDECLARED = 92;
int REGISTER = 93;
int RETURN = 94;
int SHORT = 95;
int SIGNED = 96;
int SIZEOF = 97;
int STATIC = 98;
int STRUCT = 99;
int CLASS = 100;
int SWITCH = 101;
int TEMPLATE = 102;
int THIS = 103;
int TRY = 104;
int TYPEDEF = 105;
int UNION = 106;
int UNSIGNED = 107;
int VIRTUAL = 108;
int VOID = 109;
int VOLATILE = 110;
int WHILE = 111;
int OPERATOR = 112;
int TRUETOK = 113;
int FALSETOK = 114;
int THROW = 115;
int OCTALINT = 116;
int OCTALLONG = 117;
int UNSIGNED_OCTALINT = 118;
int UNSIGNED_OCTALLONG = 119;
int DECIMALINT = 120;
int DECIMALLONG = 121;
int UNSIGNED_DECIMALINT = 122;
int UNSIGNED_DECIMALLONG = 123;
int HEXADECIMALINT = 124;
int HEXADECIMALLONG = 125;
int UNSIGNED_HEXADECIMALINT = 126;
int UNSIGNED_HEXADECIMALLONG = 127;
int FLOATONE = 128;
int FLOATTWO = 129;
int CHARACTER = 130;
int STRING = 131;
int ID = 133;
int DEFAULT = 0;
int IN_LINE_COMMENT = 1;
@ -140,9 +140,10 @@ public interface CPPParserConstants {
"\"*/\"",
"<token of kind 11>",
"\"\\n\"",
"\"/*\"",
"\"\\\\\\n\"",
"\"\\\\\\r\\n\"",
"<token of kind 15>",
"<token of kind 16>",
"\"{\"",
"\"}\"",
"\"[\"",