grblHAL / core

grblHAL core code and master Wiki
Other
304 stars 73 forks source link

Syntax error / typo in ngc_expr.c #527

Open MitchBradley opened 1 month ago

MitchBradley commented 1 month ago

Line 794 of ngc_expr.c is:

                if((stack_index > 1) && precedence(operators[stack_index - 1] <= precedence(operators[stack_index - 2])))

I think there is a misplaced closing parenthesis. It should be

                if((stack_index > 1) && precedence(operators[stack_index - 1]) <= precedence(operators[stack_index - 2]))
terjeio commented 1 month ago

Good catch! I (or someone else?) should write a comprehensive test suite for the parameters/expressions/flow control part of the core...

MitchBradley commented 1 month ago

Thank the C++ compiler for catching it. I tried compiling with C++ and the stricter type coercion revealed the problem.

I think there might also be an issue with EXISTS[]. LinuxCNC says that the syntax is EXISTS[#<_name>], but as I read the code, it is looking for e.g. EXISTS[_name] without the enclosing #<>.

terjeio commented 1 month ago

I think there might also be an issue with EXISTS[].

You are correct, I will fix this in the next commit.