GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | List of all members
gd::ExpressionParser2 Class Reference

Parse an expression, returning a tree of node corresponding to the parsed expression. More...

#include <ExpressionParser2.h>

Public Member Functions

 ExpressionParser2 (const gd::Platform &platform_, const gd::ObjectsContainer &globalObjectsContainer_, const gd::ObjectsContainer &objectsContainer_)
 
std::unique_ptr< ExpressionNodeParseExpression (const gd::String &type, const gd::String &expression_, const gd::String &objectName="")
 

Detailed Description

Parse an expression, returning a tree of node corresponding to the parsed expression.

This is a LL(1) parser. This could be extracted to a generic/reusable parser by refactoring out the dependency on gd::MetadataProvider (injecting instead functions to be called to query supported functions).

See also
gd::ExpressionParserDiagnostic
gd::ExpressionNode

Member Function Documentation

std::unique_ptr<ExpressionNode> gd::ExpressionParser2::ParseExpression ( const gd::String type,
const gd::String expression_,
const gd::String objectName = "" 
)
inline

Parse the given expression with the specified type.

Parameters
typeType of the expression: "string", "number", type supported by gd::ParameterMetadata::IsObject, types supported by gd::ParameterMetadata::IsExpression or "unknown".
expressionThe expression to parse
objectNameSpecify the object name, only for the case of "objectvar" type.
Returns
The node representing the expression as a parsed tree.

The documentation for this class was generated from the following files: