Posted 2 years ago by Vladimirs Kacs
Version: 16.1.0636
Avatar

I would like to define a dialect of the language. How do I do this?

 

What exactly I am trying to do:

I need certain controls to validate strings (while, preferably, keeping the rest of the language syntax, which is VB, intact.) as though they were SQL. How can I modify (or perferably add) rules to the syntaxEditor?

dim sqlString = "SELECT field from table where otherField= 'value'

[Modified 2 years ago]

Comments (3)

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

Hello,

Do you mean that your special syntax is still fully standardized VB syntax, but certain strings might have SQL commands in them?  And there is no separate special syntax for those SQL strings?

Are you wanting something in the async parsing phase to be able to locate those kinds of strings in the AST and then run some validation logic on them to ensure they are valid SQL commands?


Actipro Software Support

Posted 2 years ago by Vladimirs Kacs
Avatar

No validation, just highlighting syntax: keywords, escaped strings, brackets and that sort of thing.

My question is really about how to modify a SyntaxLanguage.

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

Hello,

In that case, I would recommend not changing the default tokenization, so that parsing etc. all continues working properly.

What you could do is use a classification tagger and provide custom tagged ranges over the string's range to alter the syntax highlighting.  Several adornments QuickStarts show use of classification taggers.  For instance, the "Adornments 4 - Highlight Word" one uses a classification tagger to change highlighting for certain ranges.  It is called when a view line is about to be rendered and can return tagged ranges on the fly.

May I ask how you would know which strings contain SQL and which don't?


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.