mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 22:16:10 +03:00
Added collection length and mem test
This commit is contained in:
parent
2cfb348274
commit
be9e7e2a1e
@ -87,7 +87,7 @@ type binop =
|
|||||||
|
|
||||||
type unop = Not | Minus of op_kind
|
type unop = Not | Minus of op_kind
|
||||||
|
|
||||||
type builtin_expression = Cardinal | Now
|
type builtin_expression = Cardinal
|
||||||
|
|
||||||
type aggregate_func = AggregateSum of primitive_typ | AggregateCount
|
type aggregate_func = AggregateSum of primitive_typ | AggregateCount
|
||||||
|
|
||||||
|
@ -410,7 +410,12 @@ let rec translate_expr (scope : Scopelang.Ast.ScopeName.t) (ctxt : Name_resoluti
|
|||||||
( Scopelang.Ast.EAbs
|
( Scopelang.Ast.EAbs
|
||||||
( pos,
|
( pos,
|
||||||
binder,
|
binder,
|
||||||
[ (Scopelang.Ast.TLit t, Pos.get_position op'); (Scopelang.Ast.TAny, pos) ] ),
|
[
|
||||||
|
(Scopelang.Ast.TLit t, Pos.get_position op');
|
||||||
|
(Scopelang.Ast.TAny, pos)
|
||||||
|
(* we put any here because the type of the elements of the arrays is not
|
||||||
|
always the type of the accumulator; for instance in AggregateCount. *);
|
||||||
|
] ),
|
||||||
pos ))
|
pos ))
|
||||||
(Bindlib.bind_mvar [| acc_var; param |] f_body)
|
(Bindlib.bind_mvar [| acc_var; param |] f_body)
|
||||||
in
|
in
|
||||||
@ -429,6 +434,45 @@ let rec translate_expr (scope : Scopelang.Ast.ScopeName.t) (ctxt : Name_resoluti
|
|||||||
((Scopelang.Ast.EOp (Dcalc.Ast.Ternop Dcalc.Ast.Fold), pos), [ f; init; collection ]),
|
((Scopelang.Ast.EOp (Dcalc.Ast.Ternop Dcalc.Ast.Fold), pos), [ f; init; collection ]),
|
||||||
pos ))
|
pos ))
|
||||||
f collection init
|
f collection init
|
||||||
|
| MemCollection (member, collection) ->
|
||||||
|
let param_var = Scopelang.Ast.Var.make ("collection_member", pos) in
|
||||||
|
let param = Scopelang.Ast.make_var (param_var, pos) in
|
||||||
|
let collection = rec_helper collection in
|
||||||
|
let init = Bindlib.box (Scopelang.Ast.ELit (Dcalc.Ast.LBool false), pos) in
|
||||||
|
let acc_var = Scopelang.Ast.Var.make ("acc", pos) in
|
||||||
|
let acc = Scopelang.Ast.make_var (acc_var, pos) in
|
||||||
|
let f_body =
|
||||||
|
Bindlib.box_apply3
|
||||||
|
(fun member acc param ->
|
||||||
|
( Scopelang.Ast.EApp
|
||||||
|
( (Scopelang.Ast.EOp (Dcalc.Ast.Binop Dcalc.Ast.Or), pos),
|
||||||
|
[
|
||||||
|
( Scopelang.Ast.EApp
|
||||||
|
((Scopelang.Ast.EOp (Dcalc.Ast.Binop Dcalc.Ast.Eq), pos), [ member; param ]),
|
||||||
|
pos );
|
||||||
|
acc;
|
||||||
|
] ),
|
||||||
|
pos ))
|
||||||
|
(translate_expr scope ctxt member)
|
||||||
|
acc param
|
||||||
|
in
|
||||||
|
let f =
|
||||||
|
Bindlib.box_apply
|
||||||
|
(fun binder ->
|
||||||
|
( Scopelang.Ast.EAbs
|
||||||
|
( pos,
|
||||||
|
binder,
|
||||||
|
[ (Scopelang.Ast.TLit Dcalc.Ast.TBool, pos); (Scopelang.Ast.TAny, pos) ] ),
|
||||||
|
pos ))
|
||||||
|
(Bindlib.bind_mvar [| acc_var; param_var |] f_body)
|
||||||
|
in
|
||||||
|
Bindlib.box_apply3
|
||||||
|
(fun f collection init ->
|
||||||
|
( Scopelang.Ast.EApp
|
||||||
|
((Scopelang.Ast.EOp (Dcalc.Ast.Ternop Dcalc.Ast.Fold), pos), [ f; init; collection ]),
|
||||||
|
pos ))
|
||||||
|
f collection init
|
||||||
|
| Builtin Cardinal -> Bindlib.box (Scopelang.Ast.EOp (Dcalc.Ast.Unop Dcalc.Ast.Length), pos)
|
||||||
| _ ->
|
| _ ->
|
||||||
Name_resolution.raise_unsupported_feature "desugaring not implemented for this expression" pos
|
Name_resolution.raise_unsupported_feature "desugaring not implemented for this expression" pos
|
||||||
|
|
||||||
|
@ -113,7 +113,6 @@ let token_list : (string * token) list =
|
|||||||
("exists", EXISTS);
|
("exists", EXISTS);
|
||||||
("such", SUCH);
|
("such", SUCH);
|
||||||
("that", THAT);
|
("that", THAT);
|
||||||
("now", NOW);
|
|
||||||
("&&", AND);
|
("&&", AND);
|
||||||
("||", OR);
|
("||", OR);
|
||||||
("not", NOT);
|
("not", NOT);
|
||||||
@ -279,9 +278,6 @@ let rec lex_code (lexbuf : lexbuf) : token =
|
|||||||
| "that" ->
|
| "that" ->
|
||||||
update_acc lexbuf;
|
update_acc lexbuf;
|
||||||
THAT
|
THAT
|
||||||
| "now" ->
|
|
||||||
update_acc lexbuf;
|
|
||||||
NOW
|
|
||||||
| "&&" ->
|
| "&&" ->
|
||||||
update_acc lexbuf;
|
update_acc lexbuf;
|
||||||
AND
|
AND
|
||||||
|
@ -67,7 +67,6 @@ let token_list_en : (string * token) list =
|
|||||||
("exists", EXISTS);
|
("exists", EXISTS);
|
||||||
("such", SUCH);
|
("such", SUCH);
|
||||||
("that", THAT);
|
("that", THAT);
|
||||||
("now", NOW);
|
|
||||||
("and", AND);
|
("and", AND);
|
||||||
("or", OR);
|
("or", OR);
|
||||||
("not", NOT);
|
("not", NOT);
|
||||||
@ -236,9 +235,6 @@ let rec lex_code_en (lexbuf : lexbuf) : token =
|
|||||||
| "that" ->
|
| "that" ->
|
||||||
L.update_acc lexbuf;
|
L.update_acc lexbuf;
|
||||||
THAT
|
THAT
|
||||||
| "now" ->
|
|
||||||
L.update_acc lexbuf;
|
|
||||||
NOW
|
|
||||||
| "and" ->
|
| "and" ->
|
||||||
L.update_acc lexbuf;
|
L.update_acc lexbuf;
|
||||||
AND
|
AND
|
||||||
|
@ -65,7 +65,6 @@ let token_list_fr : (string * token) list =
|
|||||||
("existe", EXISTS);
|
("existe", EXISTS);
|
||||||
("tel", SUCH);
|
("tel", SUCH);
|
||||||
("que", THAT);
|
("que", THAT);
|
||||||
("maintenant", NOW);
|
|
||||||
("et", AND);
|
("et", AND);
|
||||||
("ou", OR);
|
("ou", OR);
|
||||||
("non", NOT);
|
("non", NOT);
|
||||||
@ -240,9 +239,6 @@ let rec lex_code_fr (lexbuf : lexbuf) : token =
|
|||||||
| "que" ->
|
| "que" ->
|
||||||
L.update_acc lexbuf;
|
L.update_acc lexbuf;
|
||||||
THAT
|
THAT
|
||||||
| "maintenant" ->
|
|
||||||
L.update_acc lexbuf;
|
|
||||||
NOW
|
|
||||||
| "et" ->
|
| "et" ->
|
||||||
L.update_acc lexbuf;
|
L.update_acc lexbuf;
|
||||||
AND
|
AND
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@
|
|||||||
%token LESSER_MONEY GREATER_MONEY LESSER_EQUAL_MONEY GREATER_EQUAL_MONEY
|
%token LESSER_MONEY GREATER_MONEY LESSER_EQUAL_MONEY GREATER_EQUAL_MONEY
|
||||||
%token LESSER_DATE GREATER_DATE LESSER_EQUAL_DATE GREATER_EQUAL_DATE
|
%token LESSER_DATE GREATER_DATE LESSER_EQUAL_DATE GREATER_EQUAL_DATE
|
||||||
%token LESSER_DURATION GREATER_DURATION LESSER_EQUAL_DURATION GREATER_EQUAL_DURATION
|
%token LESSER_DURATION GREATER_DURATION LESSER_EQUAL_DURATION GREATER_EQUAL_DURATION
|
||||||
%token EXISTS IN SUCH THAT NOW
|
%token EXISTS IN SUCH THAT
|
||||||
%token DOT AND OR LPAREN RPAREN EQUAL
|
%token DOT AND OR LPAREN RPAREN EQUAL
|
||||||
%token CARDINAL ASSERTION FIXED BY YEAR MONTH DAY
|
%token CARDINAL ASSERTION FIXED BY YEAR MONTH DAY
|
||||||
%token PLUS MINUS MULT DIV
|
%token PLUS MINUS MULT DIV
|
||||||
@ -137,7 +137,6 @@ struct_or_enum_inject:
|
|||||||
|
|
||||||
primitive_expression:
|
primitive_expression:
|
||||||
| e = small_expression { e }
|
| e = small_expression { e }
|
||||||
| NOW { (Builtin Now, $sloc) }
|
|
||||||
| CARDINAL {
|
| CARDINAL {
|
||||||
(Builtin Cardinal, $sloc)
|
(Builtin Cardinal, $sloc)
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ let message s =
|
|||||||
"expected another inclusion of a Catala file, since this file is a master file which can \
|
"expected another inclusion of a Catala file, since this file is a master file which can \
|
||||||
only contain inclusions of other Catala files\n"
|
only contain inclusions of other Catala files\n"
|
||||||
| 8 -> "expected some text, another heading or a law article\n"
|
| 8 -> "expected some text, another heading or a law article\n"
|
||||||
| 346 -> "expected a heading, an article title or some text\n"
|
| 345 -> "expected a heading, an article title or some text\n"
|
||||||
| 331 -> "expected an article title, another heading or some text\n"
|
| 330 -> "expected an article title, another heading or some text\n"
|
||||||
| 336 -> "expected a code block, a metadata block, more law text or a heading\n"
|
| 335 -> "expected a code block, a metadata block, more law text or a heading\n"
|
||||||
| 342 -> "expected a code block, a metadata block, more law text or a heading\n"
|
| 341 -> "expected a code block, a metadata block, more law text or a heading\n"
|
||||||
| 337 -> "expected a declaration or a scope use\n"
|
| 336 -> "expected a declaration or a scope use\n"
|
||||||
| 22 -> "expected the name of the scope you want to use\n"
|
| 22 -> "expected the name of the scope you want to use\n"
|
||||||
| 24 -> "expected a scope use precondition or a colon\n"
|
| 24 -> "expected a scope use precondition or a colon\n"
|
||||||
| 25 -> "expected an expression which will act as the condition\n"
|
| 25 -> "expected an expression which will act as the condition\n"
|
||||||
@ -27,138 +27,138 @@ let message s =
|
|||||||
| 30 -> "expected a \"/\"\n"
|
| 30 -> "expected a \"/\"\n"
|
||||||
| 31 -> "expected the third component of the date literal\n"
|
| 31 -> "expected the third component of the date literal\n"
|
||||||
| 32 -> "expected a delimiter to finish the date literal\n"
|
| 32 -> "expected a delimiter to finish the date literal\n"
|
||||||
| 67 -> "expected an operator to compose the expression on the left with\n"
|
| 66 -> "expected an operator to compose the expression on the left with\n"
|
||||||
| 73 -> "expected an enum constructor to test if the expression on the left\n"
|
| 72 -> "expected an enum constructor to test if the expression on the left\n"
|
||||||
| 72 -> "expected an operator to compose the expression on the left with\n"
|
| 71 -> "expected an operator to compose the expression on the left with\n"
|
||||||
| 128 -> "expected an expression on the right side of the sum or minus operator\n"
|
| 127 -> "expected an expression on the right side of the sum or minus operator\n"
|
||||||
| 156 -> "expected an expression on the right side of the logical operator\n"
|
| 155 -> "expected an expression on the right side of the logical operator\n"
|
||||||
| 75 -> "expected an expression for the argument of this function call\n"
|
| 74 -> "expected an expression for the argument of this function call\n"
|
||||||
| 116 -> "expected an expression on the right side of the comparison operator\n"
|
| 115 -> "expected an expression on the right side of the comparison operator\n"
|
||||||
| 137 -> "expected an expression on the right side of the multiplication or division operator\n"
|
| 136 -> "expected an expression on the right side of the multiplication or division operator\n"
|
||||||
| 130 -> "expected an operator to compose the expression on the left\n"
|
| 129 -> "expected an operator to compose the expression on the left\n"
|
||||||
| 166 -> "expected an expression standing for the set you want to test for membership\n"
|
| 165 -> "expected an expression standing for the set you want to test for membership\n"
|
||||||
| 68 -> "expected an identifier standing for a struct field or a subscope name\n"
|
| 67 -> "expected an identifier standing for a struct field or a subscope name\n"
|
||||||
| 214 -> "expected a colon after the scope use precondition\n"
|
| 213 -> "expected a colon after the scope use precondition\n"
|
||||||
| 70 -> "expected a constructor, to get the payload of this enum case\n"
|
| 69 -> "expected a constructor, to get the payload of this enum case\n"
|
||||||
| 35 -> "expected the \"for\" keyword to spell the aggregation\n"
|
| 35 -> "expected the \"for\" keyword to spell the aggregation\n"
|
||||||
| 150 -> "expected an expression to take the negation of\n"
|
| 149 -> "expected an expression to take the negation of\n"
|
||||||
| 64 -> "expected an expression to take the opposite of\n"
|
| 63 -> "expected an expression to take the opposite of\n"
|
||||||
| 52 -> "expected an expression to match with\n"
|
| 51 -> "expected an expression to match with\n"
|
||||||
| 198 -> "expected a pattern matching case\n"
|
| 197 -> "expected a pattern matching case\n"
|
||||||
| 199 -> "expected the name of the constructor for the enum case in the pattern matching\n"
|
| 198 -> "expected the name of the constructor for the enum case in the pattern matching\n"
|
||||||
| 205 ->
|
| 204 ->
|
||||||
"expected a binding for the constructor payload, or a colon and the matching case expression\n"
|
"expected a binding for the constructor payload, or a colon and the matching case expression\n"
|
||||||
| 206 -> "expected an identifier for this enum case binding\n"
|
| 205 -> "expected an identifier for this enum case binding\n"
|
||||||
| 202 -> "expected a colon and then the expression for this matching case\n"
|
| 201 -> "expected a colon and then the expression for this matching case\n"
|
||||||
| 208 -> "expected a colon or a binding for the enum constructor payload\n"
|
| 207 -> "expected a colon or a binding for the enum constructor payload\n"
|
||||||
| 203 -> "expected an expression for this pattern matching case\n"
|
| 202 -> "expected an expression for this pattern matching case\n"
|
||||||
| 200 ->
|
| 199 ->
|
||||||
"expected another match case or the rest of the expression since the previous match case is \
|
"expected another match case or the rest of the expression since the previous match case is \
|
||||||
complete\n"
|
complete\n"
|
||||||
| 197 -> "expected the \"with patter\" keyword to complete the pattern matching expression\n"
|
| 196 -> "expected the \"with patter\" keyword to complete the pattern matching expression\n"
|
||||||
| 54 -> "expected an expression inside the parenthesis\n"
|
| 53 -> "expected an expression inside the parenthesis\n"
|
||||||
| 189 -> "unmatched parenthesis that should have been closed by here\n"
|
| 188 -> "unmatched parenthesis that should have been closed by here\n"
|
||||||
| 76 -> "expected a unit for this literal, or a valid operator to complete the expression \n"
|
| 75 -> "expected a unit for this literal, or a valid operator to complete the expression \n"
|
||||||
| 56 -> "expected an expression for the test of the conditional\n"
|
| 55 -> "expected an expression for the test of the conditional\n"
|
||||||
| 185 -> "expected an expression the for the \"then\" branch of the conditiona\n"
|
| 184 -> "expected an expression the for the \"then\" branch of the conditiona\n"
|
||||||
| 186 ->
|
| 185 ->
|
||||||
"expected the \"else\" branch of this conditional expression as the \"then\" branch is \
|
"expected the \"else\" branch of this conditional expression as the \"then\" branch is \
|
||||||
complete\n"
|
complete\n"
|
||||||
| 187 -> "expected an expression for the \"else\" branch of this conditional construction\n"
|
| 186 -> "expected an expression for the \"else\" branch of this conditional construction\n"
|
||||||
| 184 -> "expected the \"then\" keyword as the conditional expression is complete\n"
|
| 183 -> "expected the \"then\" keyword as the conditional expression is complete\n"
|
||||||
| 58 ->
|
| 57 ->
|
||||||
"expected the \"all\" keyword to mean the \"for all\" construction of the universal test\n"
|
"expected the \"all\" keyword to mean the \"for all\" construction of the universal test\n"
|
||||||
| 170 -> "expected an identifier for the bound variable of the universal test\n"
|
| 169 -> "expected an identifier for the bound variable of the universal test\n"
|
||||||
| 171 -> "expected the \"in\" keyword for the rest of the universal test\n"
|
| 170 -> "expected the \"in\" keyword for the rest of the universal test\n"
|
||||||
| 172 -> "expected the expression designating the set on which to perform the universal test\n"
|
| 171 -> "expected the expression designating the set on which to perform the universal test\n"
|
||||||
| 173 -> "expected the \"we have\" keyword for this universal test\n"
|
| 172 -> "expected the \"we have\" keyword for this universal test\n"
|
||||||
| 169 -> "expected an expression for the universal test\n"
|
| 168 -> "expected an expression for the universal test\n"
|
||||||
| 178 -> "expected an identifier that will designate the existential witness for the test\n"
|
| 177 -> "expected an identifier that will designate the existential witness for the test\n"
|
||||||
| 179 -> "expected the \"in\" keyword to continue this existential test\n"
|
| 178 -> "expected the \"in\" keyword to continue this existential test\n"
|
||||||
| 180 -> "expected an expression that designates the set subject to the existential test\n"
|
| 179 -> "expected an expression that designates the set subject to the existential test\n"
|
||||||
| 181 -> "expected a keyword to form the \"such that\" expression for the existential test\n"
|
| 180 -> "expected a keyword to form the \"such that\" expression for the existential test\n"
|
||||||
| 182 -> "expected a keyword to complete the \"such that\" construction\n"
|
| 181 -> "expected a keyword to complete the \"such that\" construction\n"
|
||||||
| 176 -> "expected an expression for the existential test\n"
|
| 175 -> "expected an expression for the existential test\n"
|
||||||
| 85 ->
|
| 84 ->
|
||||||
"expected a payload for the enum case constructor, or the rest of the expression (with an \
|
"expected a payload for the enum case constructor, or the rest of the expression (with an \
|
||||||
operator ?)\n"
|
operator ?)\n"
|
||||||
| 86 -> "expected structure fields introduced by --\n"
|
| 85 -> "expected structure fields introduced by --\n"
|
||||||
| 87 -> "expected the name of the structure field\n"
|
| 86 -> "expected the name of the structure field\n"
|
||||||
| 91 -> "expected a colon\n"
|
| 90 -> "expected a colon\n"
|
||||||
| 92 -> "expected the expression for this struct field\n"
|
| 91 -> "expected the expression for this struct field\n"
|
||||||
| 88 -> "expected another structure field or the closing bracket\n"
|
| 87 -> "expected another structure field or the closing bracket\n"
|
||||||
| 89 -> "expected the name of the structure field\n"
|
| 88 -> "expected the name of the structure field\n"
|
||||||
| 160 -> "expected an expression for the content of this enum case\n"
|
| 159 -> "expected an expression for the content of this enum case\n"
|
||||||
| 161 ->
|
| 160 ->
|
||||||
"the expression for the content of the enum case is already well-formed, expected an \
|
"the expression for the content of the enum case is already well-formed, expected an \
|
||||||
operator to form a bigger expression\n"
|
operator to form a bigger expression\n"
|
||||||
| 63 -> "expected the keyword following cardinal to compute the number of elements in a set\n"
|
| 62 -> "expected the keyword following cardinal to compute the number of elements in a set\n"
|
||||||
| 215 -> "expected a scope use item: a rule, definition or assertion\n"
|
| 214 -> "expected a scope use item: a rule, definition or assertion\n"
|
||||||
| 250 -> "expected the name of the variable subject to the rule\n"
|
| 249 -> "expected the name of the variable subject to the rule\n"
|
||||||
| 228 ->
|
| 227 ->
|
||||||
"expected a condition or a consequence for this rule, or the rest of the variable qualified \
|
"expected a condition or a consequence for this rule, or the rest of the variable qualified \
|
||||||
name\n"
|
name\n"
|
||||||
| 257 -> "expected a condition or a consequence for this rule\n"
|
| 256 -> "expected a condition or a consequence for this rule\n"
|
||||||
| 252 -> "expected filled or not filled for a rule consequence\n"
|
| 251 -> "expected filled or not filled for a rule consequence\n"
|
||||||
| 258 -> "expected the name of the parameter for this dependent variable \n"
|
| 257 -> "expected the name of the parameter for this dependent variable \n"
|
||||||
| 251 -> "expected the expression of the rule\n"
|
| 250 -> "expected the expression of the rule\n"
|
||||||
| 255 -> "expected the filled keyword the this rule \n"
|
| 254 -> "expected the filled keyword the this rule \n"
|
||||||
| 229 -> "expected a struct field or a sub-scope context item after the dot\n"
|
| 228 -> "expected a struct field or a sub-scope context item after the dot\n"
|
||||||
| 216 -> "expected the name of the label\n"
|
| 215 -> "expected the name of the label\n"
|
||||||
| 246 -> "expected a rule or a definition after the label declaration\n"
|
| 245 -> "expected a rule or a definition after the label declaration\n"
|
||||||
| 247 -> "expected the label to which the exception is referring back\n"
|
| 246 -> "expected the label to which the exception is referring back\n"
|
||||||
| 249 -> "expected a rule or a definition after the exception declaration\n"
|
| 248 -> "expected a rule or a definition after the exception declaration\n"
|
||||||
| 262 -> "expected the name of the variable you want to define\n"
|
| 261 -> "expected the name of the variable you want to define\n"
|
||||||
| 263 -> "expected the defined as keyword to introduce the definition of this variable\n"
|
| 262 -> "expected the defined as keyword to introduce the definition of this variable\n"
|
||||||
| 265 -> "expected an expression for the consequence of this definition under condition\n"
|
| 264 -> "expected an expression for the consequence of this definition under condition\n"
|
||||||
| 264 ->
|
| 263 ->
|
||||||
"expected a expression for defining this function, introduced by the defined as keyword\n"
|
"expected a expression for defining this function, introduced by the defined as keyword\n"
|
||||||
| 266 -> "expected an expression for the definition\n"
|
| 265 -> "expected an expression for the definition\n"
|
||||||
| 218 -> "expected an expression that shoud be asserted during execution\n"
|
| 217 -> "expected an expression that shoud be asserted during execution\n"
|
||||||
| 219 -> "expecting the name of the varying variable\n"
|
| 218 -> "expecting the name of the varying variable\n"
|
||||||
| 222 -> "the variable varies with an expression that was expected here\n"
|
| 221 -> "the variable varies with an expression that was expected here\n"
|
||||||
| 223 -> "expected an indication about the variation sense of the variable, or a new scope item\n"
|
| 222 -> "expected an indication about the variation sense of the variable, or a new scope item\n"
|
||||||
| 221 -> "expected an indication about what this variable varies with\n"
|
| 220 -> "expected an indication about what this variable varies with\n"
|
||||||
| 231 -> "expected an expression for this condition\n"
|
| 230 -> "expected an expression for this condition\n"
|
||||||
| 241 -> "expected a consequence for this definition under condition\n"
|
| 240 -> "expected a consequence for this definition under condition\n"
|
||||||
| 237 -> "expected an expression for this definition under condition\n"
|
| 236 -> "expected an expression for this definition under condition\n"
|
||||||
| 233 -> "expected the name of the variable that should be fixed\n"
|
| 232 -> "expected the name of the variable that should be fixed\n"
|
||||||
|
| 233 -> "expected the legislative text by which the value of the variable is fixed\n"
|
||||||
| 234 -> "expected the legislative text by which the value of the variable is fixed\n"
|
| 234 -> "expected the legislative text by which the value of the variable is fixed\n"
|
||||||
| 235 -> "expected the legislative text by which the value of the variable is fixed\n"
|
| 243 -> "expected a new scope use item \n"
|
||||||
| 244 -> "expected a new scope use item \n"
|
| 272 -> "expected the kind of the declaration (struct, scope or enum)\n"
|
||||||
| 273 -> "expected the kind of the declaration (struct, scope or enum)\n"
|
| 273 -> "expected the struct name\n"
|
||||||
| 274 -> "expected the struct name\n"
|
| 274 -> "expected a colon\n"
|
||||||
| 275 -> "expected a colon\n"
|
| 275 -> "expected struct data or condition\n"
|
||||||
| 276 -> "expected struct data or condition\n"
|
| 276 -> "expected the name of this struct data \n"
|
||||||
| 277 -> "expected the name of this struct data \n"
|
| 277 -> "expected the type of this struct data, introduced by the content keyword\n"
|
||||||
| 278 -> "expected the type of this struct data, introduced by the content keyword\n"
|
| 278 -> "expected the type of this struct data\n"
|
||||||
| 279 -> "expected the type of this struct data\n"
|
| 292 -> "expected the name of this struct condition\n"
|
||||||
| 293 -> "expected the name of this struct condition\n"
|
| 285 -> "expected a new struct data, or another declaration or scope use\n"
|
||||||
| 286 -> "expected a new struct data, or another declaration or scope use\n"
|
| 286 -> "expected the type of the parameter of this struct data function\n"
|
||||||
| 287 -> "expected the type of the parameter of this struct data function\n"
|
| 290 -> "expected a new struct data, or another declaration or scope use\n"
|
||||||
| 291 -> "expected a new struct data, or another declaration or scope use\n"
|
| 282 -> "expected a new struct data, or another declaration or scope use\n"
|
||||||
| 283 -> "expected a new struct data, or another declaration or scope use\n"
|
| 295 -> "expected the name of the scope you are declaring\n"
|
||||||
| 296 -> "expected the name of the scope you are declaring\n"
|
| 296 -> "expected a colon followed by the list of context items of this scope\n"
|
||||||
| 297 -> "expected a colon followed by the list of context items of this scope\n"
|
| 297 -> "expected a context item introduced by \"context\"\n"
|
||||||
| 298 -> "expected a context item introduced by \"context\"\n"
|
| 298 -> "expected the name of this new context item\n"
|
||||||
| 299 -> "expected the name of this new context item\n"
|
| 299 -> "expected the kind of this context item: is it a condition, a sub-scope or a data?\n"
|
||||||
| 300 -> "expected the kind of this context item: is it a condition, a sub-scope or a data?\n"
|
| 300 -> "expected the name of the subscope for this context item\n"
|
||||||
| 301 -> "expected the name of the subscope for this context item\n"
|
| 307 -> "expected another scope context item or the end of the scope declaration\n"
|
||||||
| 308 -> "expected another scope context item or the end of the scope declaration\n"
|
| 302 -> "expected the type of this context item\n"
|
||||||
| 303 -> "expected the type of this context item\n"
|
| 303 -> "expected the next context item or a dependency declaration for this item\n"
|
||||||
| 304 -> "expected the next context item or a dependency declaration for this item\n"
|
| 305 -> "expected the next context item or a dependency declaration for this item\n"
|
||||||
| 306 -> "expected the next context item or a dependency declaration for this item\n"
|
| 310 -> "expected the name of your enum\n"
|
||||||
| 311 -> "expected the name of your enum\n"
|
| 311 -> "expected a colon\n"
|
||||||
| 312 -> "expected a colon\n"
|
| 312 -> "expected an enum case\n"
|
||||||
| 313 -> "expected an enum case\n"
|
| 313 -> "expected the name of an enum case \n"
|
||||||
| 314 -> "expected the name of an enum case \n"
|
| 314 -> "expected a payload for your enum case, or another case or declaration \n"
|
||||||
| 315 -> "expected a payload for your enum case, or another case or declaration \n"
|
| 315 -> "expected a content type\n"
|
||||||
| 316 -> "expected a content type\n"
|
| 320 -> "expected another enum case, or a new declaration or scope use\n"
|
||||||
| 321 -> "expected another enum case, or a new declaration or scope use\n"
|
|
||||||
| 18 -> "expected a declaration or a scope use\n"
|
| 18 -> "expected a declaration or a scope use\n"
|
||||||
| 19 -> "expected some text or the beginning of a code section\n"
|
| 19 -> "expected some text or the beginning of a code section\n"
|
||||||
| 20 -> "expected a declaration or a scope use\n"
|
| 20 -> "expected a declaration or a scope use\n"
|
||||||
| 21 -> "should not happen\n"
|
| 21 -> "should not happen\n"
|
||||||
|
| 326 -> "expected a metadata-closing tag\n"
|
||||||
| 327 -> "expected a metadata-closing tag\n"
|
| 327 -> "expected a metadata-closing tag\n"
|
||||||
| 328 -> "expected a metadata-closing tag\n"
|
|
||||||
| _ -> raise Not_found
|
| _ -> raise Not_found
|
||||||
|
@ -78,7 +78,7 @@ ace.define("ace/mode/catala_en_highlighting_rules", ["require", "exports", "modu
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": "support.type",
|
"token": "support.type",
|
||||||
"regex": "\\b(integer|boolean|date|money|text|decimal|number|sum|now)\\b"
|
"regex": "\\b(integer|boolean|date|money|text|decimal|number|sum)\\b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": ["entity.name.class", "punctuation", "entity.name.function"],
|
"token": ["entity.name.class", "punctuation", "entity.name.function"],
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
'name' : 'keyword.operator.catala_en'
|
'name' : 'keyword.operator.catala_en'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
'match' : '\\b(integer|boolean|date|money|text|decimal|number|sum|now)\\b'
|
'match' : '\\b(integer|boolean|date|money|text|decimal|number|sum)\\b'
|
||||||
'name' : 'support.type.catala_en'
|
'name' : 'support.type.catala_en'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ code : context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
: pattern {
|
: pattern {
|
||||||
regex \= \b(integer|boolean|date|money|text|decimal|number|sum|now)\b
|
regex \= \b(integer|boolean|date|money|text|decimal|number|sum)\b
|
||||||
styles [] = .primitive;
|
styles [] = .primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class CatalaEnLexer(RegexLexer):
|
|||||||
Operator)),
|
Operator)),
|
||||||
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\$|%|year|month|day)',
|
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\$|%|year|month|day)',
|
||||||
bygroups(Operator)),
|
bygroups(Operator)),
|
||||||
(u'\\b(integer|boolean|date|money|text|decimal|number|sum|now)\\b',
|
(u'\\b(integer|boolean|date|money|text|decimal|number|sum)\\b',
|
||||||
bygroups(Keyword.Type)),
|
bygroups(Keyword.Type)),
|
||||||
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
||||||
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
||||||
|
@ -197,7 +197,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>\b(integer|boolean|date|money|text|decimal|number|sum|now)\b</string>
|
<string>\b(integer|boolean|date|money|text|decimal|number|sum)\b</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>support.type.catala_en</string>
|
<string>support.type.catala_en</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -78,7 +78,7 @@ ace.define("ace/mode/catala_fr_highlighting_rules", ["require", "exports", "modu
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": "support.type",
|
"token": "support.type",
|
||||||
"regex": "\\b(entier|bool\u00e9en|date|argent|texte|d\u00e9cimal|d\u00e9cret|loi|nombre|somme|date_aujourd_hui)\\b"
|
"regex": "\\b(entier|bool\u00e9en|date|argent|texte|d\u00e9cimal|d\u00e9cret|loi|nombre|somme)\\b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": ["entity.name.class", "punctuation", "entity.name.function"],
|
"token": ["entity.name.class", "punctuation", "entity.name.function"],
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
'name' : 'keyword.operator.catala_fr'
|
'name' : 'keyword.operator.catala_fr'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
'match' : '\\b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme|date_aujourd_hui)\\b'
|
'match' : '\\b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme)\\b'
|
||||||
'name' : 'support.type.catala_fr'
|
'name' : 'support.type.catala_fr'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ code : context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
: pattern {
|
: pattern {
|
||||||
regex \= \b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme|date_aujourd_hui)\b
|
regex \= \b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme)\b
|
||||||
styles [] = .primitive;
|
styles [] = .primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class CatalaFrLexer(RegexLexer):
|
|||||||
Operator)),
|
Operator)),
|
||||||
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|non|ou|et|=|>|<|\u20ac|%|an|mois|jour)',
|
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|non|ou|et|=|>|<|\u20ac|%|an|mois|jour)',
|
||||||
bygroups(Operator)),
|
bygroups(Operator)),
|
||||||
(u'\\b(entier|bool\xe9en|date|argent|texte|d\xe9cimal|d\xe9cret|loi|nombre|somme|date_aujourd_hui)\\b',
|
(u'\\b(entier|bool\xe9en|date|argent|texte|d\xe9cimal|d\xe9cret|loi|nombre|somme)\\b',
|
||||||
bygroups(Keyword.Type)),
|
bygroups(Keyword.Type)),
|
||||||
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
||||||
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
||||||
|
@ -197,7 +197,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>\b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme|date_aujourd_hui)\b</string>
|
<string>\b(entier|booléen|date|argent|texte|décimal|décret|loi|nombre|somme)\b</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>support.type.catala_fr</string>
|
<string>support.type.catala_fr</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
'name' : 'keyword.operator.catala_nv'
|
'name' : 'keyword.operator.catala_nv'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
'match' : '\\b(int|bool|date|money|text|decimal|number|sum|now)\\b'
|
'match' : '\\b(int|bool|date|money|text|decimal|number|sum)\\b'
|
||||||
'name' : 'support.type.catala_nv'
|
'name' : 'support.type.catala_nv'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ code : context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
: pattern {
|
: pattern {
|
||||||
regex \= \b(int|bool|date|money|text|decimal|number|sum|now)\b
|
regex \= \b(int|bool|date|money|text|decimal|number|sum)\b
|
||||||
styles [] = .primitive;
|
styles [] = .primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class CatalaNvLexer(RegexLexer):
|
|||||||
bygroups(Operator)),
|
bygroups(Operator)),
|
||||||
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\\$|%|year|month|day)',
|
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\\$|%|year|month|day)',
|
||||||
bygroups(Operator)),
|
bygroups(Operator)),
|
||||||
(u'\\b(int|bool|date|money|text|decimal|number|sum|now)\\b',
|
(u'\\b(int|bool|date|money|text|decimal|number|sum)\\b',
|
||||||
bygroups(Keyword.Type)),
|
bygroups(Keyword.Type)),
|
||||||
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
||||||
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
||||||
|
@ -197,7 +197,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>\b(int|bool|date|money|text|decimal|number|sum|now)\b</string>
|
<string>\b(int|bool|date|money|text|decimal|number|sum)\b</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>support.type.catala_nv</string>
|
<string>support.type.catala_nv</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -9,10 +9,14 @@ scope A:
|
|||||||
|
|
||||||
new scope B:
|
new scope B:
|
||||||
param a scope A
|
param a scope A
|
||||||
|
param v content int
|
||||||
|
param w content bool
|
||||||
param y content bool
|
param y content bool
|
||||||
param z content bool
|
param z content bool
|
||||||
|
|
||||||
scope B:
|
scope B:
|
||||||
|
def v := number of a.x
|
||||||
|
def w := 64 in a.x
|
||||||
def y := exists m in a.x such that m = 9
|
def y := exists m in a.x such that m = 9
|
||||||
def z := for all m in a.x we have m > 0
|
def z := for all m in a.x we have m > 0
|
||||||
*/
|
*/
|
Loading…
Reference in New Issue
Block a user