cookiecad / Openscad-to-JSCAD-converter

2 stars 1 forks source link

Code generation fails for variable names starting with a digit (OpenSCAD allows for that) #7

Open Hermann-SW opened 1 month ago

Hermann-SW commented 1 month ago

I am trying to port ``geared_stepper()``` from OpenSCAD to JSCAD. This line cannot be processed: https://github.com/nophead/NopSCADlib/blob/master/vitamins/geared_steppers.scad#L30

pi@raspberrypi5:~/Openscad-to-JSCAD-converter $ cat tst.scad
28BYJ_48  = 42;

cube();
pi@raspberrypi5:~/Openscad-to-JSCAD-converter $ 
pi@raspberrypi5:~/Openscad-to-JSCAD-converter $ node ./converter/index.js tst.scad 
(node:6119) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
source_file 
node type: ERROR, text: 28
file:///home/pi/Openscad-to-JSCAD-converter/converter/codeGeneration.js:30
    const e = new Error(`Syntax not found for type: ${type}`);
              ^

Error: Syntax not found for type: ERROR
    at generateCode (file:///home/pi/Openscad-to-JSCAD-converter/converter/codeGeneration.js:30:15)
    at file:///home/pi/Openscad-to-JSCAD-converter/converter/codeGeneration.js:49:52
    at Array.map (<anonymous>)
...