parseDeclarations
parseDeclarations(
declaration: string,
arena?: AstArena,
): { arena: AstArena; nodes: number[] }
Parameters
declaration: stringOptionalarena: AstArenaExample:
const {arena, nodes} = parseDeclarations('color: red; background: blue');
console.log(nodes.map((node) => arena.toObject(node)));
Returns { arena: AstArena; nodes: number[] }
-
arena: AstArena
the arena the nodes are allocated in
-
nodes: number[]
the declaration and comment nodes
Parse a string as an array of declaration nodes. The nodes are allocated in the given arena, or in a new arena when none is provided