They are copied from Twig for the most part; I'm not sure what the proper attribution should be, so I haven't changed it yet.