Commit Graph

76 Commits

Author SHA1 Message Date
Matthias Krüger 59bbe6cd42 matchcompiler: simplify some more code 2016-11-26 16:27:39 +01:00
Matthias Krüger 80cb350a6b matchcompiler: remove redundant variable 'neg' and do some minor reformatting 2016-11-26 15:41:59 +01:00
Matthias Krüger b687e011f2 matchcompiler: --show-skipped: print locations of skipped patterns in file:line notation. 2016-11-24 00:36:23 +01:00
Frank Zingsheim f5bf0ff824 Fixed #7392 (matchcompiler fails with python 3.5) 2016-05-04 11:19:07 +02:00
PKEuS 4b9241f643 Removed support for patterns like |a|b and a||b (equal to a|b|)
-> Improved performance by 1,3% (non-matchcompiled build)
2016-02-02 11:46:42 +01:00
Albert ARIBAUD (3ADEV) 97b43c78ce Run all Python code through autopep8
Run all Python code through autopep8 as follows:

    autopep8 -ri --ignore=E261,E262,E302 --max-line-length 1000 .

E261 or E262 would cause spaces after a comment's hash sign
to be squashed. Since some of the comments in cppcheck's
Python code have space-indented code examples, not ignoring
E261 or E262 would wreck the formatting of those examples.

E302 prevents autopep8 from adding some blank lines.

setting --max-line-width ensures no line will be wrapped.
2016-01-05 13:30:32 +01:00
Daniel Marjamäki ca4f55ec4c Cleanup Copyrights. Now all should be just for Cppcheck team. 2016-01-01 23:04:16 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
Frank Zingsheim e0e8c3fe60 Fix #7210 (Compiled match versus parsed match "|a|b") 2015-12-11 20:21:38 +01:00
XhmikosR 7d0075357e PEP8 fixes.
[ci skip]
2015-08-21 11:59:52 +03:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Frank Zingsheim 907dea92b1 Fixed #6844 (CMake with matchcompiler) 2015-07-23 10:49:53 +02:00
Frank Zingsheim bac5aac92a Fixed #6716 (Performance: Alternative String Representation in Match Compiler) 2015-06-07 16:18:40 +02:00
Matthias Krüger 80be769912 matchcompiler: pep8 fixes 2015-03-20 09:32:56 +01:00
PKEuS 688d5d5c54 matchcompiler.py: Added missing parantheses 2015-01-31 12:36:22 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
Thomas Jarosch 0c21f77873 MC: Add ability to show skipped (=non-compiled) patterns 2015-01-09 22:50:42 +01:00
Thomas Jarosch 5b4f543c3b Match compiler: Support match patterns with escaped quotes
This allows us to compile patterns like 'extern "C"'.
Fixes long standing open issues in the MC unit test.
2015-01-09 22:41:40 +01:00
Thomas Jarosch 07231c832c Match compiler: Allow multiple spaces / no space at all when searching for C-strings
This catches 32 more C strings.
2015-01-09 01:18:50 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 62d07878d7 Fixed two issues in matchcompiler:
- Use correct findmatch or findsimplematch for verification
- Print failing pattern also for findmatch/findsimplematch
2014-07-02 15:25:54 +02:00
PKEuS ec59f1d9df matchcompiler.py: Check Token::type() before comparing Token::str() against "||" or "|" 2014-06-30 14:04:18 +02:00
PKEuS 78f0a47170 matchcompiler.py: Show pattern that caused the InternalError 2014-06-30 14:04:18 +02:00
PKEuS 47a1122eb8 Updated matchcompiler to latest changes 2014-06-14 10:57:38 +02:00
Simon Martin a3d1cac79c Ticket #5373: Keep track whether tokens come from a C or C++ file to properly handle %type% in Token::Match with "delete" 2014-03-08 21:26:06 +01:00
Matthias Krüger a9df4a3288 man, htdocs, gui, test, tools: bump a few more copyrights to 2014 2014-03-03 11:03:17 +01:00
Daniel Marjamäki 398ed973f4 matchcompiler: autopep8 formatting 2013-10-13 11:01:50 +02:00
Daniel Marjamki 45cf562212 matchcompiler: fixed find(simple)match compiler problems. 2013-06-02 13:57:25 +02:00
Daniel Marjamki 35b13da3a5 matchcompiler: find(simple)match doesn't work well. the compiled functions are not static => the wrong function can be executed. this is a quick fix that just disable find(simple)match compiled patterns. 2013-06-02 12:41:34 +02:00
Frank Zingsheim 650027a07a Fixed #4797 (matchcompiler.py cannot handle overloaded findsimplematch and findmatch) 2013-05-15 18:18:58 +02:00
XhmikosR ae73466f97 Python scripts: PEP8 fixes 2013-03-03 09:59:16 +01:00
PKEuS 2ad38c8701 Updated matchcompiler to support %cop% 2013-03-01 02:52:44 -08:00
Thomas Jarosch 4fb6751d08 MC: Enable compiled matches for Token::findmatch() and Token::findsimplematch()
Speed is exactly the same and the --verify mode of the
match compiler ensured everything works as expected.
2013-01-16 21:50:32 +01:00
Thomas Jarosch 9f9c654621 MC: Implement verify mode for compiled Token::findmatch patterns 2013-01-14 11:18:33 +01:00
Thomas Jarosch 63e18d6b1c MC: Split _replaceTokenFindMatch() into two small functions 2013-01-14 11:06:59 +01:00
Thomas Jarosch 017783a77e MC: Save one indentation level 2013-01-14 11:06:55 +01:00
Thomas Jarosch 3bb8237cdc MC: Turn MatchCompiler tests into python unit test 2013-01-14 11:06:33 +01:00
Thomas Jarosch c0044122f4 Add self test for _replaceTokenFindMatch 2013-01-12 15:28:38 +01:00
Thomas Jarosch ff9e864a07 Add self test for replaceTokenMatch 2013-01-12 15:28:38 +01:00
Thomas Jarosch a7377f180a Quote output of _assertEquals()
It's easier to detect trailing spaces this way.
2013-01-12 15:28:38 +01:00
Thomas Jarosch 4038d4b562 Place main code into own function 2013-01-12 15:28:38 +01:00
Thomas Jarosch fdcfbd5ff9 Add missing copyright header 2013-01-10 11:10:45 +01:00
Edoardo Prezioso 6236e1dc38 Token::Match: removed harmless special code for initial '!!foo' patterns. 2013-01-09 20:13:33 +01:00
Thomas Jarosch de36324d62 Match compiler: Add cmdline handling 2013-01-09 19:41:03 +01:00
Thomas Jarosch 97e1e50139 Match compiler: Workaround broken code generation for "!!foo" patterns
This is just meant for the upcoming release.
2013-01-09 19:25:24 +01:00
Thomas Jarosch e1be85a552 Match compiler: Be more user friendly on how to invoke it 2013-01-09 19:22:40 +01:00
Thomas Jarosch ade0b741b7 Match compiler: Create 'build' directory if needed 2013-01-09 19:15:13 +01:00
Thomas Jarosch 982503f457 Match compiler: Workaround broken optimizations in verify mode
If the match compiler uses the 'verify' mode and we
compile with -O2, some tests comparing the on-the-fly-parser
to the compiled match fail.

Small functions are inlined by the -O2 compile flag.
If we disable function inlining and still compile with -O2,
everything is back to normal.

gdb didn't show anything useful during the mismatch
since the needed variables are optimized out. Once
we start printing them, the problem vanishes, too.
-> Can only be diagnosed at the x86 assembly level.

The problem vanished by switching the invocation order
of Token::Match() and the compiled match, so just swap them.

Also add commented out helper code
to better diagnose mismatch problems.
2013-01-09 19:03:42 +01:00
Thomas Jarosch 9970414a2f Match compiler: Implement 'verify mode' for Token::Match
Verify mode runs the same ::Match pattern on a token
using the on-the-fly parser and the compiled match parser.
The result is compared and we abort on mismatch.

Already detected an error in our test suite, needs investigation.
2013-01-07 22:27:57 +01:00