Add the KAST expression to the checkers.xml file
Now that the checker's KAST expression is complete and tested, it can be added to the checkers.xml
file, which was generated at the beginning of this tutorial.
- Open
KASTJ.MYCHECKER/checkers.xml
in the editor of your choice.When the file was generated, its values were automatically populated with an error ID, severity, message, and title, as well as a sample KAST expression.
- Look for the <pattern> tag.
- Replace the sample KAST expression with your tested KAST expression, which is:
//ExprBinary[@Op=OP_ASSIGN][Expr2::ExprPrefix[@Op=OP_PLUS]]
- You can also edit the <error id> attributes, as required. For this tutorial, we'll change the title attribute to read "Assignment instead of plusequal" and the message attribute to read "Possible undesired assignment instead of plusequal operation".
- Save the file.