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

Potential error for definitions of == and != #39

Open
Mikerah opened this issue Aug 27, 2019 · 0 comments
Open

Potential error for definitions of == and != #39

Mikerah opened this issue Aug 27, 2019 · 0 comments

Comments

@Mikerah
Copy link
Contributor

Mikerah commented Aug 27, 2019

While going through the grammar, I noticed that in the definitions for == and !=, we have the following

e10
    : e10 '==' e9
        {
            if (($1.type == "NUMBER") && ($3.type == "NUMBER")) {
                $$ = { type: "NUMBER", value: $1.value.equals($3.value) ? bigInt(1) : bigInt(0) };
            } else {
                $$ = { type: "OP", op: "==", values: [$1, $3] };
            }
            setLines($$, @1, @3);
        }
    | e10 '!=' e9
        {
            if (($1.type == "NUMBER") && ($3.type == "NUMBER")) {
                $$ = { type: "NUMBER", value: $1.value.eq($3.value) ? bigInt(0) : bigInt(1) };
            } else {
                $$ = { type: "OP", op: "!=", values: [$1, $3] };
            }
            setLines($$, @1, @3);
        }

Here, for ==, value is defined with $1.value.equals($3.value) and for !=, value is defined with $1.value.eq($3.value).

Is this is a bison/jison particular thing or a typo?

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

No branches or pull requests

1 participant