How to add new character in the list of allowed characters in the script

SyntaxEditor for WPF Forum

Posted 2 years ago by Ranjit
Version: 17.2.0665
Platform: .NET 4.7
Environment: Windows 10 (64-bit)
Avatar

In an  script , i have added the below line

Tag = GetApplicationDirectory() + "\" + "Some Text";

Issue :-

Everything after "\ " will be marked incorrect with red underline. But i dont to consider this as error.

Is there any way to allow this single slash as the valid character in the syntax editor.

Comments (5)

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

Hello,

I assume you are using the C# language in our .NET Languages Add-on here?  That's not a valid string literal if you are, and that would definitely raise a syntax error.  You need to escape the backslash or do @"\" instead.


Actipro Software Support

Posted 9 months ago by Ranjit
Avatar

Hello Thank you for you reply.

Can you please let met know Is there any property that can be set from out side of the sytax editor in order to allow the "\" as valid string literal ?. Because if i use "\\" then we are getting different behaviour in our application.

Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You never answered if you are using the C# language in our .NET Languages Add-on, or some other language.

If you are using our advanced C# language then no, it's lexing tokens programmatically according to the C# specification.  There isn't a way to modify that programmatic logic externally without source.  In C#, "\" isn't a valid string.  In that case, I would recommend you update your application logic to support "\\" or @"\" per the C# specification.


Actipro Software Support

Posted 9 months ago by Ranjit
Avatar

we have using the below script

DIM str as Message;      

str = RootFolderDrive + "\";

This is showing highlight error under "\".

In the code we have used the below patterngroup for string::

 lexicalPatternGroup = new DynamicLexicalPatternGroup(DynamicLexicalPatternType.Regex, "String", classificationTypeProvider.String);
 lexicalPatternGroup.TokenId = QuickScriptTokenId.String;
 lexicalPatternGroup.Patterns.Add(new DynamicLexicalPattern("\\\"((\\\\.)|[^\\\\\\\\\\\"])*\\\""));

Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Do you want to allow a backslash to escape any characters at all?  Meaning do you want to always treat it as a normal character and not an escape marker?  If so, you could just change the pattern's interior between the outer quotes to look for any character that isn't a quote.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.