Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [bug?] Problem with 'load

From: rotenca:telvia:it at: 28-Nov-2003 15:33

Hi Brett,
> blah blah > [ REBOL [Title: "Sample"] print now] > blah blahblah blah > blah blah > > Strangely enough, the Script? function that Yos pointed out seems to give a > useful result in this case - the beginning of the embedded script, but not > when the script is not embedded. Odd. Anyway, at least it will tell you if > there is no point continuing :-)
Can you do an example? Here it works (1.2.10.3.1).
>From my tests, the header is not seen only if
before REBOL [] there is some no space chars AND there is not a newline between the chars and REBOL [] The only difference i see is this: script? "aa^/rebol[]" ;== "aa^/rebol[]" script? "aa^/[rebol[]" ;== "[rebol[]" This could be a bug. Note also that in the embedded case the final ] can be omitted. So i think that this is enough: load-header: func [ "Load and construct a Rebol header object" str [file! url! string!] ][ if str: script? str [ attempt [ construct/with first load/next find find str "rebol" "[" system/standard/script ] ] ] probe load-header "# aa^/rebol[needs: [1]]" The function return none if the header block is bad formed, like in case like these: rebol [ Note that script? returns a positive answer in these cases: script? "rebol [" so we need the attempt in the function. --- Ciao Romano