Closed ProSurfer73 closed 1 year ago
Thanks to this commit https://github.com/ProSurfer73/Macro-Parser/commit/c58d01520d02d48ced38277a9af7d6f1449332c1 the calculate command is partially implemented (part circled in green). But there are still some issues, as you can see by the picture above (part circled in red).
The case in which a macro with parameters is inside another macro with parameters is yet not treated.
The program currently crashes when this last command is run.
The debugger in Code::Blocks was not able to tell me the line at which the program had crashed.
Thanks to Visual Studio, I was able to debug the program and here is the line at which it crashes (in stringeval.cpp file) :
I replaced the line mentioned by :
if(!p.first.empty() && p.first.back() != ')')
And the execution seems to be running smoothly with Visual Studio IDE.
But it keeps on crashing using gcc compiler and Code::Blocks.
Lets investigate why.
Lets try to use the GDB commandline to debug our program. I looked for oneline videos on how to debug our program with GDB. Lets first try to locate the symbol files.
From what I was able to debug, the crash occurred in one the function from the c++ standard library (but unlocated.
I used gdb and made the program run line by line. This way, I was able to find the line that was causing the crash to the program (please see the picture below).
crash fixed thanks to this commit: https://github.com/ProSurfer73/Macro-Parser/commit/42e2f1ad735eebb7992503b3a4ce3b0a4cd78d24.
Unfortunately, the expression still cannot be calculated: Lets debug and fix that !
I decided to type and evaluate this expression. Lets debug and fix the situation !
Again, by using GDB debugger and by running the program line by line, I was able to locate the source of the error : Lets now patch this unwanted exception thrown.
The previous commit fixes the evaluation of this expression:
The problematic expression is now correctly evaluated (as you can see by the picture below) 👍
But now we have this expression that cant be evaluated :
Previous commit fixed the issue.
We now face this expression still incorrectly evaluated. ( the result should be 55 instead of 33 )
Previous commit fixed the issue.
This type of macro now seem to be supported. Lets mark this issue as closed !
For now, MacroParser only works with string ending with '(x)'. The goal would be to make it work with any number of arguments (x, y) , and all possible names for this argument ( a , b , x , X , Y , y , ...). But it is really going to be used often enough ?