diff --git a/TODO b/TODO --- a/TODO +++ b/TODO @@ -1,12 +1,14 @@ -* Duplicate label error (in the parser) -* Reporting error lines in the parser * MENU with async/await * Special locations * Special variables * CLI build for Linux * CLI build for Windows -* Storing error lines in the parser to report it in runtime errors + +* Reporting error lines in the parser +* Report duplicate label (in the parser) +* reporting error lines at runtime (by storing them in every form in the parser +* Report JUMP with missing label (in tagbody) * Build Istreblenie * Windows GUI (for the compiler) diff --git a/examples/txt2gam-game.txt b/examples/txt2gam-game.txt --- a/examples/txt2gam-game.txt +++ b/examples/txt2gam-game.txt @@ -14,7 +14,8 @@ ACT 'Идти домой':GOTO 'Дом' ACT 'Идти в магазин':GOTO 'Магазин' ACT 'Перенести ящик': Ящик = Ящик + 1 - IF Ящик = 3: + WAIT 500 + IF Ящик = 3: Деньги = Деньги + 5 Ящик = 0 END diff --git a/extras/default.css b/extras/default.css --- a/extras/default.css +++ b/extras/default.css @@ -112,3 +112,10 @@ justify-content: center; align-items: center; } + +/* misc */ + +.disable a { + pointer-events: none; + cursor: default; +} diff --git a/src/api.ps b/src/api.ps --- a/src/api.ps +++ b/src/api.ps @@ -22,8 +22,23 @@ (defun report-error (text) (alert text)) +(defun start-sleeping () + (chain (by-id "qsp") class-list (add "disable")) + (setf (root sleeping) t)) + +(defun finish-sleeping () + (chain (by-id "qsp") class-list (remove "disable")) + (setf (root sleeping) nil)) + (defun sleep (msec) - (new (*promise (=> resolve (set-timeout resolve msec))))) + (start-sleeping) + (new (*promise + (lambda (resolve) + (set-timeout + (lambda () + (finish-sleeping) + (resolve)) + msec))))) (defun init-dom () ;; Save/load buttons @@ -95,8 +110,9 @@ (funcall (getprop (root locs) name) args)))) (defun call-act (title) - (with-frame - (funcall (getprop (root acts) title 'act)))) + (unless (root sleeping) + (with-frame + (funcall (getprop (root acts) title 'act))))) ;;; Text windows diff --git a/src/js-syms.lisp b/src/js-syms.lisp --- a/src/js-syms.lisp +++ b/src/js-syms.lisp @@ -27,7 +27,8 @@ href parse set-prototype-of body append-child remove-child - create-element set-attribute + add ; remove (is already in COMMON-LISP) + create-element set-attribute class-list *file-reader read-as-text style display src ;; lib diff --git a/src/patches.lisp b/src/patches.lisp --- a/src/patches.lisp +++ b/src/patches.lisp @@ -7,7 +7,7 @@ (psw (string-downcase "await ")) (print-op-argument 'ps-js::await x)) -(define-trivial-special-ops await) +(define-trivial-special-ops await ps-js::await) (define-statement-operator async-defun (name lambda-list &rest body) (multiple-value-bind (effective-args body-block docstring)