Unlike many pieces of software, we like our users to understand what their programs are doing behind the scenes.
Eta uses Regular Expressions to turn a template into a function which can be called with a specific set of options. Since all of the parsing is done beforehand, the function (called a "Precompiled" function) just does string interpolation and is incredibly fast.
- Eta uses a big RegExp with inline tokenization to parse the template by looping through each valid tag (ex.
<%...%>) in the template. It creates a simple syntax tree which it passes to
- During compilation, Eta creates a function string from the syntax tree, then uses
Functionto bring it to life.
- This explanation is really lacking. Just read the source code :)