Skip to content

Support for Unary Minus Operator #2628

@AlexanderSLoburev

Description

@AlexanderSLoburev

Hello! Thank you for the amazing plugin. It's an indispensable tool for my Obsidian workflow.

I've encountered a limitation when trying to use unary minus expressions in DQL. The current parser does not recognize the unary minus operator, which forces users to write less intuitive code.

TABLE -price AS "Debt"
Dataview: Error: 
-- PARSING FAILED --------------------------------------------------

> 1 | TABLE -price AS "Debt"
    |       ^

To achieve the desired result, a user must use a binary operation with zero, which is verbose and unnatural:

TABLE 0 - price AS "Debt"

The same goes for lambda expressions.

Expected Behavior:

The parser should correctly interpret the unary minus operator (-) before a field name or a literal number. The first example above should work identically to the second one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions