Change some of the parser's parameter names:
authorChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 03:00:38 +0000 (19:00 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 03:00:38 +0000 (19:00 -0800)
* Rename param:parser-canonicalize-symbols? to param:parser-fold-case?.

* Rename param:parser-enable-file-attributes-parsing? to
  param:parser-enable-attributes?.

* Eliminate unnecessary *parser-enable-file-attributes-parsing?*
  and *parser-keyword-style*.

* Change port properties to eliminate *...* and use new names.

src/edwin/edwin.pkg
src/edwin/schmod.scm
src/runtime/file-attributes.scm
src/runtime/global.scm
src/runtime/parse.scm
src/runtime/runtime.pkg
src/runtime/swank.scm
src/runtime/unpars.scm

index fbb564d043422b86fb5b8ed2f4a47f7ed47de4f2..8883cb21b881ad4c03eae42f10b414d1a5a9c730 100644 (file)
@@ -106,11 +106,10 @@ USA.
   (import (runtime parser)
          (param:parser-associate-positions?
           runtime-param:parser-associate-positions?)
-         (param:parser-canonicalize-symbols?
-          runtime-param:parser-canonicalize-symbols?)
+         (param:parser-fold-case? runtime-param:parser-fold-case?)
          (param:parser-radix runtime-param:parser-radix)
          (param:parser-table runtime-param:parser-table)
-         get-param:parser-canonicalize-symbols?)
+         get-param:parser-fold-case?)
   (import (runtime character)
          bucky-bits->prefix)
   (import (runtime char-syntax)
index 90b77e87fa495f1e3c701198f5b7add81f89b0d9..e8bff1a9d8c4a07c1549594895a07a42ba75137d 100644 (file)
@@ -222,8 +222,7 @@ The following commands evaluate Scheme expressions:
                 (let ((environment (evaluation-environment #f)))
                   (obarray-completions
                    (if (and bound-only?
-                            (get-param:parser-canonicalize-symbols?
-                             environment))
+                            (get-param:parser-fold-case? environment))
                        (string-downcase prefix)
                        prefix)
                    (if bound-only?
index 6a83b35ae28025f693f6a12197beca4f8c552972..acd73f148a5ad77d9ef3c447c4523eb4f8a7b06f 100644 (file)
@@ -123,12 +123,11 @@ This file is part of MIT/GNU Scheme.
   (parameterize* (list (cons param:parser-associate-positions? #f)
                       (cons param:parser-atom-delimiters
                             char-set/file-attributes-atom-delimiters)
-                      (cons param:parser-canonicalize-symbols? #f)
+                      (cons param:parser-fold-case? #f)
                       (cons param:parser-constituents
                             char-set/file-attributes-constituents)
                       ;; no recursion!
-                      (cons param:parser-enable-file-attributes-parsing?
-                            #f)
+                      (cons param:parser-enable-attributes? #f)
                       (cons param:parser-keyword-style #f)
                       (cons param:parser-radix 10)
                       (cons param:parser-table file-attributes-parser-table))
@@ -137,8 +136,6 @@ This file is part of MIT/GNU Scheme.
                  (*parser-atom-delimiters* #!default)
                  (*parser-canonicalize-symbols?* #!default)
                  (*parser-constituents* #!default)
-                 (*parser-enable-file-attributes-parsing?* #!default)
-                 (*parser-keyword-style* #!default)
                  (*parser-radix* #!default)
                  (*parser-table* #!default))
        (parse port system-global-environment)))))
@@ -148,10 +145,10 @@ This file is part of MIT/GNU Scheme.
   (parameterize* (list (cons param:parser-associate-positions? #f)
                       (cons param:parser-atom-delimiters
                             char-set/atom-delimiters)
-                      (cons param:parser-canonicalize-symbols? #f)
+                      (cons param:parser-fold-case? #f)
                       (cons param:parser-constituents char-set/constituents)
                       ;; no recursion!
-                      (cons param:parser-enable-file-attributes-parsing? #f)
+                      (cons param:parser-enable-attributes? #f)
                       ;; enable prefix keywords
                       (cons param:parser-keyword-style 'prefix)
                       (cons param:parser-radix 10)
@@ -161,8 +158,6 @@ This file is part of MIT/GNU Scheme.
                  (*parser-atom-delimiters* #!default)
                  (*parser-canonicalize-symbols?* #!default)
                  (*parser-constituents* #!default)
-                 (*parser-enable-file-attributes-parsing?* #!default)
-                 (*parser-keyword-style* #!default)
                  (*parser-radix* #!default)
                  (*parser-table* #!default))
        (parse port system-global-environment)))))
index ad3c1002963701fd362a4b59d2acee4840dfc9f1..1e32ddf14e8fd455c3eaca89407cedc831109b66 100644 (file)
@@ -278,8 +278,8 @@ USA.
   ((ucode-primitive unbind-variable 2) (->environment environment) name))
 
 (define (simple-top-level-environment fold-case?)
-  (make-top-level-environment '(param:parser-canonicalize-symbols?
-                               *parser-canonicalize-symbols?*)
+  (make-top-level-environment (list 'param:parser-fold-case?
+                                   '*parser-canonicalize-symbols?*)
                              (list (make-settable-parameter fold-case?)
                                    #!default)))
 \f
index 3618cde8988d0dc82001a4807349491296cfbfdc..b4a9e7e4968b2fdc87cc1ce92c958c29691b48be 100644 (file)
@@ -27,46 +27,44 @@ USA.
 ;;;; Scheme Parser
 ;;; package: (runtime parser)
 
-(declare (usual-integrations)
-        (integrate-external "input")
-        (integrate-external "port"))
+(declare (usual-integrations))
 \f
 (define *parser-associate-positions?* #!default)
 (define *parser-atom-delimiters* #!default)
 (define *parser-canonicalize-symbols?* #!default)
 (define *parser-constituents* #!default)
-(define *parser-enable-file-attributes-parsing?* #!default)
-(define *parser-keyword-style* #!default)
 (define *parser-radix* #!default)
 (define *parser-table* #!default)
 
 (define param:parser-associate-positions?)
 (define param:parser-atom-delimiters)
-(define param:parser-canonicalize-symbols?)
+(define param:parser-enable-attributes?)
+(define param:parser-fold-case?)
 (define param:parser-constituents)
-(define param:parser-enable-file-attributes-parsing?)
 (define param:parser-keyword-style)
 (define param:parser-radix)
 (define param:parser-table)
 
 (define runtime-param:parser-associate-positions?)
 (define runtime-param:parser-atom-delimiters)
-(define runtime-param:parser-canonicalize-symbols?)
+(define runtime-param:parser-enable-attributes?)
+(define runtime-param:parser-fold-case?)
 (define runtime-param:parser-constituents)
-(define runtime-param:parser-enable-file-attributes-parsing?)
 (define runtime-param:parser-keyword-style)
 (define runtime-param:parser-radix)
 (define runtime-param:parser-table)
 
 (define ignore-extra-list-closes #t)
 
-(define (param-getter fluid-name param-name)
+(define (param-getter param-name #!optional fluid-name)
   (lambda (environment)
-    (let ((fluid (repl-environment-value environment fluid-name))
-         (param (repl-environment-value environment param-name)))
-      (if (default-object? fluid)
+    (let ((param (repl-environment-value environment param-name)))
+      (if (default-object? fluid-name)
          (param)
-         ((parameter-converter param) fluid)))))
+         (let ((fluid (repl-environment-value environment fluid-name)))
+           (if (default-object? fluid)
+               (param)
+               ((parameter-converter param) fluid)))))))
 
 (define (repl-environment-value environment name)
   (environment-lookup-or environment name
@@ -76,36 +74,29 @@ USA.
          (environment-lookup environment name))))))
 
 (define get-param:parser-associate-positions?
-  (param-getter '*parser-associate-positions?*
-               'param:parser-associate-positions?))
+  (param-getter 'param:parser-associate-positions?
+               '*parser-associate-positions?*))
 
 (define get-param:parser-atom-delimiters
-  (param-getter '*parser-atom-delimiters*
-               'param:parser-atom-delimiters))
+  (param-getter 'param:parser-atom-delimiters '*parser-atom-delimiters*))
 
-(define get-param:parser-canonicalize-symbols?
-  (param-getter '*parser-canonicalize-symbols?*
-               'param:parser-canonicalize-symbols?))
+(define get-param:parser-fold-case?
+  (param-getter 'param:parser-fold-case? '*parser-canonicalize-symbols?*))
 
 (define get-param:parser-constituents
-  (param-getter '*parser-constituents*
-               'param:parser-constituents))
+  (param-getter 'param:parser-constituents '*parser-constituents*))
 
-(define get-param:parser-enable-file-attributes-parsing?
-  (param-getter '*parser-enable-file-attributes-parsing?*
-               'param:parser-enable-file-attributes-parsing?))
+(define get-param:parser-enable-attributes?
+  (param-getter 'param:parser-enable-attributes?))
 
 (define get-param:parser-keyword-style
-  (param-getter '*parser-keyword-style*
-               'param:parser-keyword-style))
+  (param-getter 'param:parser-keyword-style))
 
 (define get-param:parser-radix
-  (param-getter '*parser-radix*
-               'param:parser-radix))
+  (param-getter 'param:parser-radix '*parser-radix*))
 
 (define get-param:parser-table
-  (param-getter '*parser-table*
-               'param:parser-table))
+  (param-getter 'param:parser-table '*parser-table*))
 \f
 (define (parse-object port environment)
   ((top-level-parser port) port environment))
@@ -212,13 +203,13 @@ USA.
   (set! param:parser-atom-delimiters
        (make-unsettable-parameter char-set/atom-delimiters
                                   char-set-converter))
-  (set! param:parser-canonicalize-symbols?
+  (set! param:parser-fold-case?
        (make-unsettable-parameter #t
                                   boolean-converter))
   (set! param:parser-constituents
        (make-unsettable-parameter char-set/constituents
                                   char-set-converter))
-  (set! param:parser-enable-file-attributes-parsing?
+  (set! param:parser-enable-attributes?
        (make-unsettable-parameter #t
                                   boolean-converter))
   (set! param:parser-keyword-style
@@ -235,12 +226,12 @@ USA.
        (copy-parameter param:parser-associate-positions?))
   (set! runtime-param:parser-atom-delimiters
        (copy-parameter param:parser-atom-delimiters))
-  (set! runtime-param:parser-canonicalize-symbols?
-       (copy-parameter param:parser-canonicalize-symbols?))
+  (set! runtime-param:parser-fold-case?
+       (copy-parameter param:parser-fold-case?))
   (set! runtime-param:parser-constituents
        (copy-parameter param:parser-constituents))
-  (set! runtime-param:parser-enable-file-attributes-parsing?
-       (copy-parameter param:parser-enable-file-attributes-parsing?))
+  (set! runtime-param:parser-enable-attributes?
+       (copy-parameter param:parser-enable-attributes?))
   (set! runtime-param:parser-keyword-style
        (copy-parameter param:parser-keyword-style))
   (set! runtime-param:parser-radix
@@ -530,7 +521,7 @@ USA.
 (define (parse-atom-1 port db prefix quoting?)
   (let ((port* (open-output-string))
        (%canon
-        (if (db-canonicalize-symbols? db)
+        (if (db-fold-case? db)
             char-downcase
             (lambda (char) char)))
        (atom-delimiters (db-atom-delimiters db))
@@ -942,7 +933,7 @@ USA.
 (define-structure db
   (associate-positions? #f read-only #t)
   (atom-delimiters #f read-only #t)
-  (canonicalize-symbols? #f read-only #t)
+  (fold-case? #f read-only #t)
   (constituents #f read-only #t)
   (enable-file-attributes-parsing #f read-only #t)
   (keyword-style #f read-only #t)
@@ -971,14 +962,13 @@ USA.
     (guarantee char-set? constituents #f)
     (make-db (get-param:parser-associate-positions? environment)
             atom-delimiters
-            (overridable-value
-             port '*PARSER-CANONICALIZE-SYMBOLS?*
-             (get-param:parser-canonicalize-symbols? environment))
+            (port-property port 'parser-fold-case?
+                           (get-param:parser-fold-case? environment))
             constituents
-            (overridable-value
-             port '*PARSER-ENABLE-FILE-ATTRIBUTES-PARSING?*
-             (get-param:parser-enable-file-attributes-parsing? environment))
-            (overridable-value port '*PARSER-KEYWORD-STYLE*
+            (port-property
+             port 'parser-enable-file-attributes?
+             (get-param:parser-enable-attributes? environment))
+            (port-property port 'parser-keyword-style
                                (get-param:parser-keyword-style environment))
             (get-param:parser-radix environment)
             (get-param:parser-table environment)
@@ -990,15 +980,6 @@ USA.
             (port/operation port 'READ-CHAR)
             '())))
 
-(define (overridable-value port name default-value)
-  ;; Check the port property list for the name, and then the
-  ;; environment.  This way a port can override the default.
-  (let* ((nope "no-overridden-value")
-        (v (port-property port name nope)))
-    (if (eq? v nope)
-       default-value
-       v)))
-
 (define (position-operation port environment)
   (let ((default (lambda (port) port #f)))
     (if (get-param:parser-associate-positions? environment)
@@ -1030,9 +1011,7 @@ USA.
   (if file-attribute-alist
       (begin
        ;; Disable further attributes parsing.
-       (set-port-property! port
-                           '*PARSER-ENABLE-FILE-ATTRIBUTES-PARSING?*
-                           #f)
+       (set-port-property! port 'parser-enable-file-attributes? #f)
        (process-keyword-attribute file-attribute-alist port)
        (process-mode-attribute file-attribute-alist port)
        (process-studly-case-attribute file-attribute-alist port))))
@@ -1051,13 +1030,13 @@ USA.
          (cond ((and (symbol? value)
                      (or (string-ci=? (symbol-name value) "none")
                          (string-ci=? (symbol-name value) "false")))
-                (set-port-property! port '*PARSER-KEYWORD-STYLE* #f))
+                (set-port-property! port 'parser-keyword-style #f))
                ((and (symbol? value)
                      (string-ci=? (symbol-name value) "prefix"))
-                (set-port-property! port '*PARSER-KEYWORD-STYLE* 'PREFIX))
+                (set-port-property! port 'parser-keyword-style 'prefix))
                ((and (symbol? value)
                      (string-ci=? (symbol-name value) "suffix"))
-                (set-port-property! port '*PARSER-KEYWORD-STYLE* 'SUFFIX))
+                (set-port-property! port 'parser-keyword-style 'suffix))
                (else
                 (warn "Unrecognized value for keyword-style" value)))))))
 
@@ -1096,13 +1075,13 @@ USA.
                        (warn "Attribute value mismatch.  Expected True.")
                        #f)
                       (else
-                       (set-port-property! port '*PARSER-CANONICALIZE-SYMBOLS?*
-                                           #f))))
+                       (set-port-property! port 'parser-fold-case? #f))))
                ((or (not value)
                     (and (symbol? value)
                          (string-ci=? (symbol-name value) "false")))
-                (set-port-property! port '*PARSER-CANONICALIZE-SYMBOLS?* #t))
-               (else (warn "Unrecognized value for sTuDly-case" value)))))))
+                (set-port-property! port 'parser-fold-case? #t))
+               (else
+                (warn "Unrecognized value for sTuDly-case" value)))))))
 \f
 (define-syntax define-parse-error
   (sc-macro-transformer
index 40ba8e67a84ab56f997bf46bff57361d7a552220..826dd1ce4a1fbedde55de8b82b923dded73e6c9b 100644 (file)
@@ -3481,21 +3481,20 @@ USA.
   (parent (runtime))
   (export ()
          ;; BEGIN deprecated bindings
+         (param:parser-canonicalize-symbols? param:parser-fold-case?)
          *parser-associate-positions?*
          *parser-atom-delimiters*
          *parser-canonicalize-symbols?*
          *parser-constituents*
-         *parser-enable-file-attributes-parsing?*
-         *parser-keyword-style*
          *parser-radix*
          *parser-table*
          ;; END deprecated bindings
          define-bracketed-object-parser-method
          param:parser-associate-positions?
          param:parser-atom-delimiters
-         param:parser-canonicalize-symbols?
+         param:parser-enable-attributes?
          param:parser-constituents
-         param:parser-enable-file-attributes-parsing?
+         param:parser-fold-case?
          param:parser-keyword-style
          param:parser-radix
          param:parser-table
@@ -3506,23 +3505,22 @@ USA.
          (param:parser-associate-positions?
           runtime-param:parser-associate-positions?)
          (param:parser-atom-delimiters runtime-param:parser-atom-delimiters)
-         (param:parser-canonicalize-symbols?
-          runtime-param:parser-canonicalize-symbols?)
+         (param:parser-fold-case? runtime-param:parser-fold-case?)
          (param:parser-constituents runtime-param:parser-constituents)
-         (param:parser-enable-file-attributes-parsing?
-          runtime-param:parser-enable-file-attributes-parsing?)
+         (param:parser-enable-attributes?
+          runtime-param:parser-enable-attributes?)
          (param:parser-keyword-style runtime-param:parser-keyword-style)
          (param:parser-radix runtime-param:parser-radix)
          (param:parser-table runtime-param:parser-table))
   (export (runtime character)
          char-set/atom-delimiters)
   (export (runtime swank)
-         get-param:parser-canonicalize-symbols?)
+         get-param:parser-fold-case?)
   (export (runtime unparser)
          char-set/atom-delimiters
          char-set/number-leaders
          char-set/symbol-quotes
-         get-param:parser-canonicalize-symbols?
+         get-param:parser-fold-case?
          get-param:parser-keyword-style
          repl-environment-value)
   (initialization (initialize-package!)))
index 7a1b39ed57c943975c9a77d686f81ba772c8899a..d0a12989d250f06aab84ce5e1a15a9e4bb799af4 100644 (file)
@@ -830,7 +830,7 @@ swank:xref
 
 (define (all-completions prefix environment)
   (let ((prefix
-        (if (get-param:parser-canonicalize-symbols? environment)
+        (if (get-param:parser-fold-case? environment)
             (string-downcase prefix)
             prefix))
        (completions '()))
index 85d8b34ea8f9f6ccded19f4fba2ba58e6082ebf0..9d299051463595ea966b0ec808eacbd1e23112fe 100644 (file)
@@ -493,7 +493,7 @@ USA.
 (define (unparse-symbol-name s)
   (if (or (ustring-find-first-char-in-set
            s
-           (if (get-param:parser-canonicalize-symbols? (param:environment))
+           (if (get-param:parser-fold-case? (param:environment))
                canon-symbol-quoted
                non-canon-symbol-quoted))
           (fix:= (ustring-length s) 0)