Refactor Template.parse()

Split out Template.parse() as a separate function. This saves an expensive
method call to self.functions() for every potential intrinsic function in
the template, plus makes a template parsing routine available to other
parts of the code that may want to use it, without being tied to a
Template's ideas of what the intrinsic functions available are.

Change-Id: I1d4b847967357dbe5c9960223a063377aec50e5d
Merge "Refactor Template.parse()"