Multiline comment question

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Matthew Smith - Developer, One Plus One Solutions Pty Limited
Version: 4.0.0247
Avatar
Hi,

Creating a dynamic language and have a quick question. Have the following defined for multiline comments and it works fine. I just would like the casing of the Rem and End Rem tags to be auto corrected. Can anyone offer some assistance??

    <!-- MultiLine Comments -->
    <State Key="MultiLineCommentState" TokenKey="MultiLineCommentDefaultToken" Style="CommentDefaultStyle">
      <!-- Scopes -->
      <Scopes>
        <Scope>
          <RegexPatternGroup Type="StartScope" TokenKey="MultiLineCommentStartToken" Style="CommentDelimiterStyle" PatternValue="Rem {WhitespaceMacro}* {LineTerminatorMacro}" />
          <RegexPatternGroup Type="EndScope" TokenKey="MultiLineCommentEndToken" Style="CommentDelimiterStyle" PatternValue="End {WhitespaceMacro}* Rem" />
        </Scope>
      </Scopes>
      <!-- Patterns Groups -->
      <PatternGroups>
        <RegexPatternGroup TokenKey="MultiLineCommentDefaultToken" PatternValue="{LineTerminatorMacro}" />
      </PatternGroups>
    </State>
I think I need to define it using the ExplicitPatternGroup scope but are not quite sure.


[Modified at 04/17/2007 06:55 AM]

Regards, Matt

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Correct, regular expression patterns don't support auto-case correction.


Actipro Software Support

Posted 12 years ago by Matthew Smith - Developer, One Plus One Solutions Pty Limited
Avatar
Hi,

I have a follow-up question in regards to the multi-line pattern above. The speed is currently terrible (5-7 seconds to process) for this when I have around 1500 rows and type Rem on the first row.

Could anyone offer any suggestions to speed it up. I have noted the /* */ on the C# template is very fast, but cannot get something working based on this??

Note: the function need to turn all text inclusive of Rem .. End Rem green and also requires End Rem to be picked up as EndRem (no space).

Any help would be greatly appreciated.

Regards, Matt

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

One thing I can see is that you need work in your token patterns for the contents of the comment state. What you have now is essentially going to make one token for each character, which is probably causing your lag and is eating up a lot more memory than needed. Try changing your pattern from "{LineTerminatorMacro}" to something more like "[^Ee]+". That will make a really long run of characters while still allowing a break for the end scope to be recognized (since it starts with E).


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.