Skip to content
Guillaume Camera edited this page Feb 19, 2016 · 12 revisions

Welcome to the django-formidable wiki!

Grammar Validations

Beware, grammar validation does not permit to have only a string, or a number or a date. The goal of a validation is to say "The validation is okay" or "the validation is not okay" => True / False.

For example, if you compute the validation, and the computing result is "toto", it's mean nothing. We want to know "True" or "False".

Define a validation with "true" means the validation is already satisfied. Define a validation with "false" means the validation is always wrong.

The generated list of boolFunc is generated from the python code (The list can be extended by the client application). You can notice you cannot call function with does not return a boolean. Because, again, a computed validation with "toto" as return does not mean anything.

validation : orBool | ifStatement ;
ifStatement : 'if(' orBool ',' validation ( ',' validation )? ')' ;
orBool : OR(andBool(, andBool )+ ')' ;
andBool : AND( identity(',' identity)+);
identity : NOT `(` orBool `)` | IDENTITY '(' orBool ')' | comparison ;
comparison : compareFunc '(' orBoolFunc ',' orBoolFunc ')' | boolFuncRule ;
boolFuncRule : boolFunc '(' orBoolFuncList ')' | BOOLEAN;
compareFunc: 'EQ' | 'GT' | 'GTE' | 'LT' | 'LTE';
boolFunc : ## Dynamically generated ;
orBoolFunc : orBool | function;
orBoolFuncList: orBoolFunc (',' orBoolFunc)*;
function : ID '(' orBoolList ')' | value ;
value : STRING | INTEGER | DATE | BOOLEAN | field ;
field : 'field(' ID ')';
Clone this wiki locally