Posted 20 years ago by painetraine
Avatar
I have the following line in my document:

begin -- comment

And I have the following states:


<State Key="CommentState" Token="CommentDefaultToken" Style="CommentDefaultStyle">
<!-- Scopes -->
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" Token="CommentStartToken" Style="CommentDelimiterStyle" PatternValue="--" />
<RegexPatternGroup Type="EndScope" Token="CommentStringEndToken" Style="CommentDelimiterStyle" PatternValue="{LineTerminatorMacro}" />
</Scope>
</Scopes>
<!-- Patterns Groups -->
<PatternGroups>
<RegexPatternGroup Token="CommentDefaultToken" PatternValue="{NonLineTerminatorMacro}+" />
</PatternGroups>
</State>

<State Key="BeginBlockState" Token="BeginBlockToken" Style="ReservedWordStyle">
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" Token="BeginStartToken" Style="ReservedWordStyle" PatternValue="Begin" LookAhead="{NonWordMacro}" />
<RegexPatternGroup Type="EndScope" Token="BeginEndToken" Style="DefaultStyle" PatternValue="[ ]|{LineTerminatorMacro}" />
</Scope>
</Scopes>

<PatternGroups>
<RegexPatternGroup Token="BeginBlockToken" PatternValue="\s+" />
</PatternGroups>

<ChildStates>
<ChildState Key="CommentState"/>
</ChildStates>
</State>

However, I want to end the Begin statement immediately after the begin but I cannot get it to end and the lineterminatormacro applies to the comment so the begin lineterminatormacro doesn't kick in for the begin until the next line so I get some weird parsing behavior since anything on the next line after the comment gets treated as "BeginBlockToken". Can someone tell me how I can get the parsing engine to end immediately after the begin so that it won't skip over the next line before it reaches the BeginEndToken.

Thanks

Comments (2)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Try this... Make a second CommentState that is specifically to be used on a line following a "begin". The second CommentState should be defined as the first except leave out the end scope. Let me know if that works.


Actipro Software Support

Posted 20 years ago by painetraine
Avatar
That seemed to fix it.

I created a new State, BeginCommentState and changed the child states to only include this child comment state which had the same definition but without the end scope.

Thanks
The latest build of this product (v24.1.1) 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.