cimaron / glsl2js

MIT License
12 stars 4 forks source link

Expose the parsed AST to the world #26

Open AndrewRayCode opened 10 years ago

AndrewRayCode commented 10 years ago

This is what I really want to play with. Right now I've made a small local modification

    //Parse into AST
    if (result) {
        this.parser.parse(state);
        return state;
    }

And my own outside-parser utility function does this:

state = glsl.parse( source, options );
if ( state.errors.length ) {
    throw state.errors[ 0 ];
}

return new glsl.ast.GlslProgram( state.ast );

And I added this for convenience:

glsl.ast.GlslProgram = function( units ) {

    this.translation_unit = units;

};

But these are only applicable to my project, not sure how you'd want to expose the AST in the parser codebase.

cimaron commented 9 years ago

Is this still an issue?