bcssov / IronyModManager

Mod Manager for Paradox Games. Official Discord: https://discord.gg/t9JmY8KFrV
https://bcssov.github.io/IronyModManager/
MIT License
350 stars 41 forks source link

Top level inline scripts marked as an invalid object if inline math with parentheses is present #474

Closed PresMemes closed 11 months ago

PresMemes commented 11 months ago

Describe the bug Trying to define an entire object using an inline_script that has inline math that uses parentheses causes Irony to incorrectly mark said object as invalid despite Stellaris compiling it without errors. Including # Dear Irony please fallback to simple parser doesn't fix the issue either. Removing all the parentheses does make the bug go away, but that's not the most practical solution.

To Reproduce Steps to reproduce the behavior:

  1. Create an inline script that defines an entire object that also uses inline math.
  2. Run Irony's conflict solver and check the 'Invalid' section.

Expected behavior Objects entirely defined with inline_scripts with inline math shouldn't be marked as Invalid

Screenshots Inline script definition: screenshot13

Object definition (@civic_default_random_weight = 5): screenshot14

Irony's errors: screenshot11 screenshot12

In-game: screenshot10

Version:

bcssov commented 11 months ago

Irony uses CWTools beneath it and these are CWTools messages. If you want Irony to switch to a simple inbuilt parser and validation you need to put the comment you mentioned in each affected file (it's per file not global):

# Dear Irony please fallback to simple parser

And the comment should preferably be on an empty line ie

# my comment
block_of_code = {}
# Dear Irony please fallback to simple parser

Last time the comment approach was used by the Giga devs; haven't heard from them about any issues with Irony registering and falling back to simple validation.

PresMemes commented 11 months ago

So after adding # Dear Irony please fallback to simple parser to the top of every file, the inline_script is no longer being marked as invalid but the army itself still is being marked with the same error.

If I nest the inline_script down a level, like so:

test_2_army = {
    inline_script = {
        script = test_inline
    HEALTH = @civic_default_random_weight
    }
}

Then it is no longer marked as invalid while using the simple parser.

bcssov commented 11 months ago

Can you share your test case here?

I want the whole mod to see for myself.

PresMemes commented 11 months ago

Sure, here's my setup for testing: ironytest.zip

And here's the mod that caused me to look into the issue in the first place: https://steamcommunity.com/sharedfiles/filedetails/?id=2797565369

bcssov commented 11 months ago

Excellent, I can confirm several issues. Again a new scenario for Irony.

bcssov commented 11 months ago

And fixed Image2