Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== YAML [[toc:]] === Author Aaron Patterson === Requirements libyaml === Object mapping Parsing YAML to Scheme: * sequence: list * mapping: alist * colon-prefixed string: symbol * string: string * number: number * {{yes}}, {{true}}, {{on}}: {{#t}} * {{no}}, {{false}}, {{off}}: {{#f}} * empty string: sql-null Serializing Scheme to YAML: * list: sequence * alist: mapping * string: string * symbol: colon-prefixed string * number: number * {{#t}}: {{true}} * {{#f}}: {{false}} * sql-null: empty string === API <procedure>(yaml-load input)</procedure> Parse a YAML representation into an object. {{input}} may be a string or input port. Example: <enscript highlight="scheme"> #;1> (import yaml) #;2> (yaml-load "--- foo") "foo" #;3> (yaml-load "--- :bar") bar #;4> (yaml-load "--- ") #<sql-null#sql-null-type> #;5> (yaml-load "--- ['foo', ['bar']]") ("foo" ("bar")) #;6> (yaml-load "--- {foo: bar}") (("foo" . "bar")) #;7> (yaml-load "--- {foo: bar, bar: baz}") (("foo" . "bar") ("bar" . "baz")) #;8> </enscript> <procedure>(yaml-parse input stream-start stream-end document-start document-end alias scalar sequence-start sequence-end mapping-start mapping-end seed)</procedure> Parse a YAML representation into an object. {{input}} may be a string or input port. The remaining arguments are callback procedures along with the initial seed value {{seed}}. Each callback procedure accepts zero or more arguments representing the callback event, followed by the seed value. The return value of each callback procedure becomes the new seed value. Finally, the seed value is returned. The following example prints out a list of all events: <enscript highlight="scheme"> (import scheme) (import (chicken base)) (import (chicken pretty-print)) (import yaml) (define (yaml-events yaml) (reverse (yaml-parse yaml (lambda (enc seed) (cons (list 'stream-start enc) seed)) (lambda (seed) (cons (list 'stream-end) seed)) (lambda (version tags implicit seed) (cons (list 'document-start version tags implicit) seed)) (lambda (implicit? seed) (cons (list 'document-end implicit?) seed)) (lambda (alias seed) (cons (list 'alias alias) seed)) (lambda (value anchor tag plain quoted style seed) (cons (list 'scalar value anchor tag plain quoted style) seed)) (lambda (anchor tag implicit style seed) (cons (list 'sequence-start anchor tag implicit style) seed)) (lambda (seed) (cons '(sequence-end) seed)) (lambda (anchor tag implicit style seed) (cons (list 'mapping-start anchor tag implicit style) seed)) (lambda (seed) (cons '(mapping-end) seed)) '()))) (pp (yaml-events "--- { }")) </enscript> <procedure>(yaml-dump object #!optional port)</procedure> Serialize {{object}} to its YAML representation. If the output port {{port}} is given, write it to that port, otherwise return a string. Example: <enscript highlight="scheme"> #;1> (import yaml sql-null) #;2> (yaml-dump "foo") "--- foo\n" #;3> (yaml-dump 'bar) "--- :bar\n" #;4> (yaml-dump (sql-null)) "---\n" #;5> (yaml-dump '("foo" ("bar"))) "---\n- foo\n- - bar\n" #;6> (yaml-dump '(("foo" . "bar"))) "---\nfoo: bar\n" #;7> (yaml-dump '(("foo" . "bar") ("bar" . "baz"))) "---\nfoo: bar\nbar: baz\n" #;8> </enscript> === License MIT === Source The source can be found at [[https://github.com/tenderlove/chicken-yaml]] .
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 6 by 4?