#1252 net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file xxx.cpp

This commit is contained in:
Andreas Dangel
2014-10-18 12:33:40 +02:00
parent 66ea6b0f9b
commit 5f9bd17ee6
3 changed files with 11 additions and 0 deletions

View File

@ -133,6 +133,8 @@ PARSER_END(CppParser)
SKIP :
{
"\ufeff" // UTF Byte Order Mark
|
" "
|
"\f"

View File

@ -4,12 +4,20 @@
package net.sourceforge.pmd.cpd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import net.sourceforge.pmd.PMD;
import org.junit.Test;
public class CPPTokenizerTest {
@Test
public void testUTFwithBOM() {
Tokens tokens = parse("\ufeffint start()\n{ int ret = 1;\nreturn ret;\n}\n");
assertTrue(TokenEntry.getEOF() != tokens.getTokens().get(0));
assertEquals(15, tokens.size());
}
@Test
public void testMultiLineMacros() throws Throwable {
Tokens tokens = parse(TEST1);

View File

@ -11,5 +11,6 @@
**Bugfixes:**
* [#550](https://sourceforge.net/p/pmd/bugs/550/): False +: MissingBreakInSwitch
* [#1252](https://sourceforge.net/p/pmd/bugs/1252/): net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file xxx.cpp
* [#1263](https://sourceforge.net/p/pmd/bugs/1263/): PMD reports CheckResultSet violation in completely unrelated source files.
* [#1273](https://sourceforge.net/p/pmd/bugs/1273/): CheckResultSet false positive in try-with-resources nested in if