forked from phoedos/pmd
Fixed lexical eror when a preprocessor directive is followed by a single line comment that starts with "//*".
This commit fixes a lexical eror when a preprocessor directive is followed by a single line comment that starts with "//*". The following code could not be tokenized: #define LSTFVLES_CPP //* It triggers the following error: net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file 'foo.cpp' at line 2, column 0. Encountered: <EOF> after : ""
This commit is contained in:
pmd-cpp
@ -174,6 +174,7 @@ SKIP :
|
||||
{
|
||||
"\n" : DEFAULT
|
||||
| "/*" : IN_PREPROCESSOR_OUTPUT_COMMENT
|
||||
| "//" : IN_LINE_COMMENT
|
||||
}
|
||||
|
||||
<PREPROCESSOR_OUTPUT> MORE:
|
||||
|
@ -102,6 +102,11 @@ public class CPPTokenizerTest {
|
||||
assertEquals(22, tokens.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEOLCommentInPreprocessingDirective() {
|
||||
parse("#define LSTFVLES_CPP //*" + PMD.EOL);
|
||||
}
|
||||
|
||||
private Tokens parse(String snippet) {
|
||||
return parse(snippet, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user