css-tree

A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations

node-source-walk

Execute a callback on every node of a source code's AST and stop walking when you see fit