colorize Ruby {

        SyntaxParser        = 'SIMPLE';

        color {
                { 'Normal',      'Editor_Default' },
                { 'Number',      'Lang_Number' },
                { 'Punctuation', 'Lang_Punctuation' },
                { 'String',      'Lang_String' },
                { 'Comment',     'Lang_Comment' },
                { 'Function',    'Lang_Function' },
                { 'Regexp',      'Lang_Regexp' },
        };

        keyword 'Editor_Keywords' {
                'if', 'else', 'elsif', 'while', 'case', 'when', 'unless',
                   'until', 'for', 'in', 'loop', 'then', 'do',
                'return', 'break', 'next', 'redo', 'retry', 'rescue', 'ensure',
                'def', 'begin', 'end', 'yield', 'proc', 'class', 'module',
                'nil', 'TRUE', 'true', 'FALSE', 'false', 'self', 'super',
                  '__LINE__', '__FILE__',
                'not', 'or', 'and',
                'defined', 'undef',
                'attr_reader', 'attr_writer', 'attr_accessor',
                'alias',
                'include', 'load', 'require'
        };

        h_state 0 { 'Normal' }
        h_trans { 5, '-s', 'a-zA-Z_', 'Normal' }
        h_trans { 1, '', '#', 'Comment' }
        h_trans { 1, '^', '=begin', 'Comment' }
#        h_trans { 1, '', '//', 'Comment' }
        h_trans { 3, '', '"', 'String' }
        h_trans { 4, '', '\'', 'String' }
        h_trans { 6, 's', '0-9', 'Number' }
        h_trans { 7, '', '/', 'String' }
        h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' }

        h_state 1 { 'Comment' }  # single line comment
        h_trans { 0, '$', '', 'Normal' }

        h_state 2 { 'Comment' }  # multiline comment
        h_trans { 0, '^', '=end', 'Comment' }

        h_state 3 { 'String' }   # Single quote
        h_trans { 0, '', '"', 'String' }
        h_trans { 0, '$', '', 'String' }
        h_trans { 4, 'Qq', '\\', 'String' }

        h_state 4 { 'String' }   # Double quote
        h_trans { 0, '', '\'', 'String' }
        h_trans { 0, '$', '', 'String' }

        h_state 5 { 'Normal' }
        h_trans { 0, '$', '', 'Normal' }
#        h_trans { 0, '', '[a-zA-Z_][a-zA-Z0-9_]*', 'Function' }
        h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' }

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

        h_state 7 { 'Regexp' }  # Regular Expressions
        h_trans { 7, '', '\\/', 'Regexp' }
        h_trans { 0, 's', '/', 'String' }
}




mode Ruby: PLAIN {               # Ruby mode
        FileNameRx          = '\\.{rb}|{ruby}$';
        Colorizer           = 'Ruby';
        HilitOn             = 1;
        AutoIndent          = 1;
        IndentMode          = 'PLAIN';
        TabSize             = 8;
        SpaceTabs           = 1;
        MatchCase           = 1;
        Trim                = 1;
        MultiLineHilit      = 0;
        AutoHilitParen      = 1;
        RoutineRegexp       = /^\s*{def}\s/;
        SaveFolds           = 2;      # save fold info at end of line
        CommentStart        = ' #';
        CommentEnd          = '';
}

