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

Access to an invalid object #2

Open
mingodad opened this issue Jul 25, 2022 · 0 comments
Open

Access to an invalid object #2

mingodad opened this issue Jul 25, 2022 · 0 comments

Comments

@mingodad
Copy link

While testing tscc with the https://github.com/Hadron67/tscc-compiler/blob/master/examples/zend/jzend_parser.y and intentionally commenting this line:

//%left UNARY

When trying to execute it on https://hadroncfy.com/tscc-compiler/web-demo/

Uncaught TypeError: Cannot read properties of undefined (reading 'pr')
    at Object.defineRulePr (tscc.js:2963:28)
    at jjdoReduction (tscc.js:5873:24)
    at jjtryReduce (tscc.js:6060:13)
    at jjacceptToken (tscc.js:6042:21)
    at jjdoLexAction (tscc.js:5300:36)
    at jjacceptChar (tscc.js:5388:21)
    at nextToken (tscc.js:4861:17)
    at Object.parse (tscc.js:4900:17)
    at yyparse (tscc.js:6237:12)
    at Object.compile (tscc.js:8480:17)

With this change it seems to work:

        else {
            var pt = _pseudoTokens[token.val];
            if(!pt){
                singlePosErr(`pseudo token "${token}" is not defined`, token);
            }
            else _top().pr = pt.pr; ///<<< adding `else` before 
        }
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