X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fparser.cpp;h=eee6212930f5dccabdac77b4a32467f91fb89727;hb=9d798ac368bfd236a7632a3a15e51bd1112ea63d;hp=60cc3516b0750db9f131e8a665b135c89d7dab7b;hpb=af00eefb3f7da48ec4038357035980c31cbcb685;p=libs%2Fgl.git diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index 60cc3516..eee62129 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -28,30 +28,30 @@ Parser::~Parser() Module &Parser::parse(const string &s, const string &n, unsigned i) { source = s; - source_index = i; - parse_source(n); + parse_source(n, i); return *module; } Module &Parser::parse(IO::Base &io, const string &n, unsigned i) { source = string(); - source_index = i; while(!io.eof()) { char buffer[4096]; unsigned len = io.read(buffer, sizeof(buffer)); source.append(buffer, len); } - parse_source(n); + parse_source(n, i); return *module; } -void Parser::parse_source(const string &name) +void Parser::parse_source(const string &name, unsigned index) { delete module; module = new Module; cur_stage = &module->shared; + source_index = index; + module->source_map.set_name(source_index, name); tokenizer.begin(name, source); while(RefPtr statement = parse_global_declaration()) cur_stage->content.body.push_back(statement);