[REBOL] Re: Syntax highlighting
From: ammoncooke::yahoo::com at: 4-Oct-2001 22:20
Thanks!! that will be helpful. ;D
Ammon
----- Original Message -----
From: <[john_kenyon--mlc--com--au]>
To: <[rebol-list--rebol--com]>
Sent: Thursday, October 04, 2001 7:46 PM
Subject: [REBOL] Syntax highlighting
> All,
>
> Sorry for the large post.
>
> With everyone using different text editors with syntax highlighting I
though this may come in useful.
> Just add the words 'op! 'action! etc to your vanilla syntax file and it
will search and
> replace with the actual words split by a separator.
>
> Comments, improvements, complete rewrites appreciated :)
>
> (watch out for any lines >80 chars which may have wrapped)
>
> Cheers,
>
> John
>
> REBOL [
> Title: "Syntax generator"
> Date: 5-Oct-2001
> File: %syntax-gen.r
> Author: "John Kenyon"
> email: [johnkenyon--iname--com]
> Version: "0.1"
> Purpose: {
> Generic syntax file generator for Rebol
> Uses template format for syntax files
> Grabs words using a modifed version of 'help
> }
> History: {
> 0.1 5-Oct-2001 "First attempt at a more generic Rebol syntax
generator"
> }
> Instructions: {
> Take a syntax file for your favourite editor
> Add 'op! 'action! 'datatype! 'native! 'string! 'function! 'view
'none
> to sensible positions in the syntax file
> Run this code and select the syntax file - it will replace all of
the
> occurances with rebol words
> Separator is the string to place between each word (defaults to
newline)
> Re-run for each new version of Rebol (and whenver you add new
> definitions to your user.r)
> Tested with core and view - should work with command
> }
> ]
>
> categories: [
> 'op!
> 'action!
> 'datatype!
> 'native!
> 'string!
> 'function!
> ]
>
> find-by-type: func [ search-type ] [
> list-words: copy ""
> word: search-type
> types: copy []
> attrs: second system/words
> if all [word? :word not value? :word] [word: mold :word]
> if any [string? :word all [word? :word datatype? get :word]] [
> foreach value first system/words [
> if all [not unset? first attrs
> any [
> all [string? :word find value word]
> all [not string? :word datatype? get :word (get :word)
= type? first attrs]
> ]
> ] [
> append types value
> ]
> attrs: next attrs
> ]
> sort types
> if not empty? types [
> foreach item types [append list-words join item separator ]
> ]
> list-words: head remove back tail list-words
> ]
> return list-words
> ]
>
> if error? try [ view? ] [
> view?: false
> ]
>
> either view? [
> in-file: request-file/title/filter "Location of Rebol syntax file"
Open
"*"