Summary
Formula interpreter 3.0
Getting started | Core idea is to let define users rules either directly (e.g. via editable Grid) It allows testing a solution and makes calculations and results visible. |
Define a table for the formula interpreter. | For the formula interpreter you need a table with the following columns:
|
Insert the operation, choose the suitable columns, define names for the description column and the error column and define the formatting of the number values.
PLEASE NOTE:
Indices are used like this: [L215](1), or if there are several indices [L215](2,2) | |
Calculation | As soon as the formula field is defined, the formula interpreter tries to solve the formula and overwrite the value filed.
|
Result |
|
Example: ...
Situation | ... |
---|---|
Settings | ... |
Result | ... |
Project-File | ... |
/* converted on Wed Jan 20, 2016, 15:17 (UTC+01) by antlr_3-to-w3c v0.35.1152 which is Copyright (c) 2011-2015 by Gunther Rademacher <grd@gmx.net> */
xformula ::= xformula_expression EOF
xformula_expression
::= xformula_logicalandexpr
xformula_logicalandexpr
::= xformula_logicalorexpr ( '&&' xformula_logicalorexpr )*
xformula_logicalorexpr
::= xformula_compareexpr ( '||' xformula_compareexpr )*
xformula_compareexpr
::= xformula_sumexpr ( ( '==' | '!=' | '>' | '>=' | '<' | '<=' ) xformula_sumexpr )*
xformula_sumexpr
::= xformula_prodexpr ( ( '+' | '-' ) xformula_prodexpr )*
xformula_prodexpr
::= xformulaexpr ( ( '*' | '/' ) xformulaexpr )*
sign ::= '+'
| '-'
primary_expression
::= numeric_constant
parameter
::= xformula_expression
| xformulaexpr
| '(' xformula_expression ')'
xifunc ::= '#' XIFUNCIDENTIFIER '(' parameter* ( ',' parameter )* ')' '#'
function ::= FUNCTIONIDENTIFER '(' parameter ( ',' parameter )* ')'
vardef ::= VARIDENTIFIER ( '(' parameter ( ',' parameter )* ')' )*
compareop
::= '=='
| '!='
| '>'
| '>='
| '<'
| '<='
op ::= '+'
| '-'
| '/'
| '*'
numeric_constant
::= INTEGER
| DOUBLE
xformulaexpr
::= vardef
| function
| '-'* primary_expression
| op
| compareop
| xifunc
| CHARACTER_LITERAL
| STRING_LITERAL
| '(' xformula_expression ')'
<?TOKENS?>
BOOLEAN ::= 'true'
| 'false'
| 'True'
| 'False'
ESCAPELDELIM
::= '\' '['
ESCAPERDELIM
::= '\' ']'
INTEGER ::= DIGIT+ INTEGER_TYPE_SUFFIX?
DOUBLE ::= ( DIGIT* '.' )? DIGIT+ REAL_TYPE_SUFFIX?
INTEGER_TYPE_SUFFIX
::= 'I'
| 'i'
REAL_TYPE_SUFFIX
::= 'F'
| 'f'
VARIDENTIFIER
::= '[' ( ESCAPEDELIM | [^[#x5D] )+ ']'
FUNCTIONIDENTIFER
::= ( UPPER | LOWER ) ( UPPER | LOWER | DIGIT )*
XIFUNCIDENTIFIER0
::= '#' XIFUNCIDENTIFIER
XIFUNCIDENTIFIER
::= 'XI.TIS' UPPER LETTERS*
ESCAPEDELIM
::= ESCAPELDELIM
| ESCAPERDELIM
LOWER ::= [a-z]
UPPER ::= [A-Z]
SPECIALS ::= [ -@#x80-#xFF]
LETTER ::= LOWER
| UPPER
| SPECIALS
LETTERS ::= LOWER
| UPPER
DIGIT ::= [0-9]
ESCAPESEQUENCE
::= '\' ( 'b' | 't' | 'n' | 'r' | '"' | "'" | '\' )
CHARACTER_LITERAL
::= "'" ( ESCAPESEQUENCE | [^'\] )* "'"
STRING_LITERAL
::= '"' ( ESCAPESEQUENCE | [^"\] )* '"'
WS ::= [ #x9#xA#xD]+
COMMENT? ::= '/*' .* '*/'
EOF ::= $
Want to learn more?
Related topics
- Uses ANTLR internally.