Giter VIP home page Giter VIP logo

Comments (4)

zaach avatar zaach commented on July 17, 2024

It should be possible for you to store a reference to the parser in the yy scope variable:
myparser.yy.parser = myparser;

Then you could access myparser as yy.parser from within semantic actions.

But this may disrupt the currently executing parse, since parse calls lexer.setInput on each invocation. As an alternative, you could instantiate another parser just for use with string interpolation.

If only a subset of the language is allowed in embedded code fragments, you could even use a separate grammar and parser altogether, which may be a bit more efficient for parsing, but would require maintaining two grammars.

from jison.

creationix avatar creationix commented on July 17, 2024

Yeah, I had hacked in a reference to the parser and found that the results are unexpected because of setInput being called again. It looks like I'll have to generate pseudo tokens for start and end of embedded code and then just make it all part of the ine grammer.

from jison.

zaach avatar zaach commented on July 17, 2024

Forgot to close

from jison.

retorquere avatar retorquere commented on July 17, 2024

I'm trying to port my bibtex translator from pegjs to jison and I'm facing a similar issue. Is this then a structural hard problem for jison?

from jison.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.