Is there a better way to handle this?

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Alex Lyman - Woodland Park, CO
Avatar
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):
<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

Comments (2)

Posted 14 years ago by Radventure B.V
Avatar
Actipro has announced on the "C# Attributes" thread that the next version has the ability to specify regex zero-width assertion look-behind capabilities for all lexical patterns. Don't know though when we can expect this new release.

Kind regards,

Erik Pepping.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alex,

If you'd like to e-mail us with your language definition and some example text in it that demonstrates the issue, that might help us understand it. We will keep what you sent confidential.

And as Erik said, look-behinds are coded and ready to go for 3.0.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.