REBOL [
Title: "Script?"
Date: 5-Feb-2013
Author: "Christopher Ross-Gill"
Purpose: "Detect the beginning of a Rebol/Red Script"
]
script?: use [space id mark type][
space: charset " ^-"
id: [
any space mark:
any ["[" mark: (mark: back mark) any space]
copy type ["REBOL" | "Red" opt "/System" | "Topaz"]
any space
"[" to end
]
func [source [string! binary!] /language][
if all [
parse/all source [
some [
id break |
(mark: none)
thru newline opt #"^M"
]
]
mark
][either language [type][mark]]
]
]