Compare commits

..

No commits in common. "9584a215211f1c17485e100e0fafdccc721cb8e8" and "0cbae4ce618d93c8a313c9f568abd93bbc3d5078" have entirely different histories.

7 changed files with 15 additions and 22 deletions

Binary file not shown.

View File

@ -6489,7 +6489,7 @@ var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])(); var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1); var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1);
var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5); var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5);
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1803120; var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1804032;
function invoke_i(index) { function invoke_i(index) {
var sp = stackSave(); var sp = stackSave();
try { try {

Binary file not shown.

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.13",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.13",
"license": "GPL-3.0", "license": "GPL-3.0",
"devDependencies": { "devDependencies": {
"shadow-cljs": "^2.26.0", "shadow-cljs": "^2.26.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.13",
"description": "A Ludus interpreter in a pure JS function.", "description": "A Ludus interpreter in a pure JS function.",
"type": "module", "type": "module",
"main": "build/ludus.mjs", "main": "build/ludus.mjs",

View File

@ -49,10 +49,10 @@
(set (out :draw) (post :draw)) (set (out :draw) (post :draw))
(-> out j/encode string)) (-> out j/encode string))
# (comment (comment
(do # (do
(def source ` (def source `
"foo \bbar" words ("foo bar")
`) `)
(def out (-> source (def out (-> source
ludus ludus

View File

@ -194,15 +194,6 @@
:else (add-error scanner (string "Unexpected " curr " after number " num "."))))) :else (add-error scanner (string "Unexpected " curr " after number " num ".")))))
(recur scanner (buffer char) false)) (recur scanner (buffer char) false))
(def escape {
"\"" "\""
"n" "\n"
"{" "{"
"t" "\t"
"r" "\r"
"\\" "\\"
})
(defn- add-string (defn- add-string
[scanner] [scanner]
(defn recur [scanner buff interpolate?] (defn recur [scanner buff interpolate?]
@ -213,10 +204,12 @@
"\n" (recur (update (advance scanner) :line inc) (buffer/push buff char) interpolate?) "\n" (recur (update (advance scanner) :line inc) (buffer/push buff char) interpolate?)
"\"" (add-token (advance scanner) (if interpolate? :interpolated :string) (string buff)) "\"" (add-token (advance scanner) (if interpolate? :interpolated :string) (string buff))
"\\" (let [next (next-char scanner)] "\\" (let [next (next-char scanner)]
(recur (if (= next "{")
(advance (advance scanner)) (do
(buffer/push buff (get escape next next)) (buffer/push buff char)
interpolate?)) (buffer/push buff next)
(recur (advance (advance scanner)) buff interpolate?))
(recur (advance scanner) (buffer/push buff char) interpolate?)))
(if (at-end? scanner) (if (at-end? scanner)
(add-error scanner "Unterminated string.") (add-error scanner "Unterminated string.")
(recur (advance scanner) (buffer/push buff char) interpolate?))))) (recur (advance scanner) (buffer/push buff char) interpolate?)))))
@ -348,8 +341,8 @@
(recur (-> scanner (scan-token) (next-token))))) (recur (-> scanner (scan-token) (next-token)))))
(recur (new-scanner source input))) (recur (new-scanner source input)))
(comment # (comment
# (do (do
(def source "/iii") (def source "/iii")
(scan source) (scan source)
) )