Rebol Programming/parse-header

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

PARSE-HEADER parent data /multiple 

DESCRIPTION:[edit | edit source]

Returns a header object with header fields and their values

PARSE-HEADER is a function value.

ARGUMENTS:[edit | edit source]

  • parent -- Default header object (Type: object none)
  • data -- String to parse (Type: any-string)

REFINEMENTS:[edit | edit source]

  • /multiple -- Obsolete. Here for compatibility only.

SOURCE CODE[edit | edit source]

parse-header: func [
    {Returns a header object with header fields and their values} 
    parent [object! none!] "Default header object" 
    data [any-string!] "String to parse" 
    /multiple "Obsolete. Here for compatibility only."
][
    clear invalid 
    template: parent 
    any [
        parse/all data message 
        net-error "Headers not correctly parsed"
    ] 
    make either parent [parent] [object!] head-list
]