nyacc: worked c99/util2.scm udecl->mspec
This commit is contained in:
parent
047590bd5e
commit
a301ce53df
|
@ -1,4 +1,4 @@
|
||||||
This is a version 0.75.6 of NYACC (Not Yet Another Compiler Compiler!).
|
This is a version 0.75.6+c99dev of NYACC (Not Yet Another Compiler Compiler!).
|
||||||
|
|
||||||
Copyright (C) 2015-2017 Matthew R. Wette
|
Copyright (C) 2015-2017 Matthew R. Wette
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#:use-module (nyacc util)
|
#:use-module (nyacc util)
|
||||||
)
|
)
|
||||||
|
|
||||||
(define *nyacc-version* "0.75.6")
|
(define *nyacc-version* "0.75.6+c99dev")
|
||||||
|
|
||||||
|
|
||||||
;; @deffn proxy-? sym rhs
|
;; @deffn proxy-? sym rhs
|
||||||
|
|
|
@ -587,10 +587,17 @@
|
||||||
(m-decl (reverse (cons m-specl m-declr))))
|
(m-decl (reverse (cons m-specl m-declr))))
|
||||||
m-decl))
|
m-decl))
|
||||||
|
|
||||||
|
;; @deffn udecl->mspec/comm decl [dict] [#:def-comm ""]
|
||||||
|
;; Convert declaration tree to an mspec
|
||||||
|
;; @example
|
||||||
|
;; (decl ... (comment "state vector")
|
||||||
|
;; =>
|
||||||
|
;; ("x" "state vector" (array-of 10) (float "double")
|
||||||
|
;; @end example
|
||||||
(define* (udecl->mspec/comm decl #:optional (dict '()) #:key (def-comm ""))
|
(define* (udecl->mspec/comm decl #:optional (dict '()) #:key (def-comm ""))
|
||||||
(let* ((comm (sx-ref decl 3))
|
(let* ((comm (or (and=> (sx-ref decl 3) cadr) def-comm))
|
||||||
(spec (udecl->mspec decl dict)))
|
(spec (udecl->mspec decl dict)))
|
||||||
(cons* (car spec) (or comm `(comment ,def-comm)) (cdr spec))))
|
(cons* (car spec) comm (cdr spec))))
|
||||||
|
|
||||||
;; @deffn fix-fields flds => flds
|
;; @deffn fix-fields flds => flds
|
||||||
;; This will take a list of fields from a struct and remove lone comments.
|
;; This will take a list of fields from a struct and remove lone comments.
|
||||||
|
|
Loading…
Reference in a new issue