aboutsummaryrefslogtreecommitdiffstats
path: root/simetrix.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:06:40 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:06:40 -0800
commita69c9fb665459e2bfdbda1bf80741a0af31a7faf (patch)
treef0bc974f8805049e6b9a4e6864886298fbaa05a4 /simetrix.scm
parent4684239efa63dc1b2c1cbe37ef7d3062029f5532 (diff)
downloadslib-a69c9fb665459e2bfdbda1bf80741a0af31a7faf.tar.gz
slib-a69c9fb665459e2bfdbda1bf80741a0af31a7faf.zip
New upstream version 3b5upstream/3b5upstream
Diffstat (limited to 'simetrix.scm')
-rwxr-xr-x[-rw-r--r--]simetrix.scm17
1 files changed, 9 insertions, 8 deletions
diff --git a/simetrix.scm b/simetrix.scm
index e066daf..5d4a93a 100644..100755
--- a/simetrix.scm
+++ b/simetrix.scm
@@ -19,7 +19,7 @@
;; Implements "Representation of numerical values and SI units in
;; character strings for information interchanges"
-;; http://swiss.csail.mit.edu/~jaffer/MIXF
+;; http://people.csail.mit.edu/jaffer/MIXF
(require 'precedence-parse)
(require 'string-port)
@@ -196,7 +196,7 @@
(define (SI:expand-equivalence str)
(call-with-input-string
str (lambda (sport)
- (define result (prec:parse SI:grammar 'EOS sport))
+ (define result (prec:parse SI:grammar 'EOS 0 sport))
(cond ((eof-object? result) (list (cons 1 0)))
((symbol? result) (SI:expand-unit result))
(else result)))))
@@ -226,16 +226,17 @@
;;; Definitions accumulate in top-level variable *SYN-DEFS*.
;;(trace-all (in-vicinity (program-vicinity) "simetrix.scm"))
+(define (list2string dyn lst) (list->string lst))
;;; Character classes
-(prec:define-grammar (tok:char-group 70 #\^ list->string))
-(prec:define-grammar (tok:char-group 49 #\. list->string))
-(prec:define-grammar (tok:char-group 50 #\/ list->string))
-(prec:define-grammar (tok:char-group 51 #\- list->string))
+(prec:define-grammar (tok:char-group 70 #\^ list2string))
+(prec:define-grammar (tok:char-group 49 #\. list2string))
+(prec:define-grammar (tok:char-group 50 #\/ list2string))
+(prec:define-grammar (tok:char-group 51 #\- list2string))
(prec:define-grammar (tok:char-group 40 tok:decimal-digits
- (lambda (l) (string->number (list->string l)))))
+ (lambda (dyn l) (string->number (list->string l)))))
(prec:define-grammar (tok:char-group 44
(string-append tok:upper-case tok:lower-case "@_")
- list->string))
+ list2string))
(prec:define-grammar (prec:prefix '- SI:minus 130))
(prec:define-grammar (prec:infix "." SI:dot 120 120))