From 927e04b2e699e3e7f1c24aa4749199fbc7227f78 Mon Sep 17 00:00:00 2001 From: Clemens Solar Date: Sun, 21 Jan 2024 22:01:47 +0100 Subject: [PATCH] fix: do not add expressions and multiline values to customizer params --- src/lib/openSCAD/parseParameter.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/openSCAD/parseParameter.ts b/src/lib/openSCAD/parseParameter.ts index 6d676b7..0039408 100644 --- a/src/lib/openSCAD/parseParameter.ts +++ b/src/lib/openSCAD/parseParameter.ts @@ -85,6 +85,17 @@ export default function parseParameters(script: string): Parameter[] { let options: ParameterOption[]; let range: ParameterRange; + // Check if the value is another variable or an expression. If so, we can continue to the next + // parameter because everything after this variable (including itself) is not a parameter. Also + // check if the value is a string that contains a newline. If so, we will also abort the parsing + if ( + value !== 'true' && // true and false are valid values + value !== 'false' && + (value.match(/^[a-zA-Z_]/) || value.split('\n').length > 1) + ) { + continue; + } + if (match[3]) { const rawComment = match[3].replace(/^\/\/\s*/, '').trim(); const cleaned = rawComment.replace(/^\[+|\]+$/g, '');