test.coffee 609 B

12345678910111213141516171819202122232425262728
  1. narcissus = require './src/documents/lib/narcissus_packed'
  2. code = """
  3. foo = 'bar';
  4. """
  5. main = (scope) ->
  6. ast = narcissus.parser.parse code
  7. console.log ">>>>>> children(#{ast.children.length}): ", ast.children
  8. console.log ">>>>>> child 0 expression: ", ast.children[0].expression
  9. # toplevel = null
  10. # toplevel = UglifyJS.parse code, {
  11. # toplevel: toplevel
  12. # }
  13. # if scope
  14. # toplevel.figure_out_scope()
  15. # console.log toplevel
  16. if require.main is module
  17. param = process.argv[2]
  18. if param is 'scope'
  19. main true
  20. else
  21. main false