lapg.tm: simplify
templates.tm: simplify
extract TMResolver
collect namePatterns in TMResolver