Page tree

Skip to end of metadata
Go to start of metadata

Choose Nodes> Node Dictionary> C++Text to access the C++test node dictionary. The available node property options are described in this section. These options appear when you right-click on a rule node in the Rule/Results panel. This action opens a shortcut menu.

Not all node property options will appear in the shortcut menu; only those options that are viable for the parent node in question will be available. There are two kinds of node properties in the C++Text dictionary:

 

Textnode Properties

The following textnode properties are available:

Name

Represents name of textnode. Usually this is the direct node name, but sometimes for special nodes the value of name is different. Special nodes include #define and #include. For example:

statement if  Name is string "if"
#define MAX_VAL 512 Name is string "MAX_VAL"
#define SUM(A,B)(A+B) Name is string "SUM"
#include <stdio.h> Name is string "<stdio.h>"

Value - '#define' textnode only

Represents value for special textnode #define. For example:

#define MAX_VAL 512  Value is string "512"
#define SUM(A,B)(A+B) Value is string "(A+B)"

Parameters - '#define' textnode only

Get textnode(s) type of 'Identifier Constant'. Represents parameters in macro. For example:

#define SUM(A,B)(A+B) Parameters are textnodes: "A" and "B"

StartColumn

Represents numerical value of start column for given textnode. For example:

if(true) For statement if StartColumn
numerical value is 1
if(true) For statement if StartColumn 
numerical value is 6
\_ sixth column
\_ first column

EndColumn

Represents numerical value of end column for given textnode. For example:

if(true) For statement if EndColumn numerical 
value is 2
if(true) For statement if EndColumn 
numerical value is 7.
\_ seventh column
\_ second column

StartLine

Get linenode type of 'Line' represents start line that includes given textnode. From this linenode it is possible to get information about numerical value of start line but also about other properties. See Linenode Properties.

EndLine

Get linenode type of 'Line' represents end line that includes given textnode. From this Line node it is possible to get information about numerical value of end line but also about other properties. See Linenode Properties.

Filename

Name of the file that contains the node.

LastInBody

Checks Boolean property. Returns true if the textnode is last in the body.

LastInLine

Checks Boolean property. Returns true if the textnode is last in the line.

LastInLineIgnoringWhiteSpace

Checks Boolean property. Returns true if the textnode is last in the line. Spaces and tabs are ignored.

LastInLineIgnoringWhiteSpaceAndComments

Checks Boolean property. Returns true if the textnode is last in the line. Spaces, tabs, and comments are ignored.

Next

Get next textnode(s). There are two options for this property:

The Next Direct Check option gets next textnode. For example:

int myValue = 5;

The Next InDirect Check option gets a collection of the same repeated textnodes up to the different node. For example:

int myValue    = 5;

Next(InDirect) from myValue is a collection of four textnodes Space.

IsMacro

Returns true if the Token or Identifier Constant is a macro. For example:

void FOO(int x);
void bar(int x) {
   #define FOO(x) x++;
   FOO(x);     /* IsMacro = true for token 'FOO' */
   #undef FOO
   FOO(x);     /* IsMacro = false for token 'FOO' */
}

NextIgnoringWSAndCommentsAndBackslash

Get next textnode(s). Comments, spaces, tabs and backslashes that precede new lines (line continuation characters) are ignored. There are two options.

The NextIgnoringWSAndCommentsAndBackslash Direct Check option gets next nextnodes. For example:

int myValue /* description for variable */ \
  = 5;
 

NextIgnoringWSAndCommentsAndBackslash(Direct) from myValue is the first textnode = (Assignment operator).

The NextIgnoringWSAndCommentsAndBackslash InDirect Check option gets a collection of all textnodes up to the end of the body. For example:

void foo() {
    int myValue = \
       5;
    //some text explaining usage of value myChar, for example
    int myChar = 'd';
};

NextIgnoringWSAndCommentsAndBackslash(InDirect) from myValue is a collection of eight textnodes of different types: =,5,;,int,myChar,=,'d',;

NextIgnoringWhitespace

Get next textnode(s). Spaces and tabs are ignored. There are two options.

The NextIgnoringWhitespace Direct Check option gets next textnodes. For example:

int myValue = 5;

NextIgnoringWhitespace(Direct) from myValue is the first textnode 'Assignment operator'.

The NextIgnoringWhitespace InDirect Check gets a collection of all textnodes up to end of body. For example:

void foo() {
    int myValue = 5;
    int myChar = 'd';
};

Next(InDirect) from myValue is collection of eight textnodes of different types: =,5,;,int,myChar,=,'d',;

NextIgnoringWhitespaceAndComments

Get next textnode(s). Comments, spaces, and tabs are ignored. There are two options.

The NextIgnoringWhitespaceAndComments Direct Check option gets the next textnode. For example:

int myValue /* description for variable */ = 5;

NextIgnoringWhitespaceAndComments(Direct) from myValue is the first textnode = (Assignment operator).

The NextIgnoringWhitespaceAndComments InDirect Check option gets collection of all textnodes up to end of body. For example:

void foo() {
    int myValue = 5;
    //some text explaining usage of value myChar, for example
    int myChar = 'd';
};

Next(InDirect) from myValue is collection of eight textnodes of different types: =,5,;,int,myChar,=,'d',;

Previous

Get previous textnode(s). There are two options.

The Previous Direct Check option gets previous textnode. For example:

int myValue = 5; 

Previous(Direct) from myValue is the first textnode space.

The Previous InDirect Check option gets a collection of all textnodes up to the beginning of the body. For example:

int myValue    = 5;

Previous(InDirect) from myValue is a space and int.

PreviousIgnoringWhitespace

Get previous textnode(s). Spaces and tabs are ignored. There are two options.

The PreviousIgnoringWhitespace Direct Check option gets previous textnode. For example:

int myValue = 5;

PreviousIgnoringWhitespace(Direct) from myValue is the first textnode int.

The PreviousIgnoringWhitespace InDirect Check option gets collection of all textnodes up to beginning of body. For example:

void foo() {
    int myValue = 5;
    int myChar = 'd';
};

Previous(InDirect) from myChar is a collection of six textnodes of different types: int,;,5,=,myValue,int

PreviousIgnoringWhitespaceAndComments

Get previous textnode(s). Comments, spaces, and tabs are ignored. There are two options.
The PreviousIgnoringWhitespaceAndComments Direct Check option gets previous textnode. For example:

int /* comment */ myValue = 5;

PreviousIgnoringWhitespaceAndComments(Direct) from myValue is first textnode int

The PreviousIgnoringWhitespaceAndComments InDirect Check option gets a collection of all textnodes up to end of body. For example:

void foo() {
    int myValue = 5;
    //some text explaining usage of value myChar, for example
    int myChar = 'd';
};

Previous(InDirect) from myChar is collection of eight textnodes of different types: int,;,5.=,myValue,int

BackwardLastOf

Searches for elements within searching chain from right to left. Use to find a specific element and ignore some others.

ForwardLastOf

Searches for elements within searching chain from left to right. Use to find a specific element and ignore some others.

Body

The Body property is the opposite of Context property.

The {, [, (, #define and #pragma textnodes have bodies consisting of additional textnode(s).

For the {, [ and ( textnodes:

  • Body beginning: first textnode after {, [, (.
  • Body ending: last textnode before }, ], or ).

For the #define and #pragma textnodes:

  • Body beginning: first textnode after #define/#pragma (usually space).
  • Body ending: last textnode in the #define/#pragma (usually last textnode in line).

There are two options for the body property.

The Body Direct Check option gets the first textnode in the body. For example:

void foo() {
    int g;
}

Body Direct from { is the first textnode in the body type of space. For example:

#define MAX_VAL 512 //"MAX VAL"

Body Direct from #define is the first textnode in the body type of space.

The Body InDirect Check option gets a collection of all textnodes inside body. For example:

void foo() {
    int g;
}

Body InDirect from { is a collection of eight textnodes of different types: four spaces, int,’Space’,g,; . For example:

#define MAX_VAL 512 //"MAX VAL"

Body InDirect from #define is collection of six textnodes of different types: space, MAX_VAL,’Space’,512,’Space’,//"MAX VAL".

Context

The Context property is the opposite of the Body property.

The following textnodes inside the body belong to root textnodes: {, [, (, #define and #pragma.

There are two options available for the context property:

The Context Direct Check option gets first textnode in context. For example:

void foo(int val) {
 int tabs[10];
}

Context Direct from 'Number Constant' is the [ textnode.

The Context InDirect Check option gets a collection of contexts textnodes. For example:

void foo(int val) {
 int tabs[10];
}


Context (InDirect) from 'Number Constant' are the [ and { textnodes.

Linenode Properties

The following linenode properties are available:

All

Gets textnode(s) in a line. There are two options:

The All Direct Check option gets the first textnode in the line. For example:

int returnOne() { return 1;}

All Direct from the line is the int 'Identifier Constant'.

The All InDirect Check option gets a collection of all textnodes in the line. For example:

int returnOne() { return 1;}

All InDirect from is a collection of different textnode types: int,’Space’,returnOne,(,),’Space’,{’Space’,return,’Space’,1,;,}

Next

Gets the next linenode(s) for a given line. There are two options:

The Next Direct Check option gets the next linenode.

The Next InDirect Check option gets collection of all linenode type ’Lines’ after the given line.

Line

Represents the numerical value of a line number for a given linenode. An example with line numbers is given below:

1... int returnOne() {
2... return 1;
3... }

Line numerical value: 1,2,3

  • No labels