From a09748efe1de431b3811cf4e3b32d98d5c710e6c Mon Sep 17 00:00:00 2001 From: Darcy Shen Date: Mon, 2 Sep 2024 20:16:49 +0800 Subject: [PATCH] [61_7] Goldfish: add keywords for v17.10.5 --- .../goldfish/progs/code/goldfish-lang.scm | 20 ++---- .../goldfish/progs/code/liii-keyword.scm | 64 +++++++++++++++++++ .../plugins/r7rs/progs/code/srfi-keyword.scm | 18 ++++++ 3 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm diff --git a/TeXmacs/plugins/goldfish/progs/code/goldfish-lang.scm b/TeXmacs/plugins/goldfish/progs/code/goldfish-lang.scm index 30d1b0e2e8..dbcf905c81 100644 --- a/TeXmacs/plugins/goldfish/progs/code/goldfish-lang.scm +++ b/TeXmacs/plugins/goldfish/progs/code/goldfish-lang.scm @@ -14,12 +14,8 @@ (texmacs-module (code goldfish-lang) (:use (prog default-lang) (code r7rs-keyword) - (code srfi-keyword))) - -(define (liii-keywords) - '("==" "!=" "in?" "display*" "list-view" "argv" - "mkdir" "chdir" "rmdir" "getcwd" "listdir" "getenv" "putenv" "unsetenv" - "getlogin" "getpid" "access" "system" "os-linux?" "os-macos?" "os-windows?")) + (code srfi-keyword) + (code liii-keyword))) (tm-define (parser-feature lan key) (:require (and (== lan "goldfish") (== key "identifier"))) @@ -30,7 +26,7 @@ (tm-define (parser-feature lan key) (:require (and (== lan "goldfish") (== key "keyword"))) `(,(string->symbol key) - (extra_chars "?" "+" "-" "." "!" "*" ">" "=" "<" "#") + (extra_chars "?" "+" "-" "." "!" "*" ">" "=" "<" "#" "/") (constant ,@(r7rs-keywords-constant) "pi" "*stdin*" "*stdout*" "*stderr*" @@ -39,10 +35,10 @@ "*missing-close-paren-hook*") (declare_type ,@(r7rs-keywords-define) - "defined?" "define-macro" "define-constant" "autoload" "require" - "provide" "define*" "lambda*" "eval-string" "let1") + ,@(liii-keywords-define)) (keyword - ,@(r7rs-keywords-others) ,@(srfi-1-keywords) ,@(srfi-8-keywords) ,@(srfi-13-keywords) ,@(srfi-60-keywords) ,@(srfi-78-keywords) + ,@(r7rs-keywords-others) ,@(srfi-1-keywords) ,@(srfi-8-keywords) ,@(srfi-13-keywords) ,@(srfi-60-keywords) + ,@(srfi-78-keywords) ,@(srfi-125-keywords) ,@(srfi-133-keywords) ,@(liii-keywords) ; S7 built-ins @@ -60,9 +56,7 @@ "syntax-error" "wrong-type-arg" "immutable-error" "out-of-range" "division-by-zero" "unbound-variable" "read-error" "format-error" "missing-method" "out-of-memory" "bad-result" "no-catch" "wrong-number-of-args" "io-error" "bignum-error" - ; (liii error) - "os-error" "file-not-found-error" "not-a-directory-error" "file-exists-error" "timeout-error" - "type-error" "value-error" "???" "not-implemented-error") + ,@(liii-keywords-error)) (keyword_conditional ,@(r7rs-keywords-branch)) (keyword_control ,@(r7rs-keywords-exception) "catch"))) diff --git a/TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm b/TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm new file mode 100644 index 0000000000..d897f70c11 --- /dev/null +++ b/TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm @@ -0,0 +1,64 @@ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; MODULE : liii-keyword.scm +;; DESCRIPTION : keywords for the Goldfish Scheme Language +;; COPYRIGHT : (C) 2024 Darcy Shen +;; +;; This software falls under the GNU general public license version 3 or later. +;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE +;; in the root directory or . +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(texmacs-module (code liii-keyword)) + +(define (liii-base) + (map symbol->string + '(== != display* in? compose identity))) + +(define (liii-check) + (map symbol->string + '(test check check-set-mode! check-catch check-report + check-failed? check-true check-false))) + +(define (liii-list) + (map symbol->string + '(list-view flatmap list-null? list-not-null? not-null-list?))) + +(define (liii-os) + (map symbol->string + '(os-arch os-type os-windows? os-linux? os-macos? os-temp-dir + os-call system mkdir chdir rmdir getenv unsetenv getcwd + listdir access getlogin getpid))) + +(define (liii-queue) + (map symbol->string + '(queue queue? queue-empty? queue-size queue-front queue-back + queue-pop! queue-push! queue->list))) + +(define (liii-stack) + (map symbol->string + '(stack stack? stack-empty? stack-size stack-top + stack-push! stack-pop! stack->list))) + +(define (liii-sys) + (map symbol->string '(argv))) + +(define (liii-uuid) + (map symbol->string '(uuid4))) + + +(tm-define (liii-keywords) + `(,@(liii-base) ,@(liii-check) ,@(liii-list) ,@(liii-os) ,@(liii-queue) + ,@(liii-stack) ,@(liii-sys) ,@(liii-uuid))) + +(tm-define (liii-keywords-define) + (map symbol->string + '(let1 typed-lambda defined? define-macro define-constant + autoload require provide define* lambda* eval-string case*))) + +(tm-define (liii-keywords-error) + (map symbol->string + '(os-error file-not-found-error not-a-directory-error file-exists-error + timeout-error type-error value-error ??? not-implemented-error))) diff --git a/TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm b/TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm index 6738908620..efcef6cf61 100644 --- a/TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm +++ b/TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm @@ -100,3 +100,21 @@ (list "srfi-78" ; Light-weighted Test framework "check" "check-set-mode!" "check-report" "check-reset!")) + +(tm-define (srfi-125-keywords) + (map symbol->string + '(make-hash-table hash-table hash-table-unfold alist->hash-table + hash-table? hash-table-contains? hash-table-empty? hash-table=? + hash-table-mutable? + hash-table-ref hash-table-ref/default + hash-table-set! hash-table-delete! hash-table-intern! hash-table-update! + hash-table-update!/default hash-table-pop! hash-table-clear! + hash-table-size hash-table-keys hash-table-values hash-table-entries + hash-table-find hash-table-count))) + +(tm-define (srfi-133-keywords) + (map symbol->string + '(vector-empty? vector-count + vector-any vector-every vector-copy vector-copy! + vector-index vector-index-right vector-partition + vector-swap!)))