Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

Conditions

Each element of a KAST expression can have zero or more conditions.

Each condition is a boolean expression and must be surrounded by square brackets. A path element is matched with an AST node if all the corresponding conditions are met.

Expressions can be of one of the following types:

  • BOOL
  • INT
  • DOUBLE
  • TREE (AST nodes)
  • SEMA (semantic information associated with AST nodes)
  • STRING

BOOL, INT and DOUBLE values can be converted into each other; TREE and SEMA values can be converted to the BOOL type.

The following types of expressions are supported:

Path expression: Starts with a child qualifier:

[Expr::ExprBinary/Expr1::ExprConst]
Note: When a path expression constitutes the whole KAST pattern, it starts with '//' followed by a node type name. This means that corresponding subtrees are matched anywhere in the AST. On the other hand, when a path expression is one of the conditions or a part of a condition in a KAST expression, it starts with a child name or any other axis qualifier instead. This means that the path must start from the node this expression is related to.

Or expression:

Expression1 | Expression2

Not expression:

not Expression

Function expression:

Func(Expr1, Expr2, ...)

You can use both built-in functions and custom functions.

See Java custom functions.

Dot expression:

Expression.Func(...)

The right part of such expression must be a function call. The expression in the left part of the dot expression is treated as the first argument of the function in the right part: a.b(c) is equivalent to b(a, c).

Attribute expression:

@attribute_name

Arithmetic expression:

Expression1 [+, -, /, *] Expression2

Relational expression:

Expression1 [>, <, >=, <=, =, !=] Expression2

Bracket expression:

(Expression)

Constant expression:

'abc' , 2.0

There are a number of literal representations for integer constants representing operation types, class specifiers, etc.

Variable expression:

$variable

See Variables.

Supported operations

The operations below are ordered by priority, with the highest priority at the top.

(), . not +, - >, >=, <, <= =, != |