App::ExpressionParser Namespace Reference

Classes

class  ExpressionImporter
 Convenient class to mark begin of importing. More...
 
class  semantic_type
 The semantic_type class encapsulates the value in the parse tree during parsing. More...
 

Functions

void ExpressionParser_yyerror (const char *errorinfo)
 Error function for parser. More...
 
int ExpressionParserlex (void)
 
static void initParser (const App::DocumentObject *owner)
 
bool isModuleImported (PyObject *module)
 
bool isTokenAnIndentifier (const std::string &str)
 
bool isTokenAUnit (const std::string &str)
 
double num_change (char *yytext, char dez_delim, char grp_delim)
 
Expressionparse (const App::DocumentObject *owner, const char *buffer)
 Parse the expression given by buffer, and use owner as the owner of the returned expression. More...
 
ObjectIdentifier parsePath (const App::DocumentObject *owner, const char *buffer)
 
UnitExpressionparseUnit (const App::DocumentObject *owner, const char *buffer)
 
std::vector< std::tuple< int, int, std::string > > tokenize (const std::string &str)
 

Variables

static int column
 
static const App::DocumentObjectDocumentObject = nullptr
 The DocumentObject that will own the expression. More...
 
static std::stack< std::string > labels
 Label string primitive. More...
 
static int last_column
 
static std::map< std::string, FunctionExpression::Functionregistered_functions
 Registered functions. More...
 
static ExpressionScanResult = nullptr
 The resulting expression after a successful parsing. More...
 
static bool unitExpression = false
 True if the parsed string is a unit only. More...
 
static bool valueExpression = false
 True if the parsed string is a full expression. More...
 

Function Documentation

◆ ExpressionParser_yyerror()

void App::ExpressionParser::ExpressionParser_yyerror ( const char *  errorinfo)

Error function for parser.

Throws a generic Base::Exception with the parser error.

◆ ExpressionParserlex()

int App::ExpressionParser::ExpressionParserlex ( void  )

◆ initParser()

◆ isModuleImported()

bool App::ExpressionParser::isModuleImported ( PyObject module)

◆ isTokenAnIndentifier()

bool App::ExpressionParser::isTokenAnIndentifier ( const std::string &  str)

References ExpressionParserlex().

◆ isTokenAUnit()

bool App::ExpressionParser::isTokenAUnit ( const std::string &  str)

References ExpressionParserlex().

◆ num_change()

double App::ExpressionParser::num_change ( char *  yytext,
char  dez_delim,
char  grp_delim 
)

◆ parse()

Expression * App::ExpressionParser::parse ( const App::DocumentObject owner,
const char *  buffer 
)

Parse the expression given by buffer, and use owner as the owner of the returned expression.

If the parser fails for some reason, and exception is thrown.

Parameters
ownerThe DocumentObject that will own the expression.
bufferThe string buffer to parse.
Returns
A pointer to an expression.

References initParser(), ScanResult, and valueExpression.

Referenced by App::ObjectIdentifier::parse(), App::Expression::parse(), and Spreadsheet::Cell::setContent().

◆ parsePath()

ObjectIdentifier App::ExpressionParser::parsePath ( const App::DocumentObject owner,
const char *  buffer 
)

◆ parseUnit()

◆ tokenize()

std::vector< std::tuple< int, int, std::string > > App::ExpressionParser::tokenize ( const std::string &  str)

Variable Documentation

◆ column

int App::ExpressionParser::column
static

◆ DocumentObject

const App::DocumentObject* App::ExpressionParser::DocumentObject = nullptr
static

The DocumentObject that will own the expression.

Referenced by initParser().

◆ labels

std::stack<std::string> App::ExpressionParser::labels
static

Label string primitive.

Referenced by initParser().

◆ last_column

int App::ExpressionParser::last_column
static

Referenced by tokenize().

◆ registered_functions

std::map<std::string, FunctionExpression::Function> App::ExpressionParser::registered_functions
static

Registered functions.

Referenced by initParser().

◆ ScanResult

Expression* App::ExpressionParser::ScanResult = nullptr
static

The resulting expression after a successful parsing.

Referenced by initParser(), parse(), and parseUnit().

◆ unitExpression

bool App::ExpressionParser::unitExpression = false
static

True if the parsed string is a unit only.

Referenced by initParser(), and parseUnit().

◆ valueExpression

bool App::ExpressionParser::valueExpression = false
static

True if the parsed string is a full expression.

Referenced by initParser(), and parse().