Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses disappear for conditional node #613

Closed
aizeNR opened this issue Mar 26, 2024 · 3 comments
Closed

Parentheses disappear for conditional node #613

aizeNR opened this issue Mar 26, 2024 · 3 comments
Labels

Comments

@aizeNR
Copy link

aizeNR commented Mar 26, 2024

Hi, when you build a tree with a conditional expression, and convert it to a tree and back to an expression, the parentheses for the conditional disappear.

Below is code to reproduce
https://go.dev/play/p/mHo7-d3vFuo

package main

import (
	"fmt"

	"github.com/expr-lang/expr/parser"
)

func main() {
	tree, err := parser.Parse("(UserID != 0 ? true : false) && ProductID == 1")
	if err != nil {
		fmt.Print(err.Error())
		return
	}

	fmt.Print(tree.Node.String())
}
@zhuliquan
Copy link
Contributor

zhuliquan commented Apr 6, 2024

@antonmedv
Copy link
Member

I will fix it.

@antonmedv
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants