this follows the estree format
interface Fragment <: Node {
type: "Fragment";
body: [
Component | Tag | Block | Conditional | Iteration |
Expression // Any JS Expression
]
}
#![feature(alloc)] | |
#![feature(heap_api)] | |
extern crate alloc; | |
use alloc::heap::{usable_size}; | |
use std::mem::{align_of, size_of}; | |
use std::str::{from_utf8}; | |
fn print_vec_sizes<T>(v: &Vec<T>) { |
// The data structure of your favorite data structure libary. | |
// Might just be a plain JS Object. Keys are guaranteed to be Strings | |
DataMap = Any | |
// The library should be agnostic to what kind of data library is used, | |
// therefore every kind of data access should go through this interface | |
Data = { | |
// Creates a new Map, optionally with an initial JS object provided | |
create: (Object?) => DataMap, | |
// Used to retrieve a key, for example from the `Context`. |
this follows the estree format
interface Fragment <: Node {
type: "Fragment";
body: [
Component | Tag | Block | Conditional | Iteration |
Expression // Any JS Expression
]
}
The DOM is stupid. It has appendChild
and insertBefore
, but no prependChild
and insertAfter
.
So we should just walk the DOM back to front.
We will deal with fragments. A Fragment can contain a variable number of nodes, 0 or more.
seq()
creates a fragment with 0 or more nodesmatch()
creates a fragment with 0 or 1 nodechildren
creates a fragment with 0 or more nodes// the java way of doing control flow | |
try { | |
init; | |
for (;;) { | |
try { | |
if (!condition) | |
throw new ConditionNotMetExpection(); | |
if (foo) | |
throw new ContinueExpection(); | |
if (bar) |