Compare commits
3 Commits
0cbae4ce61
...
9584a21521
Author | SHA1 | Date | |
---|---|---|---|
|
9584a21521 | ||
|
c61981fa16 | ||
|
0583af819f |
Binary file not shown.
|
@ -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'] = 1804032;
|
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1803120;
|
||||||
function invoke_i(index) {
|
function invoke_i(index) {
|
||||||
var sp = stackSave();
|
var sp = stackSave();
|
||||||
try {
|
try {
|
||||||
|
|
BIN
build/out.wasm
BIN
build/out.wasm
Binary file not shown.
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.13",
|
"version": "0.1.14",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.13",
|
"version": "0.1.14",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"shadow-cljs": "^2.26.0",
|
"shadow-cljs": "^2.26.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.13",
|
"version": "0.1.14",
|
||||||
"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",
|
||||||
|
|
|
@ -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 `
|
||||||
words ("foo bar")
|
"foo \bbar"
|
||||||
`)
|
`)
|
||||||
(def out (-> source
|
(def out (-> source
|
||||||
ludus
|
ludus
|
||||||
|
|
|
@ -194,6 +194,15 @@
|
||||||
: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?]
|
||||||
|
@ -204,12 +213,10 @@
|
||||||
"\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)]
|
||||||
(if (= next "{")
|
(recur
|
||||||
(do
|
(advance (advance scanner))
|
||||||
(buffer/push buff char)
|
(buffer/push buff (get escape next next))
|
||||||
(buffer/push buff next)
|
interpolate?))
|
||||||
(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?)))))
|
||||||
|
@ -341,8 +348,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)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user