Class: QgsEsriArcadeNode

Represents an abstract node for an Esri Arcade script.

Arcade node subclasses are either:

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

  • or expressions (inheriting QgsEsriArcadeExpression), 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.QgsEsriArcadeNode

Subclasses

QgsEsriArcadeExpression

Base class for expression nodes in an Esri Arcade script.

QgsEsriArcadeStatement

Base class for statement nodes in an Esri Arcade 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.QgsEsriArcadeNode[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

  • ReturnStatement: Return statement

  • AssignmentStatement: Variable assignment statement

  • FunctionDeclarationStatement: Function declaration

  • ExpressionStatement: Expression

  • LiteralExpression: Literal

  • VariableReferenceExpression: Reference to a standard variable

  • ProfileVariableReferenceExpression: Reference to a profile variable (eg $feature)

  • 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])

  • DictionaryLiteralExpression: A literal dictionary, eg {key: 1, other_key: 2}

  • IfStatement: If statement

  • ForStatement: For loop

  • ForInStatement: For x in y loop

  • WhileStatement: While loop

  • BreakStatement: Break statement

  • ContinueStatement: Continue statement

ArrayLiteralExpression = 14
AssignmentStatement = 3
BinaryOperatorExpression = 10
BlockStatement = 0
BreakStatement = 20
ContinueStatement = 21
DictionaryLiteralExpression = 15
ExpressionStatement = 5
ForInStatement = 18
ForStatement = 17
FunctionCallExpression = 12
FunctionDeclarationStatement = 4
IfStatement = 16
IndexExpression = 13
LiteralExpression = 6
MemberAccessExpression = 9
ProfileVariableReferenceExpression = 8
ReturnStatement = 2
UnaryOperatorExpression = 11
VariableDeclarationStatement = 1
VariableReferenceExpression = 7
WhileStatement = 19
abstract accept(self, visitor: QgsEsriArcadeVisitor)[source]

Accepts a visitor to traverse the node.

Parameters:

visitor (QgsEsriArcadeVisitor)

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

Creates a copy of the node.

Caller takes ownership of the returned object.

Return type:

QgsEsriArcadeNode|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 Esri arcade script string.

Return type:

str

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

Returns the node type.

Return type:

QgsEsriArcadeNode.NodeType