faqts : Computers : Programming : Languages : Tse : Color : Syntax highlighting

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: Create: Steps: What are steps to create a .syn file for TSE v2.8, v3.0 or v4.0?

Aug 26th, 2005 08:46
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 03 July 2003 - 08:01 pm -----------------------

TSE: Create: Steps: What are steps to create a .syn file for TSE v2.8, 
v3.0 or v4.x?

---

Steps: Overview:

 1. -determine for which language and filetype you are going to create
     a new syntax highlighting file

      e.g. you want to create a syntax highlight file for CORBA .idl
           files

 You ask yourself then a few questions:

 2. -Delimiters:

      2.1 What are the multiline delimiters for that language?

          (e.g. for CORBA this is:

      2.2 What are the single line delimiters for that language?

      2.3 What are the to end of line delimiters for that language?

      2.4 What are the string quotes used in that language?

 3. -Directives:

      3.1 What are possible directives for that language?

 4. -Numbers

      4.1 Which number groups are used in that language?

         E.g. for CORBA, you might select:

          1. Real numbers

          2. C Style Any string recognized as a number in C: includes
                    integers, 0xf-style hex numbers, real numbers,
                    scientific notation, integers designated as
                    unsigned or long (with a trailing "u" or "l,"
                    respectively)

          3. Real   Integers with a leading or embedded decimal
                     point. Numbers

        Customized  Allows one to pick any combination of the following
        Set         styles:

                    Integers
                    0xf Style Hex
                    0fh Style Hex
                    $0f Style Hex
                    %01 Style Binary
                    Real Numbers
                    Scientific Notation
                    Double Precision Scientific Notation
                    Trailing u/l on Integers, for the C language
                    Comma-separated, for COBOL and other use


 5. -Case sensitive

      5.1 Is your language case sensitive?

          (for example CORBA is not case sensitive)

 6. -Keywords

      6.1 First collect the keywords for that language
          (e.g. do a search on Google for 'keyword Corba idl',
           that gives e.g.
http://www.eli.sdsu.edu/courses/spring98/cs696/notes/CORBAidl/CORBAidl.
html
           where you can find an overview of the keywords.

            any
            attribute
            boolean
            case
            char
            const
            context
            default
            double
            enum
            exception
            FALSE
            fixed
            float
            in
            inout
            interface
            long
            module
            Object
            octet
            oneway
            out
            raises
            readonly
            sequence
            short
            string
            struct
            switch
            TRUE
            typedef
            union
            unsigned
            void
            wchar
            wstring

      6.2 Copy/paste or type or use a scan and optical
          character recognition to collect (all) the keywords

      6.3 Possibly sort that keywords (to get a more ordered
          overview)

      6.4 Remove any duplicates, e.g. by running a 'unique'
          macro

      6.6 Possibly divide this keywords in subgroups, where
          the purpose is that you give each subgroup another
          color, so that they are easy distinguised

          For example, divide you keywords in the following
          (basically arbitrary) subgroups:

           1. main language keywords

           2. operators

              (e.g. :: { }) in CORBA)

           3. internal variable names

           4. functions

           5. methods

           6. properties

           7. events

           8. statements

           9. constants

          10. objects

           and so on

 7. -File extensions

      7.1 Which file extensions (one or more) do you want to
          associate with that language?

          (e.g. if the file has the extension .idl, you want
                that file to be associciated with this .syn
                file)

 8. Run the macro '..\mac\syncfg.mac'

    8.1 Choose from the menu 'Create New'

    8.2 Choose the directory where you want to store this .syn file
        (preferably the default directory 'synhi')

        (if your .syn is present in the '..\synhi\' directory, it will
         become active if the current file extension is choosen in that
         .syn file (e.g. if your current file extension is .idl, then
         the 'corba.syn' file will become active, if this .syn file is
         present in the '..\synhi\' directory)

    8.3 Choose the filename (e.g. 'corba')

    8.4 Fill in the fields, as given above
        (you have to fill in some fields, at least one,
        (so you should see the message 'Buffer modified, save changes',
        then answer 'Yes)
        Otherwise the .syn file will not be created.

        Press <F1> for help, use e.g. grey * - + to copy/paste/cut)

    8.5 That will create the .syn file in that directory

         (e.g. 'corba.syn')

 9. To see and test the correctness of the color syntax highlighting 
in action

    9.1 Restart your TSE

    9.2 Load a file with the defined extension (e.g. 'ddd.idl')

    9.3 Put your newly keywords in it, or even better search
        for another set of keywords on the Internet and paste
        them in.
        The colors should correspond and the keywords highlighted.

    9.4 If the corresponding .syn file is present in the '..\synhi\'
        directory, you should see the different colors appear
        If not, then add this keywords to the syntax highlight
        file

10. Possibly change the colors associated

    10.1 -select from menu option 'Other'

    10.2  -select from list 'Full Configuration'

    10.3   -select from list 'Display Color Options'

    10.4    -select from list 'Set Colors'

    10.5     -select from list 'Set Syntax Hilite Colors'

    10.6      -and choose your likings for the different classesc

---
---

Internet: see also:

---

TSE: Color: Syntax highlighting: Link: Overview: Can you give an 
overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/37599/fid/929

----------------------------------------------------------------------