Last active
August 29, 2015 14:05
-
-
Save fritzo/c0bf6727ca71a9d3f684 to your computer and use it in GitHub Desktop.
Three main ways puddle uses puddle-syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. render a line from the corpus | |
var line = ...from corpus... | |
var term = syntax.compiler.load(line); | |
var renderableTerm = syntax.compiler.parenthesize(term); | |
...render renderableTerm via angular... | |
// 2. move the cursor to a line | |
var cursor = ...global... | |
var line = ...from corpus... | |
var term = syntax.compiler.load(line); | |
var node = syntax.tree.load(term); | |
syntax.cursor.remove(cursor); | |
syntax.cursor.insertAbove(cursor, node); | |
// 3. render uncommitted line at cursor | |
var cursor = ...global... | |
var node = syntax.cursor.getRoot(cursor); | |
var term = syntax.tree.dump(node); | |
var renderableTerm = syntax.compiler.parenthesize(term); | |
...render renderableTerm via angular... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment