Help with adding new state to HTML language def

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by GavinK151
Avatar
Hi again!

I am floundering a bit with adding a new STATE to the provided HTML definition file. For example, the ProcessingInstructionState section defines colour coding for and text within a "<? ?>" block. I want to do somerthing very similar but using (for example) "<: :>".

I added a new Scope section:

            <State Key="MYInstructionState" TokenKey="MYInstructionDefaultToken" Style="MYInstructionDefaultStyle">
                <Scopes>
                    <Scope>
                        <ExplicitPatternGroup Type="StartScope" TokenKey="MYInstructionStartToken" Style="MYInstructionDelimiterStyle" PatternValue="&lt;:" />
                        <ExplicitPatternGroup Type="EndScope" TokenKey="MYInstructionEndToken" Style="MYInstructionDelimiterStyle" PatternValue=":&gt;" />
                    </Scope>
                </Scopes>
                <PatternGroups>
                    <RegexPatternGroup TokenKey="MYInstructionDefaultToken" PatternValue="[^\:]+" />
                </PatternGroups>
            </State>    
And defined the styles:
            <Style Key="MYInstructionDelimiterStyle" Name="MY Instruction Delimiter" BackColor="#FFFF00" ForeColor="#0000FF" Bold="True" />
            <Style Key="MYInstructionDefaultStyle"   Name="MY Instruction Defaulter" BackColor="#FFFF00" ForeColor="#0000FF" Bold="True" />
and added the new state as a childstate:
<ChildState Key="MYInstructionState" />
However rebuilding with this new HTML definition seems to have no effect. I am certain I am missing something VERY obvious but I am not sure what I missed! Must I add anything to the HTML Semantic parser? (I thought this was only for outlining)

can anyone give me some pointers?

thanks very much!

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Gavin,

It looks perfect from a first glance. Try this, our sample app is great for debugging languages. If you load your language and then move the caret to the location in the document where start of <: is, look at the statusbar. It will tell you what token and state you're in at the caret. Then you'll know if your start scope pattern is being recognized or not.

If you still can't figure it out, email us the language definition and we can take a quick look for you.


Actipro Software Support

Posted 18 years ago by GavinK151
Avatar
hi there!

Well I started again and it works fine! I am not sure what I did differently to be honest so lets just call it "user error" :-) Am still playing with it but its certainly looking alot better now - thanks once again for your help.

Gav

P.S. great tip on using your sample app to identify tokens, very handy.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.