Commit Graph

57 Commits

Author SHA1 Message Date
ec1eb208eb Merge branch 'master' into 7.0.x 2020-01-24 23:48:22 +01:00
d90d5d267c Remove trailing whitespace everywhere 2020-01-24 23:40:06 +01:00
b02ab00e87 Merge remote-tracking branch 'origin/master' into pmd/7.0.x 2020-01-24 19:18:17 +01:00
5feca7fd93 Exclude generated AST*.java files from internalization 2020-01-24 16:19:24 +01:00
60e97d0ec8 Deprecate javacc generated code 2020-01-22 17:19:29 +01:00
2c670339d8 Deprecate CharStream and impls 2020-01-22 17:09:06 +01:00
6a2c87cd94 Merge branch 'master' into 7.0.x 2019-10-07 16:46:28 +02:00
1fe9c59212 Remove cpp lang 2019-09-24 06:15:34 +02:00
395e3453cb dogfood: Upgrade to PMD 6.17.0 and fix CloseResource issues 2019-09-16 20:03:12 +02:00
5343a7674b Merge branch 'master' into 7.0.x
Fix conflicts with Apex CC category properties
2019-05-18 16:13:43 +02:00
0708f69627 Merge branch 'master' into cpp_raw_string_literals 2019-05-13 14:37:16 +02:00
5f24c07a83 Rewrote unit tests for C++ raw string literals. 2019-05-13 14:31:10 +02:00
44ca6d307e Improve unit test 2019-05-12 19:25:08 +02:00
b4821131ea Added unit tests for C++ raw literals.
There was already an existing unit test for issue #1559. This unit test broke with this change, because the code it's attempting to tokenize is now valid. This test was slightly modified to still give an error, and a new test was added to verify that the code is now correctly tokenized, even in a more difficult situation.
2019-05-10 15:45:08 +02:00
6d828833c0 Added unit test for C++14 digit separators. 2019-05-10 14:32:36 +02:00
6d84530d52 Merge branch 'master' into 7.0.x 2019-02-18 19:32:55 +01:00
89c8f47b2b Move JavaCCTokenizer to internal package 2019-01-26 19:19:46 +01:00
08b7dd49dd [core] Add a generic JavaCCTokenizer for CPD 2019-01-26 11:24:32 +01:00
a79d4aeb4f Fix asserts 2019-01-20 11:47:59 +01:00
a8e1364072 [cpp] CPD: Lexical error in file (no file name provided)
Fixes #1559
2019-01-20 10:18:52 +01:00
12b647c548 Merge branch 'master' into 7.0.x
Conflicts:
	pmd-apex-jorje/pom.xml
	pmd-apex/pom.xml
	pmd-core/pom.xml
	pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionHandler.java
	pmd-core/src/main/java/net/sourceforge/pmd/util/designer/Designer.java
	pmd-cpp/pom.xml
	pmd-cpp/src/main/java/net/sourceforge/pmd/lang/cpp/CppHandler.java
	pmd-cs/pom.xml
	pmd-dist/pom.xml
	pmd-doc/pom.xml
	pmd-fortran/pom.xml
	pmd-go/pom.xml
	pmd-groovy/pom.xml
	pmd-java/pom.xml
	pmd-java8/pom.xml
	pmd-javascript/pom.xml
	pmd-jsp/pom.xml
	pmd-kotlin/pom.xml
	pmd-lang-test/pom.xml
	pmd-matlab/pom.xml
	pmd-matlab/src/main/java/net/sourceforge/pmd/lang/matlab/MatlabHandler.java
	pmd-objectivec/pom.xml
	pmd-objectivec/src/main/java/net/sourceforge/pmd/lang/objectivec/ObjectiveCHandler.java
	pmd-perl/pom.xml
	pmd-php/pom.xml
	pmd-plsql/pom.xml
	pmd-python/pom.xml
	pmd-python/src/main/java/net/sourceforge/pmd/lang/python/PythonHandler.java
	pmd-ruby/pom.xml
	pmd-scala/pom.xml
	pmd-swift/pom.xml
	pmd-test/pom.xml
	pmd-ui/pom.xml
	pmd-visualforce/pom.xml
	pmd-vm/pom.xml
	pmd-xml/pom.xml
	pom.xml
2018-12-13 18:53:10 +01:00
10e27ca3c0 Deprecate PMD LanguageModule for languages, that only support CPD 2018-11-26 13:55:35 +01:00
5eb1d23a38 Create system to declare processing stages in an extensible fashion 2018-11-02 07:39:16 +01:00
377baf7caf Replacing IOUtils.closeQuietly(foo) with try-with-resources statements 2018-10-19 14:23:51 -05:00
cba4e87acd Replacing deprecated IO methods with ones that specify a charset
Standardizing with StandardCharsets.UTF_8, given that it was used in
several places of code already, and it provides compile-time checking
(as opposed to "UTF-8")
2018-10-12 17:25:08 -05:00
888824d24a Fix NullPointerException in CPPTokenizer:99
Due to `skipBlocks = true` and `skipBlocksStart` being uninitialized in `CPPTokenizer`, `maybeSkipBlocks` would always throw a NullPointerException as it is assuming that `setProperties` is always called after the constructor.
Changed `CPPLanguage` to always invoke `setProperties`, similarly to `CsLanguage`.
This only happens in programmatic invocations.
2018-07-29 09:11:15 +01:00
5a7bbe19a2 dogfood: fix missing override
Note: the rule is disabled for pmd-xml, refs #1074
2018-06-16 17:48:36 +02:00
47e345945e [cpp] Allow CPD suppressions with comments 2018-04-14 22:33:37 -03:00
91b8a22b42 Update GenericToken specialToken method to obtain only comment tokens 2017-10-28 14:42:44 -03:00
e8fdbdbca4 Update GenericToken interface to expose directly region methods 2017-10-28 14:42:44 -03:00
f29e3f0408 Change ant tasks over (CPP) Token class 2017-10-28 14:42:44 -03:00
3d9511a0e5 [doc] Remove old maven site 2017-08-15 14:31:03 +02:00
e5ddad3c3b Remove pushed .gitignored files
These files were already at the repository
but they should have been ignored
2017-07-27 18:31:20 -03:00
ead8d964c5 [cpp] Undo changes to String literals in grammar, it's not needed anymore
Such slightly illegal char escape sequences can still be parsed now.
2017-07-08 11:48:06 +02:00
5bcf30a2a4 [cpp] Add unit test to assert begin/end of Tokens with continuation 2017-07-08 11:32:54 +02:00
ec631f3993 [cpp] Don't skip the continuation character in the grammar anymore
Since we now have a CppCharStream, we can remove the changes
introduced for #431
2017-07-07 23:11:27 +02:00
dbc2d02895 [cpp] Add custom CppCharStream for line continuation support
Fixes #448
2017-07-07 22:46:21 +02:00
0f9a4a97c0 cpp: skip line continuation character in grammar
Fixes #431

Note: the tokens separate by such continuation characters are not
merged and appear as two separate tokens, which could lead to false
negatives in duplication detection.

ContinuationReader is deleted, since skipping characters in the stream
makes it difficult to provide accurate line numbers/positions.
2017-06-17 12:42:13 +02:00
d92688a07d Introduce end-of-line normalization
References pmd/build-tools#2
2017-02-02 20:52:08 +01:00
e280151987 pmd-cpp/pmd-java: checkstyle fixes 2016-12-16 15:48:53 +01:00
edcd4e5ccb pmd-cpp: checkstyle, formatting 2016-12-02 09:18:02 +01:00
c099d50397 Added support for Raw String Literals (C++11). 2015-12-10 16:15:40 +01:00
c92dc9706c Relaxed C++ tokenizer so a '\'(backslash) can be use to escape any character inside a string or character.
The following 2 code snippets could not be tokenized:

1:  if (*pbuf == '\0x05'), the problem is the '\0' in the character
literal '\0x05'.
2:  szPath = m_sdcacheDir + _T("\    oMedia");, the problem is the '\ '
in the string literal "\    oMedia".

I relaxed the lexical grammar so a '\' (backslash) can escape any
character inside a string or character literal. We can relax the grammar
because CPD only needs the tokens, so it is no problem to accept
'invalid' string / character literals. (according to the ANSI C
standard).  Failing too fast because the tokenizer is too strict is
annoying because then we can't check the files for duplicated code.

Both snippets were taken from existing projects and be successfully
compiled, so for some C / C++ compilers it is valid code.
2015-01-13 11:36:54 +01:00
d830974842 Fixed lexical error when a C++ file contains an empty character literal L''.
This commit fixes a lexical error when a C++ file contains an empty
character literal L''. The following code could not be tokenized:

std::wstring wsMessage( sMessage.length(), L'');

It triggers the following error:

net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file
'foo.cpp' at line 1, column 46.  Encountered: "\'" (39), after : "\'"
2015-01-13 11:36:54 +01:00
ceef6cd236 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 : ""
2015-01-13 11:36:53 +01:00
5c2df4c877 Fixed lexical error when a C++ file contains ASM with the '@' character.
This commit fixes a lexical error when a C++ file contains ASM with the
'@' character. The following code cannot be tokenized and triggers a
lexical error:

asm void eSPI_boot()
{
// setup stack pointer
lis r1, _stack_addr@h
ori r1, r1, _stack_addr@l
}

The error that occurs:

net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file
CODE_LOADED_FROM_STRING at line 4, column 22.  Encountered: "@" (64),
after : ""
2015-01-13 11:36:53 +01:00
26b4f850b1 #1252 net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file xxx.cpp 2014-12-12 18:58:51 +01:00
6b3b9d0ccc #1252 implement BOM detection differently for cpp 2014-12-12 17:45:38 +01:00
c8887de5ff #1090 cpp parser exception with inline asm 2014-11-28 21:32:32 +01:00
53048546ba Checkstyle/whitespace fixes 2014-10-18 13:31:14 +02:00