Actifsource

#6857 [Story/CodeSnippet] Add user defined codesnippet validators and mark the inconsistencies with error warning and info

Actifsource code generator for any programming language
Release: Actifsource V11.3.0

It should be possible to define additional validators in the codesnippet (besides the syntax check). Which marks the found inconsistency at the appropriate place in the codesnippet.


This can be used customer specific to e.g. check number and type of function parameters or type compatibility for assignments (Type safety)...


The validation should be done by a usual 'ResourceValidationAspect' which is defined e.g. on the parent resource of the codesnippet.
In addition, the transient CMinus 'CompilationUnit' should be able to be used.


To find back from the parsed cMinus 'CompilationUnit' to the exact position in the codesnippet, the BackLink must be enabled:

6857 1 CodesnippetOption1

Codesnippet to validate:

6857 2 CodesnippetOption2

Parsed cMinus 'CompilationUnit' from codesnippet:

6857 3 CodesnippetOption3

Each expression now has a backlink over which the range in the codesnippet is defined.


To validate the codesnippet, a validation aspect must be defined:

6857 4 CodesnippetOption4

Using the CompilationUnit the Invalid expressions can be found and the inconsistencies can be added as e.g. warning:

6857 5 CodesnippetOption5

The Codesnippet shows the warning:

6857 6 CodesnippetOption6

On github the example has been extended: