Class: QgsVbScriptNode

Represents an abstract node for a VBScript script.

VBScript node subclasses are either:

  • statements (inheriting QgsVbSriptStatement), such as a variable declaration, if statement, for loop.

  • or expressions (inheriting QgsVbScriptExpression), which are a portion of a statement representing an expression. For example 1+2, Upper('A string'), or literals like 255 or 'a string'.

Added in version 4.4.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: accept(), clone(), dump(), nodeType()

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsVbScriptNode

Subclasses

QgsVbScriptExpression

Base class for expression nodes in a VBScript script.

QgsVbScriptStatement

Base class for statement nodes in a VBScript script.

Enums

NodeType

Node type identifier.

Abstract Methods

accept

Accepts a visitor to traverse the node.

clone

Creates a copy of the node.

dump

Returns the formatted script representation of the node.

nodeType

Returns the node type.

class qgis.core.QgsVbScriptNode[source]

Bases: object

class NodeType(*values)

Bases: Enum

Node type identifier.

  • BlockStatement: Block statement (a list of statements grouped together in a block)

  • VariableDeclarationStatement: Variable declaration statement

  • AssignmentStatement: Variable assignment statement

  • FunctionDeclarationStatement: Function declaration

  • ExpressionStatement: Expression

  • LiteralExpression: Literal

  • VariableReferenceExpression: Reference to a standard variable

  • MemberAccessExpression: Member access via bracket or notation (eg $feature.ATTRIBUTE or $feature["ATTRIBUTE"])

  • BinaryOperatorExpression: Binary Operator

  • UnaryOperatorExpression: Operator

  • FunctionCallExpression: Function call

  • IndexExpression: Index operator

  • ArrayLiteralExpression: A literal array, where the element values may be expressions themselves (eg [1, 2, 3/4])

  • IfStatement: If statement

  • ForStatement: For loop

  • ForEachStatement: For each loop

  • WhileStatement: While loop

  • ExitStatement: Exit loop statement

  • FieldReferenceExpression: Special ESRI specific reference to a layer’s field (eg [FIELD_NAME])

ArrayLiteralExpression = 12
AssignmentStatement = 2
BinaryOperatorExpression = 8
BlockStatement = 0
ExitStatement = 17
ExpressionStatement = 4
FieldReferenceExpression = 18
ForEachStatement = 15
ForStatement = 14
FunctionCallExpression = 10
FunctionDeclarationStatement = 3
IfStatement = 13
IndexExpression = 11
LiteralExpression = 5
MemberAccessExpression = 7
UnaryOperatorExpression = 9
VariableDeclarationStatement = 1
VariableReferenceExpression = 6
WhileStatement = 16
abstract accept(self, visitor: QgsVbScriptVisitor)[source]

Accepts a visitor to traverse the node.

Parameters:

visitor (QgsVbScriptVisitor)

abstract clone(self) → QgsVbScriptNode | None[source]

Creates a copy of the node.

Caller takes ownership of the returned object.

Return type:

QgsVbScriptNode|None

abstract dump(self) → str[source]

Returns the formatted script representation of the node.

This can be used to export a script node back to a valid VBScript string.

Return type:

str

abstract nodeType(self) → QgsVbScriptNode.NodeType[source]

Returns the node type.

Return type:

QgsVbScriptNode.NodeType