antvis / antvis/expr

Bug: negative and minus sign lexical conflict

Open
#32 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
26
Forks
1
PR merge metrics
No merged PRs in 30d

Description

When you write code like the following
```js
const expr = "2 -3";
console.log(evaluate(expr)); // 2
```
You will get `2` instead of `-1`, this is because the tokenizer parses `-3` into a **number** instead of **an operator and a number**.

If you want to get `-1`,please add a space before `3`, like below
```js
const expr = "2 - 3";
console.log(evaluate(expr)); // -1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.