Skip to content

Instantly share code, notes, and snippets.

@fritzo
Last active August 29, 2015 14:05
Show Gist options
  • Save fritzo/c0bf6727ca71a9d3f684 to your computer and use it in GitHub Desktop.
Save fritzo/c0bf6727ca71a9d3f684 to your computer and use it in GitHub Desktop.
Three main ways puddle uses puddle-syntax
// 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