yamasushi(2013/04/21 04:48:39 UTC)Gauche:マニュアルにアクセスを使用して、設定ファイルを生成します。
(use gauche.dictionary)
(use srfi-1)
(use util.match)
(use gauche-classes)
(use gauche-modules)
(use textj.gauche-info)
(use komono-dict)
; class列挙のときにformatが置き換わるので coreのフォーマットを呼ぶ仕掛け
(define %format (with-module gauche format) )
(define keywords '())
(let [[f (info-node-function-jp )]
[v (info-node-variable-jp )]
[c (info-node-class-jp )]
[m (info-node-module-jp )] ]
(update! keywords (cut append <> (dict-keys f )))
(update! keywords (cut append <> (dict-keys v )))
(update! keywords (cut append <> (dict-keys m )))
(update! keywords (cut append <> (dict-keys c ))) )
;
(define sorted-keywords
($ map (cut regexp-replace #/^\^/ <> "^\\0")
$ sort! $ delete-duplicates! keywords) )
(define undocumented (force lazy-gauche-modules))
;(write undocumented)
(gauche-classes-for-each
( ^(mod cls)
(if (slot-exists? cls 'name)
($ push! undocumented $ x->string $ class-name cls)
) ) )
;(write undocumented)
(set! undocumented (lset-difference string=? undocumented keywords))
(%format #t "#Gauche Keywords\nkeywords.$(file.patterns.scheme)=")
(%format #t "~a\n" (string-join sorted-keywords " \\\n" 'infix))
(%format #t "#Undocumented\nkeywords2.$(file.patterns.scheme)=")
(%format #t "~a\n" (string-join undocumented " \\\n" 'infix))
(use gauche.dictionary)
(use srfi-13)
(use textj.gauche-info)
(use util.match)
(use komono-dict)
(use komono-regexp)
(define ht-api (make-tree-map string=? string<? ))
($ generator-for-each
(match-lambda
[( (cat name desc org ) body head node-name . _ )
(let1 grp ($ (rxmatch-lambda
[ #/^\s*(\[\S+\])\s+/ ( _ grp ) grp ]
[ else "" ] )
$ car body)
(if desc
(dict-push! ht-api name (format #f " ~a \\n;~a~a" (string-trim-both desc) grp node-name))
(dict-push! ht-api name (format #f "\\n;~a~a" grp node-name) ) ) )
] )
$ info-deftp-generator gauche-info-root (^_ #t) :tag 'refj )
(dict-for-each ht-api
(^(name apis)
($ map ($ format #t "~a ;~a\n" name $)
$ sort! $ delete-duplicates apis)
) )
Tag: scite