#include <SPythonParser.hxx>
Public Member Functions | |
| SPythonParser () | |
| TypeOfEntity | getType () const |
| bool | parseWithoutEqual (const std::string &s, int parLev, PyObject *glob, PyObject *loc, std::vector< SPythonParser > &alreadyParsed) |
| TypeOfEntity | getTypeOfElt (const std::string &elt, PyObject *glob, PyObject *loc, const std::vector< SPythonParser > &alreadyParsed) const |
| TypeOfEntity | combineType (TypeOfEntity t1, TypeOfEntity t2) const |
| std::string | getRepr (const std::vector< SPythonParser > &v) const |
| std::string | replaceByCompacted (const std::string &s, int parLev, int id) const |
| std::string | substitute (const std::vector< SPythonParser > &v) const |
| TypeOfEntity | analyzeType (PyObject *glob, PyObject *loc, const std::vector< SPythonParser > &alreadyParsed) |
| void | keepSelectedLevOfPar (const std::string &s, int parLev, PyObject *glob, PyObject *loc) |
Static Public Member Functions | |
| static std::vector< int > | levOfParenthesis (const std::string &s) |
| static void | replaceFromCompacted (std::string &ret, const std::vector< SPythonParser > &v) |
| static bool | isAlreadyControledParenthesis (const std::string &s) |
| static bool | isParenthesisMatching (const std::string &s, std::string &res) |
| static bool | isElementInParenthesisMatching (const std::string &s, std::string &result, bool &isNumber) |
Static Public Attributes | |
| static const char | NUMBERS [] = "0123456789" |
Private Attributes | |
| TypeOfEntity | _type |
| SPythonPredParser | _pred |
| std::string | _content |
| std::string | _content_py |
This class works on strings previously stripped.
| SPythonParser::SPythonParser | ( | ) |
| TypeOfEntity ParaMEDMEM.SPythonParser.getType | ( | ) | const |
References ParaMEDMEM.SPythonParser._type.
| bool SPythonParser::parseWithoutEqual | ( | const std::string & | s, |
| int | parLev, | ||
| PyObject * | glob, | ||
| PyObject * | loc, | ||
| std::vector< SPythonParser > & | alreadyParsed | ||
| ) |
This method checks that the input 's' follows the following pattern : "{number || var[.attribute]?{@number@}? || @number@ }*{+ - * / }*" All of {var} should be of type int,float funct or MEDCalculatorDBField.
References ParaMEDMEM.SPythonParser._content, ParaMEDMEM.SPythonParser._content_py, ParaMEDMEM.SPythonParser._pred, ParaMEDMEM.SPythonParser._type, ParaMEDMEM.SPythonParser.analyzeType(), ParaMEDMEM.EMPTY_TYPE, ParaMEDMEM.FIELDDB_TYPE, ParaMEDMEM.FLOAT_TYPE, ParaMEDMEM.FUNC_TYPE, ParaMEDMEM.SPythonPredParser.getType(), ParaMEDMEM.IDENTITY_TYPE, ParaMEDMEM.INT_TYPE, ParaMEDMEM.SPythonParser.isAlreadyControledParenthesis(), ParaMEDMEM.SPythonParser.isParenthesisMatching(), ParaMEDMEM.SPythonParser.keepSelectedLevOfPar(), and ParaMEDMEM.UNKNOWN_TYPE.
| TypeOfEntity SPythonParser::getTypeOfElt | ( | const std::string & | elt, |
| PyObject * | glob, | ||
| PyObject * | loc, | ||
| const std::vector< SPythonParser > & | alreadyParsed | ||
| ) | const |
References ParaMEDMEM.SPythonPredParser.getTypeOfVar(), and testRenumbering.id.
| TypeOfEntity SPythonParser::combineType | ( | TypeOfEntity | t1, |
| TypeOfEntity | t2 | ||
| ) | const |
| std::string SPythonParser::getRepr | ( | const std::vector< SPythonParser > & | v | ) | const |
References med_test1.begin, and med_test1.end.
| std::string SPythonParser::substitute | ( | const std::vector< SPythonParser > & | v | ) | const |
| TypeOfEntity SPythonParser::analyzeType | ( | PyObject * | glob, |
| PyObject * | loc, | ||
| const std::vector< SPythonParser > & | alreadyParsed | ||
| ) |
Analyzes regarding _content attribute the type of value.
References ParaMEDMEM.SPythonParser._content, ParaMEDMEM.SPythonParser._type, ParaMEDMEM.SPythonParser.combineType(), medutilities.content, ParaMEDMEM.EMPTY_TYPE, ParaMEDMEM.SPythonParser.getTypeOfElt(), testGaussLocalization.p2, and medClient_test.type.
| void SPythonParser::keepSelectedLevOfPar | ( | const std::string & | s, |
| int | parLev, | ||
| PyObject * | glob, | ||
| PyObject * | loc | ||
| ) |
| std::vector< int > SPythonParser::levOfParenthesis | ( | const std::string & | s | ) | [static] |
Size of returned vector is depth of parenthesis. Foreach level number of parenthesis groups.
References testMEDMEM.ret.
| void SPythonParser::replaceFromCompacted | ( | std::string & | ret, |
| const std::vector< SPythonParser > & | v | ||
| ) | [static] |
References testRenumbering.id.
| bool SPythonParser::isAlreadyControledParenthesis | ( | const std::string & | s | ) | [static] |
This method checks that s match the following regexp : "@[0123456789]?@"
References ParaMEDMEM.SPythonParser.NUMBERS.
| bool SPythonParser::isParenthesisMatching | ( | const std::string & | w, |
| std::string & | res | ||
| ) | [static] |
This method makes the assumption that s as a minimum length of size 2 with first char == '(' and the last ')'.
References ParaMEDMEM.SPythonParser.isElementInParenthesisMatching().
| bool SPythonParser::isElementInParenthesisMatching | ( | const std::string & | s, |
| std::string & | result, | ||
| bool & | isNumber | ||
| ) | [static] |
No assumption here check that the following regexp is followed [' ']*[0:9]*[' ']*:?[' ']*[0:9]*[' ']*
References ParaMEDMEM.SPythonParser.NUMBERS, and testMEDMEM.ret.
const char SPythonParser::NUMBERS = "0123456789" [static] |
TypeOfEntity ParaMEDMEM.SPythonParser._type [private] |
std::string ParaMEDMEM.SPythonParser._content [private] |
std::string ParaMEDMEM.SPythonParser._content_py [private] |