Skip to content

[BUG] Expression parser fails with operators other than +/-* like roundTo() #9

@freemansoft

Description

@freemansoft

ℹ️ Info

The expression parser does not handle some function calls or power operators.

Version: 0.2.0-alpha current head of the main branch

💬 Description

The expression parser for math operations will return incorrect results for math functions on operations.

solved to `NaN` for {"value": roundTo({semantic.fontSize.base} / {semantic.fontSize.scale}, 0), "type": "fontSizes", "path": ".semantic.fontSize", "name": "sm", "variableName": "semanticFontSizeSm" }

solved to `0.0` for {"value": roundTo({semantic.fontSize.base} * {semantic.fontSize.scale}^7, 0), "type": "fontSizes", "path": ".semantic.fontSize", "name": "6xl", "variableName": "semanticFontSize6xl" }

where base and scale have values though the values really don't matter

  "fontSize"
      "base": {
        "type": "fontSizes",
        "value": "16"
      },
      "scale": {
        "type": "fontSizes",
        "value": "1.2"
      },

📜 tokens file you tried to import

Example 2 in PR #4 demonstrates this. There extra logging in that PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions