untoldwind / KontrolSystem2

Autopilot scripting system for KSP2
Other
54 stars 15 forks source link

Parsing error on comments (0.4.1) #87

Closed plonk-75 closed 1 year ago

plonk-75 commented 1 year ago

KSP 0.1.2.022258 KS2 0.4.1

Code to reproduce:

    let foo = 1.23456
    const bar = if(foo > 6.54321)   // this comment results in a parsing error
        1.0
    else
        -1.0

Result:

Rebooted in 00:00:00.0486655

ERROR: [plonk\test.to2(28, 37)] Parsing
plonk\test.to2(28, 37): Expected '(' or <identifier> or 'if' or <identifier> or '-' or '!' or '~' or <identifier> or <identifier> or <float> or <integer> or <string> or '(' or '{' or '[' or '(' or '(' or Expected at least 1 items or 'fn' or 'return' or 'break' or 'continue'

Expected: No error

Removing the comment results in working code:

    let foo = 1.23456
    const bar = if(foo > 6.54321)
        1.0
    else
        -1.0

Result: works fine

Use of curly braces works, too:

    let foo = 1.23456
    const bar = if(foo > 6.54321) {  // this is a fine comment
        1.0
    } else {
        -1.0
    }

Result: works fine

Maybe related to issue #57?

untoldwind commented 1 year ago

Should be fixed in 0.4.1.2

plonk-75 commented 1 year ago

Fix confirmed from my side.