A templating language that looks like Lisp and compiles to HTML
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

12345678910111213141516171819202122232425262728293031323334
  1. const AST = require('./ast')
  2. const core = require('./core')
  3. const OsloError = require('./osloError')
  4. module.exports = class Env {
  5. constructor(parent = null) {
  6. this.data = {}
  7. if (parent) {
  8. Object.keys(parent.data).forEach(key => {
  9. this.data[key] = parent.data[key]
  10. })
  11. } else {
  12. Object.keys(core).forEach(key => {
  13. this.data[key] = core[key]
  14. })
  15. }
  16. }
  17. get(symbol) {
  18. if (this.data[symbol.name]) {
  19. return this.data[symbol.name]
  20. }
  21. return new OsloError({
  22. line: symbol.line,
  23. message: `Symbol '${symbol.name}' is not bound`,
  24. })
  25. }
  26. set(symbol, value) {
  27. this.data[symbol.name] = value
  28. }
  29. }