Skip to content

Commit 75b4470

Browse files
committed
versions 10.5
1 parent 8296e4a commit 75b4470

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Scheme-PLUS-for-Racket
22
Scheme+ for DrRacket by Damien Mattei.
33

4-
Install as a package with the [package manager](https://pkgs.racket-lang.org/package/Scheme-PLUS-for-Racket) or from source code.
4+
Install as a package with the [package manager](https://pkgs.racket-lang.org/package/Scheme-PLUS-for-Racket) (could be a 24 hours delay from github.com to pkgs.racket-lang.org) or from Github source code.
55

66
The documentation is here, but is outdated:
77
https://github.com/damien-mattei/Scheme-PLUS-for-Racket/blob/gh-pages/README.md
@@ -26,6 +26,12 @@ Again you will have all the information about errors with the true line number d
2626
Another method is to use the [Makefile](https://github.com/damien-mattei/Scheme-PLUS-for-Racket/blob/main/examples/racket/Makefile) provided (see docs).
2727

2828

29+
**Changes of version 10.5:**
30+
31+
Correct some typos about assignment operators.(strangely a line was commented)
32+
33+
Check that infix code is correct before parsing it to prefix.(previously some wrong code could have been truncated by the parser to the most great valid expression)
34+
2935

3036
**Changes of version 10.4:**
3137

infix-prefix.rkt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
(provide infix-prefix-test?
8282
infix?
8383
prefix?
84-
simple-infix-list-syntax?)
84+
simple-infix-list-syntax?
85+
infix-canonical?)
8586

8687
(require Scheme+/operators
8788
Scheme+/superscript
@@ -235,6 +236,32 @@
235236

236237

237238

239+
;; this procedure check that we have a canonical infix expression
240+
;; i call 'canonical' an expression such as 3 * 5 + 2
241+
;; in contrary an equivalent expression such as this one: - - 3 * 5 + 2 is not 'canonical',etc
242+
;; conditions to be 'canonical' will be to have :
243+
;; * at least 3 terms in expression
244+
;; * odd number of terms
245+
;; * operators between terms
246+
247+
;;{2 * 3 4}
248+
;;($nfx$ 2 * 3 4)
249+
;;. . ../infix-with-precedence-to-prefix.rkt:452:14: infix-with-precedence-to-prefix.rkt : !*prec-generic-infix-parser : not a canonical infix expression: '(#<syntax 2> #<syntax *> #<syntax 3> #<syntax 4>)
250+
(def (infix-canonical? L)
251+
;;(display "infix-canonical? : L =")(display L)(newline)
252+
(define lgt (length L))
253+
;;(display "infix-canonical? : lgt =")(display lgt)(newline)
254+
(when (or (< lgt 3)
255+
(not (odd? lgt)))
256+
(return #f))
257+
(def (check-operators? L2)
258+
;;(display "check-operators? : L2=")(display L2)(newline)
259+
(when (null? L2)
260+
(return #t))
261+
(if (not (operator-syntax? (car L2)))
262+
#f
263+
(check-operators? (cddr L2))))
264+
(check-operators? (cdr L)))
238265

239266

240267
;; procedures shared with SRFI 105

infix-with-precedence-to-prefix.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@
447447
;; we can check for expressions like 2<3<=3 here
448448
(when (multiple-in-equalities? deep-terms)
449449
(return (infix->prefix-in-equality deep-terms)))
450+
451+
(when (not (infix-canonical? deep-terms))
452+
(error "infix-with-precedence-to-prefix.rkt : !*prec-generic-infix-parser : not a canonical infix expression: " deep-terms))
450453

451454
(pre-check-!*-generic-infix-parser deep-terms creator)))))
452455

info.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"SRFI-105-for-Racket"
1212
"try-catch"))
1313
(define pkg-desc "Scheme+ for Racket")
14-
(define version "10.4")
14+
(define version "10.5")
1515
(define pkg-authors '(mattei))
1616
(define scribblings '(("scribblings/scheme-plus.scrbl" ())))
1717
(define build-deps '("scribble-lib" "racket-doc" "scribble-code-examples" "scribble-doc"))

operators-list.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565

6666
(define assignment-operator-syntax (append single-variable-assignment-operator-syntax
67-
(list ;;#'<- #'->
67+
(list #'<- #'->
6868
#'← #'→
6969
#':= #'=:
7070
#'<v #'v>

0 commit comments

Comments
 (0)