A templating language that looks like Lisp and compiles to HTML
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ast.js 922B

1234567891011121314151617181920212223242526272829303132
  1. const selfClosingTags = require('./util/selfClosingTags')
  2. class Node {
  3. constructor(opts = false) {
  4. if (opts) {
  5. Object.keys(opts).forEach(opt => {
  6. this[opt] = opts[opt]
  7. })
  8. }
  9. }
  10. }
  11. module.exports = {
  12. Application: class Application extends Node {},
  13. Attribute: class Attribute extends Node {},
  14. Boolean: class Boolean extends Node {},
  15. Conditional: class Conditional extends Node {},
  16. Definition: class Definition extends Node {},
  17. HTMLElement: class HTMLElement extends Node {
  18. constructor(opts) {
  19. super(opts)
  20. this.selfClosing = selfClosingTags.includes(opts.name)
  21. }
  22. },
  23. Identifier: class Identifier extends Node {},
  24. Lambda: class Lambda extends Node {},
  25. LetBinding: class LetBinding extends Node {},
  26. List: class List extends Node {},
  27. Number: class Number extends Node {},
  28. String: class String extends Node {},
  29. Symbol: class Symbol extends Node {},
  30. }