App::ExpressionParser Namespace Reference

Classes

class  semantic_type
 The semantic_type class encapsulates the value in the parse tree during parsing. More...
 
union  yyalloc
 

Typedefs

typedef short int yytype_int16
 
typedef signed char yytype_int8
 
typedef unsigned short int yytype_uint16
 
typedef unsigned char yytype_uint8
 

Enumerations

Functions

void ExpressionParser_yyerror (const char *errorinfo)
 Error function for parser. More...
 
int ExpressionParserlex (void)
 
void free (void *)
 
static void initParser (const App::DocumentObject *owner)
 
bool isTokenAnIndentifier (const std::string &str)
 
void * malloc (YYSIZE_T)
 
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< boost::tuple< int, int, std::string > > tokenize (const std::string &str)
 
static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
 
int yyparse (void)
 

Variables

static int column
 
static const App::DocumentObjectDocumentObject = 0
 The DocumentObject that will own the expression. More...
 
std::stack< FunctionExpression::Functionfunctions
 Function identifier. More...
 
static std::stack< std::string > labels
 Label string primitive. More...
 
static int last_column
 
static std::map< std::string, FunctionExpression::Functionregistered_functions
 Registerd functions. More...
 
static ExpressionScanResult = 0
 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...
 
int yychar
 
static const yytype_uint8 yycheck []
 
static const yytype_uint8 yydefact []
 
static const yytype_int8 yydefgoto []
 
YYSTYPE yylval
 
int yynerrs
 
static const yytype_int16 yypact []
 
static const yytype_int16 yypgoto []
 
static const yytype_uint8 yyr1 []
 
static const yytype_uint8 yyr2 []
 
static const yytype_uint8 yystos []
 
static const yytype_int16 yytable []
 
static const yytype_uint8 yytranslate []
 

Typedef Documentation

typedef unsigned short int App::ExpressionParser::yytype_uint16
typedef unsigned char App::ExpressionParser::yytype_uint8

Enumeration Type Documentation

Enumerator
FUNC 
ONE 
NUM 
IDENTIFIER 
UNIT 
INTEGER 
CONSTANT 
CELLADDRESS 
EQ 
NEQ 
LT 
GT 
GTE 
LTE 
STRING 
MINUSSIGN 
PROPERTY_REF 
DOCUMENT 
OBJECT 
EXPONENT 
NEG 
POS 

Function Documentation

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

Error function for parser.

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

References ExpressionParser_yyerror().

Referenced by ExpressionParser_yyerror().

int App::ExpressionParser::ExpressionParserlex ( void  )

Referenced by isTokenAnIndentifier(), and tokenize().

void App::ExpressionParser::free ( void *  )
bool App::ExpressionParser::isTokenAnIndentifier ( const std::string &  str)
void* App::ExpressionParser::malloc ( YYSIZE_T  )
double App::ExpressionParser::num_change ( char *  yytext,
char  dez_delim,
char  grp_delim 
)
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 sting buffer to parse.
Returns
A pointer to an expression.

References initParser(), ScanResult, and valueExpression.

Referenced by App::Expression::parse(), App::ObjectIdentifier::parse(), App::PropertyExpressionEngine::Restore(), Spreadsheet::Cell::setContent(), and App::DocumentObjectPy::setExpression().

ObjectIdentifier App::ExpressionParser::parsePath ( const App::DocumentObject owner,
const char *  buffer 
)
std::vector< boost::tuple< int, int, std::string > > App::ExpressionParser::tokenize ( const std::string &  str)

References ExpressionParserlex(), last_column, and tokenize().

Referenced by tokenize().

static void App::ExpressionParser::yydestruct ( const char *  yymsg,
int  yytype,
YYSTYPE yyvaluep 
)
static

References Base::fmod().

int App::ExpressionParser::yyparse ( void  )

Variable Documentation

int App::ExpressionParser::column
static
const App::DocumentObject* App::ExpressionParser::DocumentObject = 0
static

The DocumentObject that will own the expression.

Referenced by initParser().

std::stack<FunctionExpression::Function> App::ExpressionParser::functions

Function identifier.

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

Label string primitive.

int App::ExpressionParser::last_column
static

Referenced by tokenize().

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

Registerd functions.

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

The resulting expression after a successful parsing.

Referenced by parse(), and parseUnit().

bool App::ExpressionParser::unitExpression = false
static

True if the parsed string is a unit only.

Referenced by parseUnit().

bool App::ExpressionParser::valueExpression = false
static

True if the parsed string is a full expression.

Referenced by parse().

int App::ExpressionParser::yychar
const yytype_uint8 App::ExpressionParser::yycheck[]
static
Initial value:
=
{
0, 1, 101, 52, 53, 0, 7, 24, 36, 24,
10, 11, 51, 6, 113, 114, 115, 10, 0, 36,
15, 36, 37, 38, 17, 124, 125, 126, 6, 6,
6, 32, 10, 10, 10, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 85, 4, 48, 44,
23, 8, 4, 37, 49, 50, 8, 57, 58, 108,
29, 18, 36, 102, 3, 4, 5, 6, 7, 8,
9, 10, 39, 26, 27, 36, 29, 38, 17, 18,
33, 39, 3, 4, 5, 6, 25, 8, 9, 10,
4, 18, 6, 32, 8, 39, 17, 18, 25, 26,
27, 29, 29, 17, 25, 36, 106, 3, 4, 5,
6, 32, 8, 9, 10, 26, 27, 36, 29, 38,
36, 17, 18, 11, 12, 13, 14, 15, 16, 25,
18, 4, 36, 6, 36, 8, 32, 25, 26, 27,
39, 29, 36, 37, 17, 33, 11, 12, 13, 14,
15, 16, 6, 18, 26, 27, 10, 29, 39, 24,
25, 26, 27, 17, 29, 11, 12, 13, 14, 15,
16, 39, 18, 36, 37, 38, 33, 34, 35, 25,
26, 27, 52, 29, 36, 36, 57, 58, 36
}
const yytype_uint8 App::ExpressionParser::yydefact[]
static
Initial value:
=
{
0, 0, 19, 20, 51, 39, 21, 22, 52, 6,
0, 0, 0, 0, 2, 4, 0, 3, 7, 45,
0, 0, 51, 52, 0, 23, 0, 24, 0, 0,
8, 9, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 0, 17, 0, 0, 60,
62, 61, 59, 50, 0, 49, 0, 0, 16, 44,
33, 34, 35, 36, 37, 38, 11, 10, 12, 13,
14, 15, 0, 41, 40, 0, 42, 51, 72, 47,
0, 52, 46, 32, 31, 30, 29, 25, 27, 26,
28, 0, 0, 56, 55, 53, 0, 43, 0, 69,
0, 0, 0, 0, 0, 0, 18, 48, 66, 65,
63, 58, 57, 54, 0, 0, 0, 68, 67, 64
}
const yytype_int8 App::ExpressionParser::yydefgoto[]
static
Initial value:
=
{
-1, 13, 32, 15, 26, 27, 16, 33, 18, 67,
19, 62, 20, 21
}
YYSTYPE App::ExpressionParser::yylval
int App::ExpressionParser::yynerrs
const yytype_int16 App::ExpressionParser::yypact[]
static
Initial value:
=
{
61, 79, -100, -100, 137, -100, -100, -100, -28, 106,
104, 104, 61, 18, 154, -1, 27, 89, -100, -100,
16, 26, -15, -17, 104, 154, 143, -100, 7, 86,
-100, -100, 112, 47, -100, 104, 104, 104, 104, 104,
104, 104, 104, 104, 61, 104, -1, 31, 104, -1,
-1, 43, 146, 22, 23, 24, -100, 79, 79, 39,
-100, -100, -100, -100, 33, -100, 42, 56, -100, -100,
154, 154, 154, 154, 154, 154, 128, 128, 72, 72,
31, -100, 135, 31, 31, 48, -100, 81, -100, -100,
69, -100, -100, -100, -100, -100, -100, 154, -100, 154,
-100, 7, 127, 84, 96, 98, 104, -100, 22, -100,
101, 119, 132, 7, 7, 7, 73, -100, 148, 149,
152, -100, -100, -100, 7, 7, 7, -100, -100, -100
}
const yytype_int16 App::ExpressionParser::yypgoto[]
static
Initial value:
=
{
-100, -100, 0, -100, -100, 129, -100, 5, -100, -39,
-49, -99, -100, 130
}
const yytype_uint8 App::ExpressionParser::yyr1[]
static
Initial value:
=
{
0, 40, 41, 41, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 43,
43, 43, 43, 44, 44, 44, 44, 44, 44, 45,
45, 45, 45, 46, 46, 46, 46, 46, 46, 47,
47, 47, 47, 47, 47, 48, 48, 48, 48, 49,
49, 50, 50, 50, 50, 50, 50, 50, 50, 50,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
52, 52, 53, 53
}
const yytype_uint8 App::ExpressionParser::yyr2[]
static
Initial value:
=
{
0, 2, 1, 1, 1, 2, 1, 1, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 5, 1,
1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
3, 3, 3, 4, 3, 1, 3, 3, 5, 1,
1, 1, 1, 4, 6, 4, 4, 6, 6, 3,
1, 1, 1, 4, 6, 4, 4, 6, 6, 3,
1, 1, 1, 1
}
const yytype_uint8 App::ExpressionParser::yystos[]
static
Initial value:
=
{
0, 3, 4, 5, 6, 7, 8, 9, 10, 17,
18, 25, 32, 41, 42, 43, 46, 47, 48, 50,
52, 53, 6, 10, 32, 42, 44, 45, 36, 38,
42, 42, 42, 47, 0, 11, 12, 13, 14, 15,
16, 18, 25, 26, 27, 29, 32, 47, 23, 26,
27, 29, 37, 36, 24, 24, 33, 34, 35, 6,
10, 17, 51, 4, 6, 8, 17, 49, 33, 33,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
47, 42, 42, 47, 47, 18, 49, 6, 17, 50,
53, 10, 50, 6, 10, 6, 10, 42, 45, 42,
45, 36, 38, 39, 39, 39, 24, 49, 36, 51,
6, 17, 49, 36, 36, 36, 42, 50, 39, 39,
39, 51, 51, 51, 36, 36, 36, 51, 51, 51
}
const yytype_int16 App::ExpressionParser::yytable[]
static
Initial value:
=
{
14, 25, 109, 89, 92, 17, 5, 55, -73, 54,
30, 31, 86, 59, 121, 122, 123, 60, 34, -73,
47, 28, -71, 29, 61, 127, 128, 129, 87, 93,
95, 46, 91, 94, 96, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 81, 107, 63, 82, 80,
48, 65, 63, 52, 83, 84, 65, 97, 99, 117,
51, 85, 53, 112, 1, 2, 3, 4, 5, 6,
7, 8, 103, 49, 50, 101, 51, 102, 9, 10,
69, 104, 1, 2, 3, 22, 11, 6, 7, 23,
63, 41, 64, 12, 65, 105, 9, 10, 42, 43,
44, 45, 45, 66, 11, 108, 116, 1, 2, 3,
4, 24, 6, 7, 8, 49, 50, 28, 51, 29,
113, 9, 10, 35, 36, 37, 38, 39, 40, 11,
41, 63, 114, 110, 115, 65, 24, 42, 43, 44,
118, 45, -72, -70, 111, 68, 35, 36, 37, 38,
39, 40, 87, 41, 43, 44, 8, 45, 119, 106,
42, 43, 44, 88, 45, 35, 36, 37, 38, 39,
40, 120, 41, 28, -71, 29, 56, 57, 58, 42,
43, 44, 90, 45, 124, 125, 98, 100, 126
}
const yytype_uint8 App::ExpressionParser::yytranslate[]
static