Rebol 编程/to-typeset
外观
< Rebol 编程
TO-TYPESET value
转换为 typeset! 值。
TO-TYPESET 是一个函数值。
- value -- (类型:任何)
- 捕获
to-typeset: func [
"Converts to typeset! value." [catch] value /local
anytype
anyblock
anyfunction
anystring
anyword
series
number
][
anytype: [
none! logic! integer! decimal! money! char! pair! tuple! time! date!
string! binary! file! email! url! tag! issue! bitset! image! block!
paren! path! set-path! lit-path! datatype! word! set-word! get-word!
lit-word! refinement! native! action! routine! op! function! object!
error! port! event! struct! library! hash! list! symbol! unset!
]
anyblock: [
block! paren! path! set-path! lit-path! hash! list!
]
anyfunction: [
native! action! routine! op! function!
]
anystring: [
string! binary! file! email! url! tag! issue!
]
anyword: [
word! set-word! get-word! lit-word! refinement!
]
series: [
string! binary! file! email! url! tag! issue! image!
block! paren! path! set-path! lit-path! hash! list!
]
number: [integer! decimal!]
switch/default either datatype? :value [to-word value] [:value] [
any-type! [reduce anytype]
any-block! [reduce anyblock]
any-function! [reduce anyfunction]
any-string! [reduce anystring]
any-word! [reduce anyword]
series! [reduce series]
number! [reduce number]
] [
switch/default type?/word :value [
datatype! [reduce [value]]
block! [
parse value: copy value [any [
datatype! | value: word! (
change value throw-on-error [to-datatype first value]
) | value: block! (
value: change/part value to-typeset first value 1
) :value |
value: skip (
throw-error 'script 'invalid-arg reduce [first value]
)
]]
head value
]
] [throw-error 'script 'invalid-arg reduce [:value]]
]
]