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

this.lexer is undefined #353

Open
mochicode opened this issue Apr 14, 2017 · 2 comments
Open

this.lexer is undefined #353

mochicode opened this issue Apr 14, 2017 · 2 comments

Comments

@mochicode
Copy link

When I build and run the ansic example from the repository I get the following error:

var lexer = Object.create(this.lexer);
                       ^

TypeError: Object prototype may only be an Object or null: undefined
    at Function.create (<anonymous>)
    at Parser.parse (C:\workspace\src\github.com\zaach\jison\ansic.js:106:24)
    at Object.commonjsMain [as main] (C:\workspace\src\github.com\zaach\jison\ansic.js:259:27)
    at Object.<anonymous> (C:\workspace\src\github.com\zaach\jison\ansic.js:262:11)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)

I used yarn run jison examples/ansic.jison to build the parser and tried to use the cli as well as to embed the parser in a program and I'm getting the same error.

The calculator example, however, works fine.

@GerHobbelt
Copy link
Contributor

The calculator example comes with both lexer (inside a %lex.../lex section) and a grammar (parser), while the ansic example does not include a lexer spec, hence jison does not produce a lexer to go with the parser. Hence this.lexer is not defined.

@mochicode
Copy link
Author

Hey, sorry that I didn't had time to responde.
I thought that the examples would work, thous I was a little confused.

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

2 participants