Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson
Created November 21, 2012 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdickinson/a05f3ce9ef8573094062 to your computer and use it in GitHub Desktop.
Save chrisdickinson/a05f3ce9ef8573094062 to your computer and use it in GitHub Desktop.
var lang = require('cssauron')({
tag: function(node) { return node.type }
, contents: function(node) { return node.data }
, id: function(node) { return 'line_'+node.token.line }
, attr: function(node) { return node[attr] }
, parent: function(node) { return node.parent }
, children: function(node) { return node.children }
, class: function(node) { throw new Error('classes not supported') }
})
var selector = lang('stmtlist > stmt > decl')
selector(some_ast_node) // true or false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment