Git Product home page Git Product logo

Comments (4)

arcady-lunarg avatar arcady-lunarg commented on June 13, 2024

Yeah, I think ultimately the way to deal with this is to keep track of the start of the unterminated statement. Part of the issue is that #include processing happens in the tokenizer, at a level below that of the glslang.y bison parser. Error reporting is definitely an area where glslang could use considerable improvement, patches are definitely welcome.

from glslang.

phr34k avatar phr34k commented on June 13, 2024

@arcady-lunarg good to hear you concur with my line of thought. Do you have any highlevel pointers in terms of 'glslang.y', it's hard to understand thirdparty code at face value, so I'm wondering what generally would work best.

What I had in mind:

  • I assume that you that this error statements in particulair are auto generated, so I'd have to patch up the catch all error handler.
  • I assume that some kind of global context is available from bison, that is also available during the error handler(s)
  • I'm thinking some kind of inline code to identify when statements are opened and terminated (state-machine)
  • The part where the auto generated errors are handled then simply use the additional (context-)information to report altered locations.

Would this be a solid approach, keeping in mind, I'd like to refrain from seriously affecting other errors. Do you have an alternative/better suggestion?

from glslang.

arcady-lunarg avatar arcady-lunarg commented on June 13, 2024

I recommend reading up on how bison generated grammars work, but the key glslang-specific pieces you want to look at here is the TParseContext class, and the interm struct in glslang.y, and in particular its loc member of type TSourceLoc.

from glslang.

phr34k avatar phr34k commented on June 13, 2024

@arcady-lunarg I have prepared a pull request of the initial changes I drafted, it'd be great if you could have a look to see if you had any comments on it: #3559

from glslang.

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.