bitboxelectronics / R2C2_Firmware

R2C2 -- electronics for RepRap 3D printers (and others), CNC and other machines.
http://www.3dprinting-r2c2.com/
35 stars 34 forks source link

Nested "()" comments not parsed correctly #1

Closed bobc closed 12 years ago

bobc commented 12 years ago

A comment such as

( fill DiaphragmPeriod(layers): 100 )

is parsed incorrectly, leading to incorrect commands being executed.

triffid commented 12 years ago

so see what your C compiler thinks of /* this is a /* nested comment / which "shouldn't" break things but will /

fwiw lines like that should use a ;semicolon comment so the firmware can skip the whole thing

bobc commented 12 years ago

You are quite right : I can't think of any language that does allow nested comments like that.

According to "The NIST RS274NGC Interpreter - Version 3"

3.3.4 Comments and Messages Printable characters and white space inside parentheses is a comment. A left parenthesis always starts a comment. The comment ends at the first right parenthesis found thereafter. Once a left parenthesis is placed on a line, a matching right parenthesis must appear before the end of the line. Comments may not be nested; it is an error if a left parenthesis is found after the start of a comment and before the end of the comment.

So clearly it is a bug in the software generating the GCode. The generator was BfB Axon 2.0 beta 2. The previous version I used did not have this problem. I will raise the issue on the BfB forum.

Therefore I will close with "Not a bug".