Jeff Young
b1fa02bcc8
Push a non-existent ref's value as 0. (Don't just crash.)
...
Fixes https://gitlab.com/kicad/code/kicad/issues/7971
2021-03-20 11:05:38 +00:00
Jon Evans
5c17ff0595
Libeval: don't try to dereference invalid STRUCT_REF parent
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7764
2021-02-28 14:46:13 -05:00
Jeff Young
1ce1e493d6
A rule zone is not really a BOARD_CONNECTED_ITEM.
...
Or at least it shouldn't always be treated as one.
Fixes https://gitlab.com/kicad/code/kicad/issues/6382
2020-11-15 20:23:15 +00:00
Ian McInerney
31e626f279
Cleanup creation of all our smart pointers
2020-10-26 23:52:44 +00:00
Jeff Young
948036372e
Ban unitless numbers in DRC rules.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/6029
2020-10-17 10:58:08 +01:00
Marek Roszko
a1c75748a0
Remove GetChars(), a wxWidgets 2.9 compatibility hack
2020-10-15 20:53:25 -04:00
Jeff Young
ebd5dc81cc
Fix some more cases of malformed syntax crashing the compiler.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/6016
2020-10-15 18:32:52 +01:00
Jon Evans
f7d3dddd6d
Fix format argument assertion in libeval_compiler
2020-09-28 21:38:08 -04:00
Roberto Fernandez Bautista
39995341d9
Compile fixes
...
Fix compile error
Fix string format to use %ld instead to work on clang in CADSTAR Archive importers
Add virtual destructor to CONNECTION in CADSTAR_ARCHIVE_PARSER
2020-09-27 22:05:07 +00:00
Tomasz Wlostowski
78fc0349a9
libeval_compiler: free tree in destructor, warning fixes
2020-09-27 17:49:26 +02:00
Tomasz Wlostowski
d2ed27b500
libeval_compiler: fix string comparison
2020-09-27 16:45:46 +02:00
Tomasz Wlostowski
0c885c9c31
libeval_compiler: == operator now does wildcard string comparison
2020-09-27 16:45:46 +02:00
Tomasz Wlostowski
5023d9a780
libeval_compiler: initial support for multiple (>1) function/method arguments
2020-09-27 16:45:46 +02:00
Jeff Young
0763a8962c
Implement boolean not processing in expression language.
...
Also adds some more error catching to be more robust in the face
of malformed customer rules.
Fixes https://gitlab.com/kicad/code/kicad/issues/5694
2020-09-19 12:08:18 +01:00
Jeff Young
80acf944a0
Don't assert when compiling rules; generate a user-visible error.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/5694
2020-09-18 22:29:47 +01:00
Tomasz Wlostowski
712215fe12
libeval_compiler: fix crash when preflighting method calls with 0 arguments
2020-09-08 01:31:42 +02:00
Tomasz Wlostowski
466cbe2f00
libeval_compiler: fixhandling of method calls with empty argument list (e.g. 'A.method()' )
2020-09-08 01:31:42 +02:00
Jeff Young
a35698f08a
Don't fire non-well-formed rules. (But don't assert either.)
...
Fixes https://gitlab.com/kicad/code/kicad/issues/5443
2020-09-01 18:36:58 +01:00
Jeff Young
050bbcdb4f
Fix error reporting from function pre-flighting.
2020-08-26 12:56:17 +01:00
Jeff Young
d7f26cfdf2
Fix test failures.
2020-08-15 19:33:21 +01:00
Jeff Young
b42395ec8d
Attempt to fix locale issue with decimal separator in rules.
2020-08-15 17:32:13 +01:00
Jeff Young
ec5040aff5
Fix missing 'else' and EOF processing, both of which cause crashes.
2020-08-14 22:11:04 +01:00
Jeff Young
edda024285
Fix up some Coverity and CLion warnings.
2020-08-14 12:41:20 +01:00
Tomasz Wlostowski
ab17f4b7b5
libeval_compiler: thou shalt not use strlen() on wxStrings. Works under Linux, doesn't work on OSX/MSVC...
2020-08-14 01:55:11 +02:00
Jeff Young
519bc80394
Replace error reporting in DRC rule compiler.
2020-08-13 18:47:41 +01:00
Jeff Young
0b17dbd123
Fix nesting issues in the DRC rule expression code generator.
...
We were executing function calls multiple times because we were
processing them at a depth the traversal algorithm wasn't expecting.
2020-08-13 18:36:10 +01:00
Tomasz Wlostowski
518a659185
Post-rebase fixes
2020-08-13 14:50:59 +02:00
Tomasz Wlostowski
4abe71d2ef
libeval_compiler: implemented unary +/- operators
2020-08-13 14:50:59 +02:00
Tomasz Wlostowski
c88c8102e5
libeval_compiler: fixed segfault for "(number)" expressions.
2020-08-13 14:50:59 +02:00
Tomasz Wlostowski
a5a06e3c89
libeval_compiler: general clean up of the Lemon grammar + some smart pointers + killed all memory leaks. WIP!
2020-08-13 14:50:59 +02:00
Tomasz Wlostowski
29a01e5515
libeval_compiler: wxString()-ification WIP
2020-08-13 14:50:59 +02:00
Jeff Young
17d3e36bd6
Fix crash bug when condition expression is empty.
2020-08-12 22:20:07 +01:00
Ian McInerney
0a1d8c1aaa
Move lemon parser generation into build directory
...
This moves the generated files out of the source tree and into
the build directory. They are now regenerated each time they are
needed, based on the timestamp of the generated file compared to
the timestamp of the lemon file.
To do this, we also bundle lemon into the thirdparty directory
and build it for ourselves since it is a very tiny program and
not all platforms seem to distribute it in a consistent manner.
Fixes https://gitlab.com/kicad/code/kicad/issues/5013
2020-08-10 13:53:54 +00:00
Jeff Young
7e63376266
Fix typo in DRC rule error reporting that causes crash.
2020-08-03 22:21:35 +01:00
Ian McInerney
268dec5c19
Cleanup some build and Coverity warnings
2020-07-31 02:46:05 +01:00
Jeff Young
577c1be391
Report all DRC rule errors, not just the first.
2020-07-30 14:27:42 +01:00
Tomasz Wlostowski
fe4695719d
libeval_compiler: post-rebase fixes
2020-07-29 23:14:34 +02:00
Tomasz Wlostowski
3c80b98d1c
libeval_compiler: CONTEXT runs the UCODE now (thread-safe solution), fixed some memory leaks
2020-07-29 23:14:03 +02:00
Jeff Young
2ea5528cd0
Start compiling identifiers.
...
We'll need this if we support the "L == foobar" syntax, and besides
it should really be up to the parser client whether or not they use
identifiers with no function call or property reference.
It also allows us to generate error messages for unknown identifers.
2020-07-27 19:53:42 +01:00
Jeff Young
8a010bc23e
Null safety for expression variables.
2020-07-27 19:53:42 +01:00
Jeff Young
552dde8976
Fix return value going out of scope.
...
(From Coverity report.)
2020-07-26 13:41:43 +01:00
Jeff Young
bf445c1a95
Performance enhancements.
...
1) cache pad polygon outlines
huge improvement in connectivity performance and a decent
improvement in DRC performance
2) don't pre-allocate CONTEXT stack
significant improvement in DRC rule performance
2) don't keep re-encoding strings
decent improvement in DRC rule performance
2020-07-25 13:03:33 +01:00
Jeff Young
6529e339a9
Don't store context in the uCode. (It's not thread-safe.)
...
Although it does give some pretty funny results when filling zones.
2020-07-23 22:21:13 +01:00
Jeff Young
f2812773d4
Better handling of undefined values in Rule expressions.
...
This is particularly important to keep the user from having to
enter overly verbose statements such as:
A.Type == 'via' && A.Via_Type == 'buried'
when:
A.Via_Type == 'buried'
is perfectly clear.
2020-07-23 16:41:58 +01:00
Jeff Young
84085df82a
Fix tokenizer to allow '_' in tokens.
2020-07-23 16:41:58 +01:00
Jeff Young
637571e0be
Assume mm if units not given in DRC rules.
...
This keeps us from internalizing them as nm which appear to have
no effect (at least visually).
2020-07-22 15:11:23 +01:00
Jeff Young
150c781f27
Fixup formatting and coding style.
2020-07-22 14:33:32 +01:00
Jeff Young
a6b6084a60
Add preflighting for DRC rule function calls.
2020-07-22 14:33:32 +01:00
Jeff Young
095937563b
Hook libeval compiler up to rule parser
...
- convert expression string tokens to single-quote-delimited
- fix bug where netclass assignments weren't getting updated after
board setup dialog
- move property manager rebuild to lazy evaluation
- improve performance with wider use of const&
- retire DRC_SELECTOR stuff
- use wxString for GUI stuff (particularly translated stuff)
- fix EqualTo() to return false instead of asserting when op types
don't match
- fix buffer overruns with fixed-size string buffers
- make expression function calls case-insensitive
- integrate expression errors into rule parser
- produce more and better error messages
- keep BOARD_ITEM ptrs const as long as possible
- fix a couple of uninitialized variables
2020-07-20 22:11:53 +01:00
jean-pierre charras
6d8fb94d86
Fix a few Coverity warnings.
2020-07-20 16:19:19 +02:00