machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

Refactoring PEGjs files into smaller units #271

Closed thec0keman closed 8 years ago

thec0keman commented 8 years ago

This refactor breaks up the PEGjs files into many smaller units. It is a fairly substantial refactor, however I tried to minimize logic changes and renaming in order to preserve some continuity with the prior code.

The goal of this was:

1 make the logic easier to understand.

2 provide a good first step to adding angle-bracket support by abstracting some reusable elements.

This does come with a small penalty to build speed and file size since effectively a lot of code is duplicated at build time.

My approach was to first do several passes on the code trying to break it into smaller pieces. Then, the minimal amount of code was pushed up to the top level to prevent circular dependencies. The effect was that the top level file ends up being a good high level picture of the logic path, and is only 1/3 the LOC.

There is a lot more that could be done, especially in renaming and documentation. However, I wanted to push this up for some feedback to make sure this is heading in the right direction.

Also included are fixes for:

And this is based off of #270.