How to use Token.IsComment

SyntaxEditor for Windows Forms Forum

Posted 7 years ago by Joachim Schwieren
Version: 12.1.0302
Avatar

Hi,

the Token-class has a IsComment member to determine if this token is a comment? How can this property be set? Is there a way to define a certain lexical state in the XML syntax definition file of a dynamic language as "comment" which will then set all token which as in this state to IsComment=true?

Thanks for your help and best regards,

      Joachim

Comments (8)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Joachim,

It's just an informational property, however it's only usable by programmatic lexers that make their own token classes.  There isn't anything on dynamic lexers that will set it.  To check for a comment in a dynamic lexer, you'll want to compare the token's ID or key to a list of comment-related IDs/keys.


Actipro Software Support

Posted 7 years ago by Mike Dempsey - Sr. Developer, Teradata Corp
Avatar

If that's the case then how do the GoToNextNonWhitespaceOrCommentToken() and GoToPreviousNonWhitespaceOrCommentToken methods work when using a Dynamic language?

I already have a problem open concerning these functions NOT skipping over tokens that are defined with isWhitespace="True", but if I can't set isComment then these functions are basically useless.

Or am I missing something here?

Thanks
Mike

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

Sorry but dynamic lexers don't have a way to set IsComment right now.  You can easily make a similar method though that loops through tokens, checks their token IDs/keys for a Comment value or Whitespace value, then quit if you find a token that doesn't match that criteria.  It would be a simple procedure to write.


Actipro Software Support

Posted 7 years ago by Mike Dempsey - Sr. Developer, Teradata Corp
Avatar

That's what I did.

However since you have the infrastructure already in place (and specific methods defined in the TextStream class to use it) could you please add a way to set isComment for Dynamic languages in a future release.

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

Yes, we already added it for the next maintenance release.


Actipro Software Support

Posted 6 years ago by James Sconfitto - Exele Information Systems, Inc.
Avatar

i'm bummed that this didn't make it into the latest update (or am i missing something?). Is this still on the table?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

It is in there already, however it looks like we might have missed a couple places in the ActiproSoftware.SyntaxEditor.LanguageDefinition.xsd file where IsComment should have been added.  So it might not show up in Visual Studio Intellisense everywhere it should.  We'll fix that for the next version.


Actipro Software Support

Posted 6 years ago by James Sconfitto - Exele Information Systems, Inc.
Avatar

Thanks, i'll give it a second look.

The latest build of this product (v2018.1 build 0342) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.