class PDI::Expression

Content

Member Functions

Expression ( )
Builds an empty expression.
Expression ( const Expression & expr )
Copies an expression.
Expression ( Expression && expr )
Moves an expression.
Expression ( const char * expr )
Builds (i.e.
Expression ( const std::string & expr )
Builds (i.e.
Expression ( long expr )
Builds an expression that represents an integer.
Expression ( double expr )
Builds an expression that represents a float.
Expression ( PC_tree_t expr )
Builds an expression that is parsed from PC_tree_t.
operator bool ( )
Checks whether this is an empty expression.
Expression operator% ( const Expression & expr )
Modulo operator of an expression.
Expression operator* ( const Expression & expr )
Multiplication operator of an expression.
Expression operator+ ( const Expression & expr )
Summation operator of an expression.
Expression operator- ( const Expression & expr )
Subtraction operator of an expression.
Expression operator/ ( const Expression & expr )
Division operator of an expression.
Expression & operator= ( const Expression & expr )
Copies an expression.
Expression & operator= ( Expression && expr )
Moves an expression.
double to_double ( Context & ctx )
Evaluates an expression as a float.
long to_long ( Context & ctx )
Evaluates an expression as an integer.
Ref to_ref ( Context & ctx )
Evaluates an expression as a data reference.
Ref to_ref ( Context & ctx, const Datatype & type )
Evaluates an expression as a data reference.
std::string to_string ( Context & ctx )
Evaluates an expression as a string.
~Expression ( )
Destroys an expression.

Documentation

Member Functions

Expression ( )

Description

Builds an empty expression. No operation can be used on an empty expression, it can only be assigned to

Expression ( const Expression & expr )

Description

Copies an expression.

Parameters

expr
the expression to copy

Expression ( Expression && expr )

Description

Moves an expression.

Parameters

expr
the expression to move

Expression ( const char * expr )

Description

Builds (i.e.

parse) an expression from a string

The grammar of an expression is as follow:

/* parsing as a REFERENCE is preferred over OPERATION
   parsing as an OPERATION is preferred over STRING_LITERAL
*/
EXPRESSION     := REFERENCE | OPERATION | STRING_LITERAL

STRING_LITERAL := ( CHAR | '' '' | '' '$' | REFERENCE | '$' '(' OPERATION ')' )*

/* The operator descending precedence order is:

  1. *, /, %: multiplication, division and modulo,
  2. +, -: addition and subtraction,
  3. <, >: less than and greater than,
  4. =: equality,
  5. &: logical AND,
  6. |: logical OR. / OPERATION := TERM ( OPERATOR TERM )

TERM := ( INT_LITERAL | REFERENCE | '(' OPERATION ')' )

REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )

IREFERENCE := ID ( '[' OPERATION ']' | '.' ID )*

INT_LITERAL ~= (0x)? [0-9]+ ( . ) ID ~= [a-zA-Z_][a-zA-Z0-9_]* CHAR ~= [^$\] OPERATOR ~= [|&=<>+-*/%]

Parameters

expr
the string to parse

Expression ( const std::string & expr )

Description

Builds (i.e.

parse) an expression from a string

The grammar of an expression is as follow:

/* parsing as a REFERENCE is preferred over OPERATION
   parsing as an OPERATION is preferred over STRING_LITERAL
*/
EXPRESSION     := REFERENCE | OPERATION | STRING_LITERAL

STRING_LITERAL := ( CHAR | '&#39; '&#39; | '&#39; '$' | REFERENCE | '$' '(' OPERATION ')' )*

/* The operator descending precedence order is:

  1. *, /, %: multiplication, division and modulo,
  2. +, -: addition and subtraction,
  3. <, >: less than and greater than,
  4. =: equality,
  5. &: logical AND,
  6. |: logical OR. / OPERATION := TERM ( OPERATOR TERM )

TERM := ( INT_LITERAL | REFERENCE | '(' OPERATION ')' )

REFERENCE := '$' ( IREFERENCE | '{' IREFERENCE '}' )

IREFERENCE := ID ( '[' OPERATION ']' | '.' ID )*

INT_LITERAL ~= (0x)? [0-9]+ ( . ) ID ~= [a-zA-Z_][a-zA-Z0-9_]* CHAR ~= [^$\] OPERATOR ~= [|&=<>+-*/%]

Parameters

expr
the string to parse

Expression ( long expr )

Description

Builds an expression that represents an integer.

Parameters

expr
the integer value

Expression ( double expr )

Description

Builds an expression that represents a float.

Parameters

expr
the flaot value

Expression ( PC_tree_t expr )

Description

Builds an expression that is parsed from PC_tree_t.

Parameters

expr
the PC_tree_t value

operator bool ( )

Description

Checks whether this is an empty expression.

Expression operator% ( const Expression & expr )

Description

Modulo operator of an expression.

Parameters

expr
the expression to use modulo

Result

Expression as a result of modulo

Expression operator* ( const Expression & expr )

Description

Multiplication operator of an expression.

Parameters

expr
the expression to multiply

Result

Expression as a result of multiplication

Expression operator+ ( const Expression & expr )

Description

Summation operator of an expression.

Parameters

expr
the expression to add

Result

Expression as a result of sum

Expression operator- ( const Expression & expr )

Description

Subtraction operator of an expression.

Parameters

expr
the expression to subtract

Result

Expression as a result of subtraction

Expression operator/ ( const Expression & expr )

Description

Division operator of an expression.

Parameters

expr
the expression to divide

Result

Expression as a result of division

Expression & operator= ( const Expression & expr )

Description

Copies an expression.

Parameters

expr
the expression to copy

Result

*this

Expression & operator= ( Expression && expr )

Description

Moves an expression.

Parameters

expr
the expression to move`

Result

*this

double to_double ( Context & ctx )

Description

Evaluates an expression as a float.

Parameters

ctx

Result

the float value

long to_long ( Context & ctx )

Description

Evaluates an expression as an integer.

Parameters

ctx

Result

the integer value

Ref to_ref ( Context & ctx )

Description

Evaluates an expression as a data reference.

Parameters

ctx
the context in which to evaluate the expression

Result

the data reference

Ref to_ref ( Context & ctx, const Datatype & type )

Description

Evaluates an expression as a data reference.

Parameters

ctx
the context in which to evaluate the expression
type
the type of the created Ref

Result

the data reference

std::string to_string ( Context & ctx )

Description

Evaluates an expression as a string.

Parameters

ctx

Result

the string value

~Expression ( )

Description

Destroys an expression.

Last modified January 1, 0001