Posted 20 years ago
by Rhywun
How do I nest one state in another state? For example,
print "blah blah <<expression>> blah";
I want "<<expression>>" to be a separate state (the StringExpressionState) inside the string state. I can only get it to work inside the DefaultState, not the StringState. Here is what I came up with:[ 04-15-2004: Message edited by: Rhywun ]
print "blah blah <<expression>> blah";
I want "<<expression>>" to be a separate state (the StringExpressionState) inside the string state. I can only get it to work inside the DefaultState, not the StringState. Here is what I came up with:
<Styles>
<Style Key="StringExpressionDelimiterStyle" ForeColor="Blue" BackColor="PaleGoldenrod" Bold="True" Italic="False" Underline="False" />
<Style Key="StringExpressionDefaultStyle" ForeColor="Blue" BackColor="PaleGoldenrod" Bold="True" Italic="False" Underline="False" />
</Styles>
<States>
<State Key="StringExpressionState" DefaultToken="StringExpressionDefaultToken" />
</States>
<Tokens>
<Token Key="StringExpressionStartToken" Style="StringExpressionDelimiterStyle">
<PushState State="StringExpressionState" />
</Token>
<Token Key="StringExpressionDefaultToken" Style="StringExpressionDefaultStyle" />
<Token Key="StringExpressionEndToken" Style="StringExpressionDelimiterStyle">
<PopStates>
<PopState State="StringExpressionState" />
</PopStates>
</Token>
</Tokens>
<Regexs>
<Regex Value="\<\<" Token="StringExpressionStartToken">
<RegexValidStates>
<RegexValidState State="StringState" /> <!-- THIS DOESN'T WORK -->
<RegexValidState State="DefaultState" /> <!-- THIS WORKS -->
</RegexValidStates>
</Regex>
<Regex Value="[^\\(\>\> )]+" Token="StringExpressionDefaultToken">
<RegexValidStates>
<RegexValidState State="StringExpressionState" />
</RegexValidStates>
</Regex>
<Regex Value="\>\>" Token="StringExpressionEndToken">
<RegexValidStates>
<RegexValidState State="StringExpressionState" />
</RegexValidStates>
</Regex>
</Regexs>