X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fparser.cpp;h=4e8ff97aa894864632fcb47e044b3102d04b9f70;hp=e2a6e1fb6c8dc65664cecd819e527995c7fb119a;hb=3fe1aab63922eec99d8bf6fd4fd60bec10df173c;hpb=a159fe302af38ab3880c11317e382d1b04d80ace diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index e2a6e1fb..4e8ff97a 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -58,16 +58,8 @@ void Parser::parse_source(const string &name, int index) if(const Stage *builtin = get_builtins(Stage::SHARED)) { - for(map::const_iterator i=builtin->types.begin(); i!=builtin->types.end(); ++i) - global_types.insert(i->first); - } - else - { - global_types.insert("void"); - global_types.insert("bool"); - global_types.insert("int"); - global_types.insert("uint"); - global_types.insert("float"); + for(const auto &kvp: builtin->types) + global_types.insert(kvp.first); } tokenizer.begin(source, name); @@ -107,13 +99,13 @@ void Parser::stage_change(Stage::Type stage) cur_stage = &module->stages.back(); stage_types.clear(); - for(vector::const_iterator i=imported_modules.begin(); i!=imported_modules.end(); ++i) + for(const Module *m: imported_modules) { - list::const_iterator j = find_member((*i)->stages, stage, &Stage::type); - if(j!=(*i)->stages.end()) + auto j = find_member(m->stages, stage, &Stage::type); + if(j!=m->stages.end()) { - for(map::const_iterator k=j->types.begin(); k!=j->types.end(); ++k) - stage_types.insert(k->first); + for(const auto &kvp: j->types) + stage_types.insert(kvp.first); } } } @@ -202,7 +194,7 @@ bool Parser::is_type(const string &token) bool Parser::is_identifier(const string &token) { static Regex re("^[a-zA-Z_][a-zA-Z0-9_]*$"); - return re.match(token); + return static_cast(re.match(token)); } template @@ -377,8 +369,8 @@ RefPtr Parser::parse_import() { const Module &imported_mod = mod_cache->get_module(import->module); imported_modules.push_back(&imported_mod); - for(map::const_iterator i=imported_mod.shared.types.begin(); i!=imported_mod.shared.types.end(); ++i) - global_types.insert(i->first); + for(const auto &kvp: imported_mod.shared.types) + global_types.insert(kvp.first); } return import;