SeExpr
ExprParser.h
Go to the documentation of this file.
1 /*
2  Copyright Disney Enterprises, Inc. All rights reserved.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License
6  and the following modification to it: Section 6 Trademarks.
7  deleted and replaced with:
8 
9  6. Trademarks. This License does not grant permission to use the
10  trade names, trademarks, service marks, or product names of the
11  Licensor and its affiliates, except as required for reproducing
12  the content of the NOTICE file.
13 
14  You may obtain a copy of the License at
15  http://www.apache.org/licenses/LICENSE-2.0
16 */
17 #ifndef ExprParser_h
18 #define ExprParser_h
19 
20 #ifndef MAKEDEPEND
21 #include <string>
22 #endif
23 
24 namespace SeExpr2 {
25 class ExprNode;
26 class Expression;
27 bool ExprParse(SeExpr2::ExprNode*& parseTree,
28  std::string& error,
29  int& errorStart,
30  int& errorEnd,
31  std::vector<std::pair<int, int> >& _comments,
33  const char* str,
34  bool wantVec = true);
35 }
36 
37 #endif
SeExpr2::ExprNode
Definition: ExprNode.h:72
SeExpr2::ExprParse
bool ExprParse(SeExpr2::ExprNode *&parseTree, std::string &error, int &errorStart, int &errorEnd, std::vector< std::pair< int, int > > &_comments, const SeExpr2::Expression *expr, const char *str, bool wantVec=true)
SeExpr2
Definition: Context.h:22
SeExpr2::Expression
main expression class
Definition: Expression.h:76
expr
</pre >< h3 > Binding our variable reference</h3 > If we now tried to use the variable would still not be found by our expressions To make it bindable we need to override the resolveVar() function as follows</pre >< h3 > Variable setting</h3 > Next we need to make a way of setting the variable As the controlling code will use the expression it will repeatedly alternate between setting the independent variables that are used and calling evaluate(). What it has to do depends very much on the application. In this case we only need to set the independent variable x as</pre >< h2 > Evaluating expressions</h2 > Evaluating an expression is pretty easy But before we can do that we need to make an instance< pre > GrapherExpr expr("x+x^2")