# From: Keith Humphreys <keith@ViaThe.Net>
#
# FTE is wonderful.
# Several months ago I was looking at SIOD, and I hacked a "fte config" file
# which is 98% accurate. :-)  
# 
# Anyway, as it might be of use, here it is:

# ! colors probably need fixing --Mark

colorize SIOD {
    SyntaxParser       = 'SIMPLE';
    #   0, 8 - black
    #   1, 9 - blue
    #   2, A - green
    #   3, B - cyan
    #   4, C - red
    #   5, D - magenta
    #   6, E - orange
    #   7, F - white
    color {
        { 'Normal',      'Editor_Default' },
        { 'Keyword',     'Editor_Keywords' },
        { 'Number',      'Lang_DecimalNumber' },
        { 'HexNumber',   'Lang_HexNumber' },
        { 'Punctuation', 'Lang_Punctuation' },
        { 'String',      'Lang_String' },
        { 'Symbol',      'Lang_Command' },
        { 'Comment',     'Lang_Comment' },
        { 'Special',     'Lang_Control' },
    };

    # Hmmm, it appears that exit and quit aren't even recommended!
    keyword 'Editor_Keywords4' { #Scheme's essential procedures:.
        'abs', 'alarm', 'and', 'append', 'apply',
        'ass', 'assoc', 'assq', 'assv',   
        'base64decode', 'base64encode', 'begin',    
        'caaar', 'caadr', 'caar', 'cadar', 'caddr', 'cadr', 'car',
        'cdaar', 'cdadr', 'cdar', 'cddar', 'cdddr', 'cddr', 'cdr',
        'cond', 'cons-array', 'define',
        'eq?', 'equal?', 'eqv?', 'eval', 'exec', 'exit',
        'fclose',  'fopen',
        'if',
        'lambda', 'length', 'let', 'let*', 'letrec', 'list', 'load',
        'max', 'min',
        'member', 'memq', 'memv',
        'nil', 'not', 'null?', 'number?', 'number->string',
        'or',
        'pair?',
        'quit',  'quote',
        'set!', 'set-car!', 'set-cdr!',
        'string->number', 'string-length',  'string?', 'string-append',
         'substring',
        'symbol?',
        'read', 'reverse',
    };

    keyword  'Lang_Function' { #These are recommended by the standard.
        'acos', 'asin', 'atan', 'cos', 'exp', 'log', 'sin', 'tan',
        'sqrt',

    };

    #note: varables t, nil have been removed from the standard,
    #      but are here.
    keyword 'Editor_Keywords' { #These are siod extras.
        '%%%memref', '%%closure', '%%closure-code', '%%closure-env', '%%stack-limit',
        '*after-gc*', '*args*', '*catch', '*env*', '*eval-history-ptr*', '*pi*',
        '*plists*', '*throw', '*traced*',
        'F_GETLK', 'F_SETLK', 'F_SETLKW',
        'access-problem?',  'allocate-heap', 'apropos',
        'aref', 'array->hexstr', 'aset', 'ash',  'atan2',
        'benchmark-eval', 'benchmark-funcall1', 'benchmark-funcall2',
        'bit-and', 'bit-not', 'bit-or', 'bit-xor', 'butlast', 'bytes-append',
        'chdir', 'chmod', 'chown', 'closedir',  'copy-list',
        'cpu-usage-limits', 'crypt', 'current-resource-usage',
        'datlength', 'datref', 'decode-file-mode', 'delete-file', 'delq',
        'encode-file-mode', 'encode-open-flags', 'endpwent', 'env-lookup', 'eof-val',
        'errobj', 'error', 
        'fast-load', 'fast-print', 'fast-read', 'fast-save', 'fchmod',
        'fflush', 'file-times', 'first', 'fmod', 'fnmatch', 'fork',
        'fread', 'fseek', 'fstat', 'ftell', 'fwrite',
        'gc', 'gc-info', 'gc-status', 'get', 'getc', 'getcwd', 'getenv', 'getgid',
        'getgrgid', 'getpass', 'getpgrp', 'getpid', 'getppid', 'getpwent',
        'getpwnam', 'getpwuid', 'gets', 'getuid', 'gmtime', 'hexstr->bytes',
        'href', 'hset', 'html-encode',
        'intern',
        'kill',
        'larg-default', 'last', 'last-c-error', 'lchown',
        'link', 'lkey-default', 'load-so',
        'localtime', 'lref-default', 'lstat',
        'make-list', 'mapcar',  'md5-final', 'md5-init', 'md5-update',
        'mkdatref', 'mkdir', 'mktime',
        'nconc', 'nice',  'nreverse', 'nth',
        'opendir',  'os-classification',
        'parse-number', 'pclose', 'popen', 'pow',
        'prin1', 'print', 'print-to-string', 'prog1',
        'putc', 'putenv', 'putprop', 'puts',
        'qsort',
        'rand', 'random',
        'read-from-string', 'readdir', 'readline', 'readlink',
        'realtime', 'rename', 'require', 'require-so', 'rest',
        'rld-pathnames', 'rmdir', 'runtime',
        'save-forms', 'sdatref', 'set-eval-history',
        'set-symbol-value!', 'setprop', 'setpwent', 'setuid',
        'siod-lib', 'sleep', 'so-ext', 'srand', 'srandom', 'stat',
        'strbreakup', 'strcat', 'strcmp', 'strcpy', 'strcspn', 'strftime',
        'string-dimension', 'string-downcase',
        'string-lessp', 'string-search', 'string-trim',
        'string-trim-left', 'string-trim-right', 'string-upcase',
        'strptime', 'strspn', 'subset', 'substring-equal?',
        'swrite', 'sxhash', 'symbol-bound?', 'symbol-value', 
        'symbolconc', 'symlink', 'system',
        't', 'the-environment', 'trace', 'trunc', 'typeof',
        'unbreakupstr', 'ungetc', 'unix-ctime', 'unix-time', 'unix-time->strtime',
        'unlink', 'untrace', 'url-decode', 'url-encode', 'utime',
        'verbose',
        'wait', 'while', 'writes', 
    };

    
    h_state 0 { 'Normal' }
    h_trans { 1, '-s', 'A-Za-z_%*', 'Normal' }  #Keyword starters.
    h_trans { 2, '<', ';', 'Comment' }
    h_trans { 3, '>', '\'', 'Symbol' }
    h_trans { 4, '>', '0x', 'HexNumber' }
    h_trans { 5, '>s', '0-9', 'Number' }
    h_trans { 6, '>', '"', 'String' }
    h_trans { 0, 's', '()', 'Special' }
#    h_trans { 0, '', ',', 'Punctuation' }

    h_state 1 { 'Normal' }
    h_trans { 0, '$', '', 'Normal' }
    h_trans { 2, '<', ';', 'Comment'}
    h_wtype { 0, 0, 0, '', '-a-zA-Z0-9_*%:?!>' }  #Keyword internals

    h_state 2 { 'Comment' }
    h_trans { 0, '$', '', 'Comment' }

    h_state 3 { 'Symbol' }
    h_trans { 2, '<', ';', 'Comment'}
    h_trans { 0, '>', ' ', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }
    h_trans { 0, '>s', '()', 'Special' }
    
    h_state 4 { 'HexNumber' }
    h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 5 { 'Number' }
    h_trans { 0, '-S', '0-9', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 6 { 'String' }
    h_trans { 0, '<', '"', 'String' }
    h_trans { 6, 'q', '\\', 'String' } # 'q' "igores" next char.

}

mode SIOD: PLAIN {      # siod Mode
    FileNameRx          = /\.\cscm$/;
    HilitOn             = 1;
    Colorizer           = 'SIOD';
    AutoIndent          = 1;
    IndentMode          = 'PLAIN';
    MatchCase           = 0;  #scheme is case insensitive.
    Trim                = 1;
    MultiLineHilit      = 1;
    AutoHilitParen      = 1;

    SaveFolds           = 2;      # save fold info at end of line
    CommentStart        = ' ;';
    CommentEnd          = '';

    WordChars           = '-A-Za-z0-9*%:?!>';  #first noticed in m_plain.fte

#    RoutineRegexp       = '(';
}

