# some stuff copied from m_texi.org.

# need to add all assembler commands
colorize TEXINFO {
    SyntaxParser = 'SIMPLE';
    
    color {
        { 'Normal',        'Editor_Default' },
        { 'String',        'Lang_String' },
        { 'Comment',       'Lang_Comment' },
        { 'Punctuation',   'Markup_Punctuation' },
        { 'Special',       'Markup_Special' },
        
    };

    keyword 'Editor_Keywords' { # global keywords ...
        'TeX{}',
        'bullet{}',
        'copyright{}',
        'dots{}',
        'equiv{}',
        'error{}',
        'expansion{}',
        'minus{}',
        'point{}',
        'print{}',
        'result{}',
        'today{}',
        'AA{}',
        'aa{}',
        'AE{}',
        'ae{}',
        'enddots{}',
        'equiv{}',
        'exclamdown{}',
        'L{}',
        'l{}',
        'expansion{}',
    };

    h_state 0 { 'Normal' }
    h_trans { 3, '', '%', 'Comment' }
    h_trans { 3, '', '@c ', 'Comment' }
    h_trans { 1, '^', '@', 'Keyword' }
    h_trans { 2, '', '@', 'Keyword' }
    h_trans { 0, 's', '{}\\', 'Punctuation' }

    h_state 1 { 'Keyword' }        # bol only keywors
    h_trans { 0, '$', '', 'Normal' }
    h_trans { 0, 'S', 'a-zA-Z_', 'Special' }

    h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' }
    h_words 'Editor_Keywords' {
        'appendix',
        'appendixsec',
        'appendixsections',
        'appendixsubsec',
        'appendixsubsubsec',
        'author',
        'bye',
        'center',
        'contents',
        'centerchap',
        'chapheading',
        'chapter',
        'cindex',
        'clear',
        'defcodeindex',
        'defcv',
        'deffn',
        'defindex',
        'defivar',
        'defmac',
        'defmethod',
        'defop',
        'defopt',
        'defspec',
        'deftp',
        'deftypfn',
        'deftypefun',
        'deftypevr',
        'deftypevar',
        'deffun',
        'defvar',
        'defvr',
        'dircategory',
        'direntry',
        'display',
        'end',
        'enumerate',
        'enumerate',
        'evenfooting',
        'evenheading',
        'everyfooting',
        'everyheading',
        'example',
        'exdent',
        'finalout',
        'findex',
        'flushleft',
        'flushright',
        'footnotestyle',
        'format',
        'ftable',
        'group',
        'heading',
        'headings',
        'ifclear',
        'ifinfo',
        'ifhtml',
        'ifset',
        'iftex',
        'ignore',
        'include',
        'item',
        'item',
        'itemize',
        'itemize',
        'itemx',
        'itemx',
        'kindex',
        'lisp',
        'majorheading',
        'menu',
        'need',
        'node',
        'noindent',
        'oddfooting',
        'oddheading',
        'page',
        'paragraphindent',
        'pindex',
        'printindex',
        'printindex',
        'quotation',
        'refill',
        'section',
        'set',
        'setchapternewpage',
        'setfilename',
        'settitle',
        'shortcontens',
        'smallbook',
        'smallexample',
        'smalllisp',
        'sp',
        'strong',
        'subheading',
        'subsection',
        'subsubheading',
        'subsubsection',
        'subtitle',
        'summarycontents',
        'syncodeindex',
        'synindex',
        'table',
        'tex',
        'thischapter',
        'thischaptername',
        'thisfile',
        'thispage',
        'thistitle',
        'tindex',
        'title',
        'titlepage',
        'top',
        'unnumbered',
        'unnumberedsec',
        'unnumberedsubsec',
        'unnumberedsubsubsec',
        'vindex',
        'vskip',
        'vtable',
    }

    h_state 2 { 'Keyword' }
    h_trans { 0, 'S', 'a-zA-Z_', 'Special' }
    h_trans { 0, '$', '', 'Normal' }
    h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' }

    h_state 3 { 'Comment' }         
    h_trans { 0, '$', '', 'Normal' }

    h_state 4 { 'Keyword' }        
    h_trans { 0, '$', '', 'Normal' }
    h_wtype { 5, 0, 0, '>', 'a-zA-Z_' }
    h_words 'Editor_Keywords' {
        'value',
        'b',
        'code',
        'file',
        'email',
        'H',
        'cite',
        'xref',
        'pref',
        'ref',
        'samp',
        'kbd',
        'footnote',
    }

    h_state 5 { 'Normal' }
    h_trans { 6, '', '{', 'Punctuation' }
    h_trans { 0, '', '', 'Normal' }

    h_state 6 { 'String' }
    h_trans { 0, '', '}', 'Punctuation' }

}

mode TEXINFO: PLAIN {
    FileNameRx          = /\.\cTEXI$/;
    HilitOn             = 1;
    Colorizer           = 'TEXINFO';
    AutoHilitParen      = 1;
    
    SaveFolds           = 2;      # save fold info at end of line
    CommentStart        = ' %';
    CommentEnd          = '';
}
