nyacc: fixed bug in pretty-print-c99 wrt i-sel

This commit is contained in:
Matt Wette 2017-02-28 09:53:41 -08:00 committed by Jan Nieuwenhuizen
parent f7ab751dcd
commit 953a57b663
4 changed files with 12 additions and 7 deletions

View file

@ -1,3 +1,7 @@
2017-02-28 Matt Wette <mwette@alumni.caltech.edu>
* lang/c99/pprint.scm: (binary 'd-del .. => (binary 'd-sel
2017-02-22 Matt Wette <mwette@alumni.caltech.edu> 2017-02-22 Matt Wette <mwette@alumni.caltech.edu>
* lang/c99/cpp.scm (rtokl->string): added handler for 'string * lang/c99/cpp.scm (rtokl->string): added handler for 'string

View file

@ -168,8 +168,8 @@
((array-ref ,dim ,expr) ((array-ref ,dim ,expr)
(ppx expr) (sf "[") (ppx dim) (sf "]")) (ppx expr) (sf "[") (ppx dim) (sf "]"))
((d-sel ,id ,ex) (binary 'd-del "." ex id)) ((d-sel ,id ,ex) (binary 'd-sel "." ex id))
((i-sel ,id ,ex) (binary 'i-del "->" ex id)) ((i-sel ,id ,ex) (binary 'i-sel "->" ex id))
((pre-inc ,expr) (unary/l 'pre-inc "++" expr)) ((pre-inc ,expr) (unary/l 'pre-inc "++" expr))
((pre-dec ,expr) (unary/l 'pre-dec "--" expr)) ((pre-dec ,expr) (unary/l 'pre-dec "--" expr))

View file

@ -390,7 +390,8 @@
((member (cadr tspec) keep) udecl) ((member (cadr tspec) keep) udecl)
(else ;; splice in the typedef (else ;; splice in the typedef
(let* ((name (sx-ref tspec 1)) (let* ((name (sx-ref tspec 1))
(decl (assoc-ref udecl-dict name)) ; decl for typename (decl (or (assoc-ref udecl-dict name) ; decl for typename
(throw 'c99-error "util2 decl error")))
(tdef-specl (sx-ref decl 1)) ; decl-spec-list for typename (tdef-specl (sx-ref decl 1)) ; decl-spec-list for typename
(tdef-declr (sx-ref decl 2)) ; init-declr for typename (tdef-declr (sx-ref decl 2)) ; init-declr for typename
;; splice the typedef specifiers into target: ;; splice the typedef specifiers into target:

View file

@ -185,7 +185,7 @@ the file COPYING included with the this distribution.")
(define (sx-tail sx ix) (define (sx-tail sx ix)
(cond (cond
((zero? ix) (error "sx-tail: expecting index greater than 0")) ((zero? ix) (error "sx-tail: expecting index greater than 0"))
((and (pair? (cdr sx)) (eqv? '@ (cadr sx))) (list-tail sx (1+ ix))) ((and (pair? (cadr sx)) (eqv? '@ (caadr sx))) (list-tail sx (1+ ix)))
(else (list-tail sx ix)))) (else (list-tail sx ix))))
;; @deffn sx-has-attr? sx ;; @deffn sx-has-attr? sx
@ -253,7 +253,7 @@ the file COPYING included with the this distribution.")
;; a-list of precedence with keys @code{'left}, @code{'right} and ;; a-list of precedence with keys @code{'left}, @code{'right} and
;; @code{nonassoc}. ;; @code{nonassoc}.
;; @example ;; @example
;; (protect-expr? 'lval '+ '(mul ...)) => TBD ;; (protect-expr? 'left '+ '(mul ...)) => TBD
;; @end example ;; @end example
(define (make-protect-expr op-prec op-assc) (define (make-protect-expr op-prec op-assc)
@ -283,8 +283,8 @@ the file COPYING included with the this distribution.")
(lambda (side op expr) (lambda (side op expr)
(let ((assc? (case side (let ((assc? (case side
((lt left) assc-rt?) ((lt lval left) assc-rt?)
((rt right) assc-lt?))) ((rt rval right) assc-lt?)))
(vtag (car expr))) (vtag (car expr)))
(case (prec op vtag) (case (prec op vtag)
((>) #t) ((>) #t)