Skip to content

Incorrect lexing of compound operators with unary minus #294

@thaliaarchi

Description

@thaliaarchi

The compound operator *= followed by a negative number is incorrectly lexed as a single token *=-:

Error: expected semicolon or right parenthesis ╭─[ws.jq] │ 166 │ .n = 0 | match_char(parse_num; parse_num | .n*=-1; .) | ┆ ─┬─ ┆ │ ┆ ╰───────── unexpected token ────╯ 

It can be worked around by adding a space:

- .n = 0 | match_char(parse_num; parse_num | .n*=-1; .) | + .n = 0 | match_char(parse_num; parse_num | .n*= -1; .) |

(Seen in ws.jq)

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