183 |
183 |
184 if (!unmatched) |
184 if (!unmatched) |
185 { // Shouldn't happen.. but catch it anyway. |
185 { // Shouldn't happen.. but catch it anyway. |
186 PrimitiveCategory cat; |
186 PrimitiveCategory cat; |
187 cat.setName (g_Other); |
187 cat.setName (g_Other); |
188 unmatched = & (g_PrimitiveCategories << cat); |
188 g_PrimitiveCategories << cat; |
189 } |
189 unmatched = &g_PrimitiveCategories.last(); |
190 |
190 } |
191 for (Primitive & prim : g_primitives) |
191 |
|
192 for (Primitive & prim : g_primitives) |
192 { bool matched = false; |
193 { bool matched = false; |
193 prim.cat = null; |
194 prim.cat = null; |
194 |
195 |
195 // Go over the categories and their regexes, if and when there's a match, |
196 // Go over the categories and their regexes, if and when there's a match, |
196 // the primitive's category is set to the category the regex beloings to. |
197 // the primitive's category is set to the category the regex beloings to. |
197 for (PrimitiveCategory & cat : g_PrimitiveCategories) |
198 for (PrimitiveCategory& cat : g_PrimitiveCategories) |
198 { for (PrimitiveCategory::RegexEntry & entry : cat.regexes) |
199 { for (PrimitiveCategory::RegexEntry& entry : cat.regexes) |
199 { switch (entry.type) |
200 { switch (entry.type) |
200 { case PrimitiveCategory::Filename: |
201 { case PrimitiveCategory::Filename: |
201 // f-regex, check against filename |
202 // f-regex, check against filename |
202 matched = entry.regex.exactMatch (prim.name); |
203 matched = entry.regex.exactMatch (prim.name); |
203 break; |
204 break; |