How to write syntax highlighting?
        Posted  
        
            by ML
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ML
        
        
        
        Published on 2010-04-17T00:56:17Z
        Indexed on 
            2010/04/17
            1:23 UTC
        
        
        Read the original article
        Hit count: 462
        
I am embarking on some learning and I want to write my own syntax highlighting for files in C++.
Can anyone give me ideas on how to go about doing this?
To me it seems that when a file is opened: 1. it would need to be parsed and decided what type of source file it is. Trusting the extension might not be full-proof
- a way to know what keywords/commands apply to what language 
- a way to decide what color each keyword/command gets 
I want to do this on OS X, C++ or Objective-C
Can anyone provide pointers on how I might get started with this?
© Stack Overflow or respective owner