Posted 20 years ago
by Alex Lyman
- Woodland Park, CO
I'm trying to develop a syntax definition for a fairly complex language that has odd semantics -- one of those semantics is that certain scopes may only contain certain statements (and outside those scopes, those statements may have differenent semantics -- like may be variables).
Right now, I have a several scopes that may contain the same elements (in some cases, this is recursive), and I'm handling this by creating a master block that any of these can add as a ChildState. My issue comes in as, do I have to add a dummy scope for every one of these possible ChildStates, or is there a way to specify that ChildStates's scopes should pass through? Also, this method breaks the ability to do bracket highlighting for some of my code (which will not be the case when we get look-behinds in the RE engine)
Here's an example (some names have been changed to protect the identity of the language):
Right now, I have a several scopes that may contain the same elements (in some cases, this is recursive), and I'm handling this by creating a master block that any of these can add as a ChildState. My issue comes in as, do I have to add a dummy scope for every one of these possible ChildStates, or is there a way to specify that ChildStates's scopes should pass through? Also, this method breaks the ability to do bracket highlighting for some of my code (which will not be the case when we get look-behinds in the RE engine)
Here's an example (some names have been changed to protect the identity of the language):
<State Key="SomeStatements">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" Token="DefaultToken" PatternValue="(?=\b begin \b)" />
<RegexPatternGroup Type="EndScope" Token="KeywordToken" Style="OperatorStyle" PatternValue="\b end \b" />
</Scope>
<!-- etc. -->
</Scopes>
<ChildStates>
<ChildState Key="BeginEndStatement"/>
<!-- etc. -->
</ChildStates>
</State>
<Statement Key="BeginEndStatement">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" Token="KeywordToken" PatternValue="\b begin \b" />
<RegexPatternGroup Type="EndScope" Token="DefaultToken" PatternValue="(?=\b end \b)" />
</Scope>
</Scopes>
<ChildStates>
<ChildState Key="SomeStatements" />
</ChildStates>
</Statement>
Alex Lyman
Lead Developer
Savian Software, LLC