KADABRA API

LARA API

LARA Common Language API

(.js)
laraImport("kadabra.KadabraNodes");

(.lara)
import kadabra.KadabraNodes;

KadabraNodes

KadabraNodes

KadabraNodes

Utility methods related with the creation of new join points.


Static Members

assignment

assignment(lhs, rhs)

Creates an assignment.

Parameters

lhs: expression - The left-hand side, must be a join point of type expression.
rhs: expression - The right-hand side, must be a join point of type expression.

Returns

assignment - an assignment statement.

binaryExpression

binaryExpression(operator, lhs, rhs)

Creates a binary expression.

Parameters

operator: string - The string representing the operator, can be one of "+", "-", "*", "/", "%", "||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>", ">>>" or "instanceof".
lhs: expression - The left-hand side, must be a join point of type expression.
rhs: expression - The right-hand side, must be a join point of type expression.

Returns

expression - an expression representing the literal. If the literal is a negative number, it will return a unaryExpression, otherwise returns a literal.

comment

comment(comment, [type = "block"])

Creates a comment node.

Parameters

comment: string - The string representing the contents of a comment.
type: string - The type of the comment. Can be one of 'File', 'Javadoc', 'Inline' or 'Block'. If not specified, uses Block as default. (optional)

Returns

comment - a node representing the comment

literal

literal(literal-, type, literal)

Creates a literal node.

Parameters

literal-: string - The string representing the literal. Can pass negative literals.
type: string - The type of the literal. Can be one of int, long, float, double, char, String or boolean.
literal: any

Returns

expression - an expression representing the literal. If the literal is a negative number, it will return a unaryExpression, otherwise returns a literal.

snippetExpr

snippetExpr(code)

Creates an expression from code snippet.

Parameters

code: string - The literal code that represents the expression.

Returns

expression - an expression representing the code snippet.

unaryExpression

unaryExpression(operator, operand)

Creates a unary expression.

Parameters

operator: string - The string representing the operator, can be one of "+", "-", "!", "~", "++_", "--_", "_++", "_--", "++" or "--".
operand: expression - The operand, must be a join point of type expression.

Returns

expression - an expression representing the literal. If the literal is a negative number, it will return a unaryExpression, otherwise returns a literal.

var

var(localVariable, [isWrite = false])

Creates a reference to a local variable.

Parameters

localVariable: localVariable - The local variable declaration to which we will create a variable reference.
isWrite: boolean - True if the variable will be written, false if it will be read. By default creates variables for reading. (optional)

Returns

var - a reference to a variable.