Tim Chase wrote:
I would like to add additional keywords if the first word or first 4 characters of the statement is "snit".

snit::type dog {
     method {tail wag} {} {return "Wag, wag"}
     method {tail droop} {} {return "Droop, droop"}
}

Since "snit" is there then I would like to added "method" as a keyword.

Your language here uses some definition/syntax with which I'm not familiar (might be smalltalk?). I'm not sure what you mean that you would like "method" added as a keyword. Do you want to add a third "method" line? Having some "before and after" descriptions of the code might help clarify matters.

Snit is an OO extension to Tcl.


If you just want to perform actions on "snit"s, and assuming you use consistent indentation such that "snit::" is always at the beginning of the line, and its closing "}" is also always at the beginning of the line, you can do things like

What I am looking for is if "snit" is the first word then "method" will be added as a keyword and colored.

<snip>

Or do you want to dynamically create syntax-highlighting definitions based on things found in your method defintions?


Yes, I believe that is correct. Actually it might be easier to find if "snit" is anywhere in the file at the beginning of the line (it will always be at the beginning) and then adding some extra keywords in to be colored.

With a bit of clarification, there's likely a fairly easy solution.


Did I clarify anything? I hope so.

Robert

Reply via email to