Skip to content

Commit

Permalink
JavaScript templates (#46)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander van den Berghe <[email protected]>
  • Loading branch information
mirdono and Alexander van den Berghe authored Oct 20, 2023
1 parent 3b2b209 commit d6c53c6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions templates/javascript.eld
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
js-mode js2-mode

(if "if (" p ") {" n> q n> "}")
(el "if (" p ") {" n> p n> "} else { " n> q n> "}")
(elif "else if (" p ") {" n> q n> "}")
(else "else {" n> q n> "}")
(cop "( " p ") ? " p " : " q";")

(switch "switch (" p ") {" n> "case " p ":" n> p n> "default:" n> q n> "}")
(case "case " p ":" n> q)

(while "while (" p ") {" n> q n> "}")
(dowhile "do {" n> p n> "} while (" q ");")

(for "for (" p "; " p "; " p ") {" n> q n> "}")
(fin "for (" p " in " p ") {" n> q n> "}")
(fof "for (" p " of " p ") {" n> q n> "}")

(func "function " p "(" p ") {" n> q n>"}")
(fexp "let " p " = function(" p ") {" n> q n> "};")

(imp "import {" p "} from \"" q "\";")
(impas "import {" p " as " p "} from \"" q "\";")

0 comments on commit d6c53c6

Please sign in to comment.