Commit Graph

98 Commits

Author SHA1 Message Date
omarandlorraine 6488650d24
use python3 on debians too (#3812)
* use python3 on debians too

in Debian 11 which is Bullseye, /usr/bin/python is a Python2
interpreter, which means that cppcheck-htmlreport fails to run here.
So I've chenged the shebang to use python3

* change all shebangs from python to python3

Co-authored-by: Sam M W <smw@alertergroup.co.uk>
2022-11-03 22:14:30 +01:00
Oliver Stöneberg 6634cb95a1
matchcompiler.py: declare matchcompiled functions as `inline` (#4536) 2022-10-06 07:58:48 +02:00
Paul Fultz II 2a0b2f538e
Check tokType in match compiler (#4219)
* Check tokType in match compiler

* Set keyword when tokenlist is missing
2022-06-18 21:30:42 +02:00
Rikard Falkeborn e7b5a776bd
Matchcompiler: Add missing makeConstString (#4179) 2022-06-08 09:24:20 +02:00
Oliver Stöneberg c690bfb03a
matchcompiler.py: skip comments in _replaceTokenMatch() (#3825) 2022-02-11 21:20:55 +01:00
Oliver Stöneberg a03d754d19
more copyright fixes (#3771) 2022-01-28 18:30:12 +01:00
Rikard Falkeborn 8dc8aa0459
Matchcompiler parse all Match|simpleMatch on the same line (#2993)
* MatchCompiler: Neaten error messages

Especially the added space makes it a little more readable.

* MatchCompiler: Add spaces between operators

* Matchcompiler: Don't bailout if non-const pattern

If matchcompiler found a call to Token::Match() or Token::simpleMatch()
with an unknown string argument, subsequent calls to Token::Match() or
Token::simpleMatch() on the same line would not be processed by
matchcompiler.

To fix this, keep track of the last index we found a match, and update
it accordingly when the line is modified. To avoid having to keep track
of if "Match" or "simpleMatch" is the first match we find, just make a
loop over them.
2020-12-31 19:28:06 +01:00
Ken-Patrick Lehrmann 9a5e53032d
Update matchcompiler after change in Token::Match (#2653)
The change in token.cpp was done in f6788c047
This should fix the failures in travis.

Co-authored-by: Ken-Patrick Lehrmann <kp.lehrmann@gmail.com>
2020-05-20 21:33:29 +02:00
Oliver Stöneberg 4f7d162555
matchcompiler.py: only add additional includes if necessary (#2636) 2020-05-12 21:49:39 +02:00
Daniel Marjamäki 5bc0347fd5 Remove 'unsigned' in match compiler 2019-07-15 13:49:35 +02:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
practicalswift 0a1b3a9d6f Fix typos (#1568) 2019-01-06 17:15:57 +01:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Matthias Krüger f009cfc845 fix some typos found by codespell. 2018-02-04 20:53:43 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ayaz Salikhov 2e6a22e882 Improve Python code 2017-07-22 11:05:50 +02:00
Daniel Marjamäki fc79941828 fix matchcompiler.py 2017-06-05 13:41:38 +02:00
Ayaz Salikhov 3dc4188292 Improve Python code 2017-06-05 13:23:00 +02:00
Ayaz Salikhov 2dd6168258 Improve Python code 2017-06-04 22:51:48 +02:00
Dmitry Marakasov 94d39f6e91 Fix matchcompiler failure in case of parallel build
During parallel build, multiple processes will try to create build_dir
in parallel, so the build will fail. Fix that by calling makedirs
unconditionally and ignoring errors from it. If there's actual
problem with directory creation, it'll be caught later by isdir()
check.
2017-05-20 23:25:52 +02:00
Matthias Krüger c65725cb1b matchcompiler: don't emmit '!true' or '!false'. Fold to 'false' or 'true'. 2017-04-02 16:35:39 +02:00
PKEuS 0236f67454 Fixed matchcompiler with Python 3.6 on Windows by using UTF-8 as encoding 2017-01-01 10:27:48 +01:00
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