mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Change type syntax of collection
into list of
This commit is contained in:
parent
3779a249db
commit
e123d7eb95
@ -162,8 +162,7 @@ let rec typ_gen
|
||||
(typ ~colors:(List.tl colors))
|
||||
t2
|
||||
| TArray t1 ->
|
||||
Format.fprintf fmt "@[<hov 2>%a@ %a@]" base_type "collection" (typ ~colors)
|
||||
t1
|
||||
Format.fprintf fmt "@[<hov 2>%a@ %a@]" base_type "list of" (typ ~colors) t1
|
||||
| TDefault t1 ->
|
||||
punctuation fmt "⟨";
|
||||
typ ~colors fmt t1;
|
||||
|
@ -157,9 +157,8 @@ let rec format_typ
|
||||
")" (format_typ ~colors) t2
|
||||
| TArray t1 -> (
|
||||
match Mark.remove (UnionFind.get (UnionFind.find t1)) with
|
||||
| TAny _ when not Cli.globals.debug ->
|
||||
Format.pp_print_string fmt "collection"
|
||||
| _ -> Format.fprintf fmt "@[collection@ %a@]" (format_typ ~colors) t1)
|
||||
| TAny _ when not Cli.globals.debug -> Format.pp_print_string fmt "list"
|
||||
| _ -> Format.fprintf fmt "@[list of@ %a@]" (format_typ ~colors) t1)
|
||||
| TDefault t1 ->
|
||||
Format.pp_print_as fmt 1 "⟨";
|
||||
format_typ ~colors fmt t1;
|
||||
|
@ -56,8 +56,8 @@ module R = Re.Pcre
|
||||
#ifndef MR_OF
|
||||
#define MR_OF MS_OF
|
||||
#endif
|
||||
#ifndef MR_COLLECTION
|
||||
#define MR_COLLECTION MS_COLLECTION
|
||||
#ifndef MR_LIST
|
||||
#define MR_LIST MS_LIST
|
||||
#endif
|
||||
#ifndef MR_CONTAINS
|
||||
#define MR_CONTAINS MS_CONTAINS
|
||||
@ -203,8 +203,8 @@ module R = Re.Pcre
|
||||
#ifndef MR_IS
|
||||
#define MR_IS MS_IS
|
||||
#endif
|
||||
#ifndef MR_EMPTY
|
||||
#define MR_EMPTY MS_EMPTY
|
||||
#ifndef MR_LIST_EMPTY
|
||||
#define MR_LIST_EMPTY MS_LIST_EMPTY
|
||||
#endif
|
||||
#ifndef MR_CARDINAL
|
||||
#define MR_CARDINAL MS_CARDINAL
|
||||
@ -266,7 +266,7 @@ let token_list : (string * token) list =
|
||||
(MS_DECREASING, DECREASING);
|
||||
(MS_INCREASING, INCREASING);
|
||||
(MS_OF, OF);
|
||||
(MS_COLLECTION, COLLECTION);
|
||||
(MS_LIST, LIST);
|
||||
(MS_CONTAINS, CONTAINS);
|
||||
(MS_ENUM, ENUM);
|
||||
(MS_INTEGER, INTEGER);
|
||||
@ -315,7 +315,7 @@ let token_list : (string * token) list =
|
||||
(MS_MAXIMUM, MAXIMUM);
|
||||
(MS_MINIMUM, MINIMUM);
|
||||
(MS_IS, IS);
|
||||
(MS_EMPTY, EMPTY);
|
||||
(MS_LIST_EMPTY, LIST_EMPTY);
|
||||
(MS_CARDINAL, CARDINAL);
|
||||
(MS_YEAR, YEAR);
|
||||
(MS_MONTH, MONTH);
|
||||
@ -417,9 +417,9 @@ let rec lex_code (lexbuf : lexbuf) : token =
|
||||
| MR_OF ->
|
||||
L.update_acc lexbuf;
|
||||
OF
|
||||
| MR_COLLECTION ->
|
||||
| MR_LIST ->
|
||||
L.update_acc lexbuf;
|
||||
COLLECTION
|
||||
LIST
|
||||
| MR_CONTAINS ->
|
||||
L.update_acc lexbuf;
|
||||
CONTAINS
|
||||
@ -567,9 +567,9 @@ let rec lex_code (lexbuf : lexbuf) : token =
|
||||
| MR_IS ->
|
||||
L.update_acc lexbuf;
|
||||
IS
|
||||
| MR_EMPTY ->
|
||||
| MR_LIST_EMPTY ->
|
||||
L.update_acc lexbuf;
|
||||
EMPTY
|
||||
LIST_EMPTY
|
||||
| MR_CARDINAL ->
|
||||
L.update_acc lexbuf;
|
||||
CARDINAL
|
||||
|
@ -28,7 +28,8 @@
|
||||
#define MS_DECREASING "decreasing"
|
||||
#define MS_INCREASING "increasing"
|
||||
#define MS_OF "of"
|
||||
#define MS_COLLECTION "collection"
|
||||
#define MS_LIST "list of"
|
||||
#define MR_LIST "list", space_plus, "of"
|
||||
#define MS_CONTAINS "contains"
|
||||
#define MS_ENUM "enumeration"
|
||||
#define MS_INTEGER "integer"
|
||||
@ -80,7 +81,8 @@
|
||||
#define MS_MAXIMUM "maximum"
|
||||
#define MS_MINIMUM "minimum"
|
||||
#define MS_IS "is"
|
||||
#define MS_EMPTY "empty"
|
||||
#define MS_LIST_EMPTY "list empty"
|
||||
#define MR_LIST_EMPTY "list", space_plus, "empty"
|
||||
#define MS_CARDINAL "number"
|
||||
#define MS_YEAR "year"
|
||||
#define MS_MONTH "month"
|
||||
|
@ -36,7 +36,8 @@
|
||||
#define MR_DECREASING "d", 0xE9, "croissant"
|
||||
#define MS_INCREASING "croissant"
|
||||
#define MS_OF "de"
|
||||
#define MS_COLLECTION "collection"
|
||||
#define MS_LIST "liste de"
|
||||
#define MR_LIST "liste", space_plus, "de"
|
||||
#define MS_CONTAINS "contient"
|
||||
#define MS_ENUM "énumération"
|
||||
#define MR_ENUM 0xE9, "num", 0xE9, "ration"
|
||||
@ -100,7 +101,8 @@
|
||||
#define MS_MAXIMUM "maximum"
|
||||
#define MS_MINIMUM "minimum"
|
||||
#define MS_IS "est"
|
||||
#define MS_EMPTY "vide"
|
||||
#define MS_LIST_EMPTY "liste vide"
|
||||
#define MR_LIST_EMPTY "liste", space_plus, "vide"
|
||||
#define MS_CARDINAL "nombre"
|
||||
#define MS_YEAR "an"
|
||||
#define MS_MONTH "mois"
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define MS_INCREASING "rosnący"
|
||||
#define MR_INCREASING "rosn", 0x0105, "cy"
|
||||
#define MS_OF "z"
|
||||
#define MS_COLLECTION "kolekcja"
|
||||
#define MS_LIST "lista"
|
||||
#define MS_CONTAINS "zawiera"
|
||||
#define MS_ENUM "enumeracja"
|
||||
#define MS_INTEGER "całkowita"
|
||||
@ -93,7 +93,8 @@
|
||||
#define MS_MAXIMUM "maksimum"
|
||||
#define MS_MINIMUM "minimum"
|
||||
#define MS_IS "jest"
|
||||
#define MS_EMPTY "pusty"
|
||||
#define MS_LIST_EMPTY "lista pusta"
|
||||
#define MR_LIST_EMPTY "lista", space_plus, "pusta"
|
||||
#define MS_CARDINAL "liczba"
|
||||
#define MS_YEAR "rok"
|
||||
#define MS_MONTH "miesiąc"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -119,7 +119,7 @@ let primitive_typ :=
|
||||
|
||||
let typ_data :=
|
||||
| t = primitive_typ ; <Primitive>
|
||||
| COLLECTION ; t = addpos(typ_data) ; <Collection>
|
||||
| LIST ; t = addpos(typ_data) ; <Collection>
|
||||
|
||||
let typ == t = typ_data ; <Data>
|
||||
|
||||
@ -213,7 +213,7 @@ let naked_expression ==
|
||||
} %prec apply
|
||||
| max = minmax ;
|
||||
OF ; coll = expression ;
|
||||
OR ; IF ; COLLECTION ; EMPTY ; THEN ;
|
||||
OR ; IF ; LIST_EMPTY ; THEN ;
|
||||
default = expression ; {
|
||||
CollectionOp (AggregateExtremum { max; default }, coll)
|
||||
} %prec apply
|
||||
@ -265,7 +265,7 @@ let naked_expression ==
|
||||
AMONG ; coll = expression ;
|
||||
SUCH ; THAT ; f = expression ;
|
||||
IS ; max = minmax ;
|
||||
OR ; IF ; COLLECTION ; EMPTY ; THEN ; default = expression ; {
|
||||
OR ; IF ; LIST_EMPTY ; THEN ; default = expression ; {
|
||||
CollectionOp (AggregateArgExtremum { max; default; f = i, f }, coll)
|
||||
} %prec top_expr
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
%token<string * string> MONEY_AMOUNT
|
||||
%token BEGIN_CODE TEXT
|
||||
%token COLON ALT DATA
|
||||
%token OF INTEGER COLLECTION CONTAINS AMONG
|
||||
%token OF INTEGER LIST CONTAINS AMONG
|
||||
%token RULE CONDITION DEFINED_AS
|
||||
%token<Ast.op_kind> LESSER GREATER LESSER_EQUAL GREATER_EQUAL
|
||||
%token LET EXISTS IN SUCH THAT COMMA
|
||||
@ -55,6 +55,6 @@
|
||||
%token BEGIN_METADATA MONEY DECIMAL
|
||||
%token UNDER_CONDITION CONSEQUENCE LBRACE RBRACE
|
||||
%token LABEL EXCEPTION LBRACKET RBRACKET SEMICOLON
|
||||
%token MAXIMUM MINIMUM IS EMPTY
|
||||
%token MAXIMUM MINIMUM IS LIST_EMPTY
|
||||
|
||||
%%
|
||||
|
@ -273,7 +273,7 @@
|
||||
\end{catala}
|
||||
& \begin{catala}
|
||||
```catala
|
||||
collection integer
|
||||
list of integer
|
||||
```
|
||||
\end{catala}
|
||||
|
||||
@ -632,7 +632,7 @@
|
||||
\\
|
||||
\end{tabular}
|
||||
|
||||
\section{Collection operations}
|
||||
\section{List operations}
|
||||
|
||||
\begin{tabular}{@{}p{\cola}>{\slshape}p{\colb}@{}}
|
||||
\begin{catala}
|
||||
@ -709,7 +709,7 @@
|
||||
\begin{catala}
|
||||
```catala
|
||||
maximum of coll
|
||||
or if collection empty then -1
|
||||
or if list empty then -1
|
||||
```
|
||||
\end{catala}
|
||||
& Extremum
|
||||
@ -718,7 +718,7 @@
|
||||
```catala
|
||||
x among coll
|
||||
such that (x * x) is minimum
|
||||
or if collection empty then -1
|
||||
or if list empty then -1
|
||||
```
|
||||
\end{catala}
|
||||
& Arg-extremum
|
||||
|
@ -273,7 +273,7 @@
|
||||
\end{catala}
|
||||
& \begin{catala}
|
||||
```catala
|
||||
collection entier
|
||||
liste de entier
|
||||
```
|
||||
\end{catala}
|
||||
|
||||
@ -631,7 +631,7 @@
|
||||
\\
|
||||
\end{tabular}
|
||||
|
||||
\section{Opérations sur les collections}
|
||||
\section{Opérations sur les listes}
|
||||
|
||||
\begin{tabular}{@{}p{\cola}>{\slshape}p{\colb}@{}}
|
||||
\begin{catala}
|
||||
@ -693,10 +693,10 @@
|
||||
\\
|
||||
\begin{catala}
|
||||
```catala
|
||||
somme entier coll
|
||||
somme entier de coll
|
||||
```
|
||||
\end{catala}
|
||||
& Aggrégation
|
||||
& Agrégation
|
||||
\\
|
||||
\begin{catala}
|
||||
```catala
|
||||
@ -708,7 +708,7 @@
|
||||
\begin{catala}
|
||||
```catala
|
||||
maximum de coll
|
||||
ou si collection vide alors -1
|
||||
ou si liste vide alors -1
|
||||
```
|
||||
\end{catala}
|
||||
& Extremums
|
||||
@ -717,7 +717,7 @@
|
||||
```catala
|
||||
x parmi coll
|
||||
tel que (x * x) est minimum
|
||||
ou si collection vide alors -1
|
||||
ou si liste vide alors -1
|
||||
```
|
||||
\end{catala}
|
||||
& Élément selon extremum
|
||||
|
@ -216,9 +216,9 @@ déclaration énumération DateNaissanceTroisièmeOuDernierPlusEnfant:
|
||||
-- PlusDeTroisEnfants contenu DateDeNaissanceOuMoisDeGrossesse
|
||||
|
||||
déclaration structure Ménage:
|
||||
donnée prestations_reçues contenu collection PrestationReçue
|
||||
donnée prestations_reçues contenu liste de PrestationReçue
|
||||
donnée logement contenu Logement
|
||||
donnée personnes_à_charge contenu collection PersonneÀCharge
|
||||
donnée personnes_à_charge contenu liste de PersonneÀCharge
|
||||
donnée nombre_autres_occupants_logement contenu entier
|
||||
donnée situation_familiale contenu SituationFamiliale
|
||||
donnée condition_rattaché_foyer_fiscal_parent_ifi contenu booléen
|
||||
@ -311,7 +311,7 @@ déclaration champ d'application ÉligibilitéAidesPersonnelleLogement:
|
||||
interne prise_en_compte_personne_à_charge condition
|
||||
dépend de personne_à_charge contenu PersonneÀCharge
|
||||
interne personnes_à_charge_prises_en_compte
|
||||
contenu collection PersonneÀCharge
|
||||
contenu liste de PersonneÀCharge
|
||||
contexte date_entrée_vigueur_différée_cch contenu date
|
||||
interne nombre_personnes_logement contenu entier
|
||||
|
||||
@ -330,7 +330,7 @@ déclaration champ d'application ÉligibilitéAidesPersonnelleLogement:
|
||||
résultat éligibilité condition
|
||||
résultat nombre_personnes_à_charge_prises_en_compte contenu entier
|
||||
résultat coefficents_enfants_garde_alternée_pris_en_compte contenu
|
||||
collection décimal
|
||||
liste de décimal
|
||||
résultat condition_2_r823_4 condition
|
||||
dépend de personne_à_charge contenu PersonneÀCharge
|
||||
|
||||
@ -388,7 +388,7 @@ déclaration champ d'application ÉligibilitéAidePersonnaliséeLogement:
|
||||
résultat éligibilité condition
|
||||
résultat nombre_personnes_à_charge_prises_en_compte contenu entier
|
||||
résultat coefficents_enfants_garde_alternée_pris_en_compte contenu
|
||||
collection décimal
|
||||
liste de décimal
|
||||
|
||||
|
||||
champ d'application ÉligibilitéAidePersonnaliséeLogement:
|
||||
@ -437,7 +437,7 @@ déclaration champ d'application ÉligibilitéAllocationLogement:
|
||||
état l841_2
|
||||
résultat nombre_personnes_à_charge_prises_en_compte contenu entier
|
||||
résultat coefficents_enfants_garde_alternée_pris_en_compte contenu
|
||||
collection décimal
|
||||
liste de décimal
|
||||
|
||||
champ d'application ÉligibilitéAllocationLogement:
|
||||
# Ici nous instancions le champ d'application d'éligibilité aux prestations
|
||||
@ -608,9 +608,9 @@ déclaration champ d'application CalculÉquivalenceLoyerMinimale:
|
||||
entrée condition_2_du_832_25 contenu booléen
|
||||
entrée n_nombre_parts_d832_25 contenu décimal
|
||||
|
||||
interne tranches_revenus_d832_26 contenu collection TrancheRevenu
|
||||
interne tranches_revenus_d832_26 contenu liste de TrancheRevenu
|
||||
interne tranches_revenus_d832_26_multipliées contenu
|
||||
collection TrancheRevenuDécimal
|
||||
liste de TrancheRevenuDécimal
|
||||
interne montant_forfaitaire_d832_26 contenu argent
|
||||
|
||||
résultat montant contenu argent
|
||||
@ -1137,7 +1137,7 @@ déclaration champ d'application CalculetteAidesAuLogement:
|
||||
résultat traitement_aide_finale contenu argent
|
||||
dépend de aide_finale contenu argent
|
||||
résultat coefficents_enfants_garde_alternée_pris_en_compte contenu
|
||||
collection décimal
|
||||
liste de décimal
|
||||
|
||||
champ d'application CalculetteAidesAuLogement:
|
||||
définition éligibilité_aide_personnalisée_logement.ménage égal à
|
||||
@ -1205,7 +1205,7 @@ déclaration champ d'application CalculetteAidesAuLogementGardeAlternée:
|
||||
|
||||
interne ménage_sans_enfants_garde_alternée contenu Ménage
|
||||
interne coefficents_enfants_garde_alternée_pris_en_compte contenu
|
||||
collection décimal
|
||||
liste de décimal
|
||||
|
||||
calculette champ d'application CalculetteAidesAuLogement
|
||||
calculette_sans_garde_alternée champ d'application CalculetteAidesAuLogement
|
||||
|
@ -12,7 +12,7 @@ champ d'application EnfantLePlusÂgé:
|
||||
définition le_plus_âgé égal à
|
||||
potentiel_plus_âgé parmi enfants tel que
|
||||
potentiel_plus_âgé.date_de_naissance est minimum
|
||||
ou si collection vide alors Enfant {
|
||||
ou si liste vide alors Enfant {
|
||||
-- identifiant: -1
|
||||
-- obligation_scolaire: Pendant
|
||||
-- rémuneration_mensuelle: 0€
|
||||
@ -72,8 +72,8 @@ déclaration structure EnfantEntrée:
|
||||
|
||||
déclaration champ d'application InterfaceAllocationsFamiliales:
|
||||
entrée i_date_courante contenu date
|
||||
entrée i_enfants contenu collection EnfantEntrée
|
||||
interne enfants_à_charge contenu collection Enfant
|
||||
entrée i_enfants contenu liste de EnfantEntrée
|
||||
interne enfants_à_charge contenu liste de Enfant
|
||||
allocations_familiales champ d'application AllocationsFamiliales
|
||||
entrée i_ressources_ménage contenu argent
|
||||
entrée i_résidence contenu Collectivité
|
||||
@ -137,4 +137,4 @@ champ d'application InterfaceAllocationsFamiliales:
|
||||
NOTA :
|
||||
|
||||
Conformément à l'article 63 de la loi n° 2019-791 du 26 juillet 2019, ces
|
||||
dispositions entrent en vigueur à la rentrée scolaire 2019.
|
||||
dispositions entrent en vigueur à la rentrée scolaire 2019.
|
||||
|
@ -65,7 +65,7 @@ déclaration champ d'application AllocationFamilialesAvril2008:
|
||||
résultat âge_minimum_alinéa_1_l521_3 contenu durée
|
||||
|
||||
déclaration champ d'application EnfantLePlusÂgé:
|
||||
entrée enfants contenu collection Enfant
|
||||
entrée enfants contenu liste de Enfant
|
||||
résultat le_plus_âgé contenu Enfant
|
||||
|
||||
déclaration champ d'application AllocationsFamiliales:
|
||||
@ -80,9 +80,9 @@ déclaration champ d'application AllocationsFamiliales:
|
||||
entrée date_courante contenu date
|
||||
|
||||
# Variables concernant les enfants du ménage
|
||||
entrée enfants_à_charge contenu collection Enfant
|
||||
entrée enfants_à_charge contenu liste de Enfant
|
||||
interne enfants_à_charge_droit_ouvert_prestation_familiale
|
||||
contenu collection Enfant
|
||||
contenu liste de Enfant
|
||||
interne prise_en_compte contenu PriseEnCompte dépend de enfant contenu Enfant
|
||||
résultat versement contenu VersementAllocations
|
||||
dépend de enfant contenu Enfant
|
||||
|
@ -31,14 +31,14 @@ déclaration structure BienUsufruitRenteViagère:
|
||||
|
||||
déclaration champ d'application RéserveHéréditaire:
|
||||
résultat quotité_réserve_héréditaire contenu décimal
|
||||
entrée enfants contenu collection Enfant
|
||||
entrée enfants contenu liste de Enfant
|
||||
interne enfant_pris_en_compte_réserve_héréditaire contenu booléen
|
||||
dépend de enfant contenu Enfant
|
||||
interne enfants_réserve_héréditaire contenu collection Enfant
|
||||
interne enfants_réserve_héréditaire contenu liste de Enfant
|
||||
entrée conjoint_survivant_non_divorcé condition
|
||||
|
||||
entrée patrimoine_total contenu argent
|
||||
entrée biens_usufruit_rente_viagère contenu collection BienUsufruitRenteViagère
|
||||
entrée biens_usufruit_rente_viagère contenu liste de BienUsufruitRenteViagère
|
||||
résultat patrimoine_assiette_réserve_héréditaire contenu argent
|
||||
résultat montant_réserve_héréditaire contenu argent
|
||||
```
|
||||
|
@ -819,20 +819,20 @@ scope DateValues:
|
||||
(value1 - |1999-12-31|) + 45 day # 367 + 45 days (2000 is bissextile)
|
||||
```
|
||||
|
||||
### Collections
|
||||
### Listes
|
||||
|
||||
Often, Catala programs need to speak about a collection of data because the law
|
||||
talks about the number of children, the maximum of a list, etc. Catala features
|
||||
first-class support for collections, which are basically fixed-size lists.
|
||||
first-class support for lists.
|
||||
You can create a list, filter its elements but also aggregate over its contents
|
||||
to compute all sorts of values.
|
||||
|
||||
```catala
|
||||
declaration scope CollectionValues:
|
||||
internal value1 content collection integer
|
||||
declaration scope ListValues:
|
||||
internal value1 content list of integer
|
||||
internal value2 content integer
|
||||
|
||||
scope CollectionValues:
|
||||
scope ListValues:
|
||||
definition value1 equals [45;-6;3;4;0;2155]
|
||||
definition value2 equals sum integer of (i * i) for i among value1
|
||||
# sum of squares
|
||||
|
@ -863,18 +863,17 @@ champ d'application ValeursDate:
|
||||
### Collections
|
||||
|
||||
Souvent, les programmes Catala ont besoin de parler de collection de données
|
||||
parce que la loi parle du nombre d’enfants, du maximum d’une liste, etc.
|
||||
Catala propose un support de première classe pour les collections, qui ne sont
|
||||
finalement que des listes de taille fixe. Vous pouvez créer une liste, filtrer
|
||||
ses éléments, mais aussi agréger son contenu pour calculer toutes sortes de
|
||||
valeurs.
|
||||
parce que la loi parle du nombre d’enfants, du maximum d’une liste, etc. Catala
|
||||
propose un support de première classe pour les listes. Vous pouvez créer une
|
||||
liste, filtrer ses éléments, mais aussi agréger son contenu pour calculer toutes
|
||||
sortes de valeurs.
|
||||
|
||||
```catala
|
||||
déclaration champ d'application ValeursDeCollection:
|
||||
interne valeur1 contenu collection entier
|
||||
déclaration champ d'application ValeursDeListe:
|
||||
interne valeur1 contenu liste de entier
|
||||
interne valeur2 contenu entier
|
||||
|
||||
champ d'application ValeursDeCollection:
|
||||
champ d'application ValeursDeListe:
|
||||
définition valeur1 égal à [45;-6;3;4;0;2155]
|
||||
définition valeur2 égal à somme entier de (i * i) pour i parmi valeur1
|
||||
# somme de carré
|
||||
|
@ -6,9 +6,9 @@ declaration structure Period:
|
||||
data end content date
|
||||
|
||||
declaration scope PeriodMerge:
|
||||
context periods1 content collection Period
|
||||
context periods2 content collection Period
|
||||
output output_periods content collection Period
|
||||
context periods1 content list of Period
|
||||
context periods2 content list of Period
|
||||
output output_periods content list of Period
|
||||
|
||||
scope PeriodMerge:
|
||||
# Placeholders, overwritten by caller
|
||||
@ -34,13 +34,13 @@ declaration scope Section121SinglePerson:
|
||||
output requirements_ownership_met condition
|
||||
output requirements_usage_met condition
|
||||
input date_of_sale_or_exchange content date
|
||||
input property_ownage content collection Period
|
||||
input property_ownage content list of Period
|
||||
# Invariant: the periods in the collection are disjoint
|
||||
input property_usage_as_principal_residence
|
||||
content collection Period
|
||||
content list of Period
|
||||
# Invariant: the periods in the collection are disjoint
|
||||
internal aggregate_periods_from_last_five_years content duration
|
||||
depends on periods content collection Period
|
||||
depends on periods content list of Period
|
||||
context output gain_cap content money
|
||||
input gain_from_sale_or_exchange_of_property content money
|
||||
output income_excluded_from_gross_income_uncapped content money
|
||||
@ -49,9 +49,9 @@ declaration scope Section121SinglePerson:
|
||||
input other_section_121a_sale content OtherSection121aSale
|
||||
|
||||
declaration structure PersonalData:
|
||||
data property_ownage content collection Period
|
||||
data property_ownage content list of Period
|
||||
data property_usage_as_principal_residence
|
||||
content collection Period
|
||||
content list of Period
|
||||
data other_section_121a_sale content OtherSection121aSale
|
||||
|
||||
declaration structure JointReturn:
|
||||
|
@ -22,7 +22,7 @@
|
||||
(define-generic-mode 'catala-mode-fr
|
||||
'("#")
|
||||
'("contexte" "entrée" "résultat" "interne"
|
||||
"champ d'application" "si et seulement si" "dépend de" "déclaration" "inclus" "collection" "contenu" "optionnel" "structure" "énumération" "contexte" "entrée" "résultat" "interne" "règle" "sous condition" "condition" "donnée" "conséquence" "rempli" "égal à" "assertion" "définition" "état" "étiquette" "exception" "soit")
|
||||
"champ d'application" "si et seulement si" "dépend de" "déclaration" "inclus" "liste de" "contenu" "optionnel" "structure" "énumération" "contexte" "entrée" "résultat" "interne" "règle" "sous condition" "condition" "donnée" "conséquence" "rempli" "égal à" "assertion" "définition" "état" "étiquette" "exception" "soit" "liste vide")
|
||||
'(("\\<\\(selon\\|sous\s+forme\\|fixé\\|par\\|décroissante\\|croissante\\|varie\\|avec\\|on\s+a\\|soit\\|dans\\|tel\s+que\\|existe\\|pour\\|tout\\|de\\|si\\|alors\\|sinon\\|initial\\)\\>" . font-lock-builtin-face)
|
||||
("\\<\\(vrai\\|faux\\)\\>" . font-lock-constant-face)
|
||||
("\\<\\([0-9][0-9 ]*\\(,[0-9]*\\|\\)\\)\\>" . font-lock-constant-face)
|
||||
@ -41,7 +41,7 @@
|
||||
(define-generic-mode 'catala-mode-en
|
||||
'("#")
|
||||
'("context" "input" "output" "internal"
|
||||
"scope" "depends on" "declaration" "includes" "collection" "content" "optional" "structure" "enumeration" "context" "input" "output" "internal" "rule" "under condition" "condition" "data" "consequence" "fulfilled" "equals" "assertion" "definition" "state" "label" "exception" "let")
|
||||
"scope" "depends on" "declaration" "includes" "list of" "content" "optional" "structure" "enumeration" "context" "input" "output" "internal" "rule" "under condition" "condition" "data" "consequence" "fulfilled" "equals" "assertion" "definition" "state" "label" "exception" "let" "list empty")
|
||||
'(("\\<\\(match\\|with\s+pattern\\|fixed\\|by\\|decreasing\\|increasing\\|varies\\|with\\|we\s+have\\|let\\|in\\|such\s+that\\|exists\\|for\\|all\\|of\\|if\\|then\\|else\\|initial\\)\\>" . font-lock-builtin-face)
|
||||
("|[0-9]\\+-[0-9]\\+-[0-9]\\+|" . font-lock-constant-face)
|
||||
("\\<\\(true\\|false\\)\\>" . font-lock-constant-face)
|
||||
|
@ -75,7 +75,7 @@ ace.define(
|
||||
{
|
||||
token: "keyword.other",
|
||||
regex:
|
||||
"\\b(scope|depends\\s+on|declaration|includes|collection|content|optional|structure|enumeration|context|input|output|internal|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything)\\b",
|
||||
"\\b(scope|depends\\s+on|declaration|includes|list\\s+of|content|optional|structure|enumeration|context|input|output|internal|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything|list\\s+empty)\\b",
|
||||
},
|
||||
{
|
||||
token: "constant.numeric",
|
||||
|
@ -125,7 +125,7 @@
|
||||
'name' : 'keyword.control.catala_en'
|
||||
}
|
||||
{
|
||||
'match' : '\\b(scope|depends\\s+on|declaration|includes|collection|content|optional|structure|enumeration|context|input|output|internal|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything)\\b'
|
||||
'match' : '\\b(scope|depends\\s+on|declaration|includes|list\\s+of|content|optional|structure|enumeration|context|input|output|internal|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything|list\\+empty)\\b'
|
||||
'name' : 'keyword.other.catala_en'
|
||||
}
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ code : context {
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(contains|number|sum|such\s+that|exists|for|all|of|if|then|else|is|empty|among|maximum|minimum|round)\b
|
||||
regex \= \b(contains|number|sum|such\s+that|exists|for|all|of|if|then|else|is|empty|among|maximum|minimum|round|list\s+empty)\b
|
||||
styles [] = .keyword_rule ;
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ code : context {
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(structure|enumeration|collection|integer|boolean|date|duration|money|text|decimal)\b
|
||||
regex \= \b(structure|enumeration|list\s+of|integer|boolean|date|duration|money|text|decimal)\b
|
||||
styles [] = .primitive;
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@ class CustomLexer(RegexLexer):
|
||||
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
|
||||
(u'(context|input|output|internal)(\\s*)(|output)(\\s+)([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_\\\']*)', bygroups(Keyword.Declaration, String, Keyword.Declaration, String, Name.Variable)),
|
||||
(u'\\b(match|with\\s+pattern|fixed|by|decreasing|increasing|varies|with|we\\s+have|let|in|scope|depends\\s+on|declaration|includes|content|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception)\\b', bygroups(Keyword.Reserved)),
|
||||
(u'\\b(contains|number|sum|such\\s+that|exists|for|all|of|if|then|else|is|empty|among|maximum|minimum|round)\\b', bygroups(Keyword.Declaration)),
|
||||
(u'\\b(contains|number|sum|such\\s+that|exists|for|all|of|if|then|else|is|list\\s+empty|among|maximum|minimum|round)\\b', bygroups(Keyword.Declaration)),
|
||||
(u'(\\|[0-9]+\\-[0-9]+\\-[0-9]+\\|)', bygroups(Number.Integer)),
|
||||
(u'\\b(true|false)\\b', bygroups(Keyword.Constant)),
|
||||
(u'\\b([0-9]+(,[0-9]*|))\\b', bygroups(Number.Integer)),
|
||||
(u'(\\-\\-|\\;|\\.|\\,|\\:|\\(|\\)|\\[|\\]|\\{|\\})', bygroups(Operator)),
|
||||
(u'(\\-\\>|\\+\\.|\\+\\@|\\+\\^|\\+\\$|\\+|\\-\\.|\\-\\@|\\-\\^|\\-\\$|\\-|\\*\\.|\\*\\@|\\*\\^|\\*\\$|\\*|/\\.|/\\@|/\\$|/|\\!|>\\.|>=\\.|<=\\.|<\\.|>\\@|>=\\@|<=\\@|<\\@|>\\$|>=\\$|<=\\$|<\\$|>\\^|>=\\^|<=\\^|<\\^|>|>=|<=|<|=|not|or|xor|and|\\$|\u20ac|%|year|month|day)', bygroups(Operator)),
|
||||
(u'\\b(structure|enumeration|collection|integer|boolean|date|duration|money|text|decimal)\\b', bygroups(Keyword.Type)),
|
||||
(u'\\b(structure|enumeration|list\\s+of|integer|boolean|date|duration|money|text|decimal)\\b', 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\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, String)),
|
||||
(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_\\\']*)\\b', bygroups(Name.Variable)),
|
||||
|
@ -22,7 +22,7 @@ syn match Include "^\s*>\s*Include:.*$"
|
||||
|
||||
syn match sc_id_def contained "\<\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
|
||||
syn match cc_id contained "\<\([A-ZÉÈÀÂÙÎÔÊŒÇ][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
|
||||
syn match Keyword contained "\<\(scope\|depends\s\+on\|declaration\|includes\|collection\|content\|optional\|structure\|enumeration\|context\|rule\|under\s\+condition\|condition\|data\|consequence\|fulfilled\|equals\|assertion\|definition\|state\|label\|exception\|anything\)\>"
|
||||
syn match Keyword contained "\<\(scope\|depends\s\+on\|declaration\|includes\|list\s\+of\|content\|optional\|structure\|enumeration\|context\|rule\|under\s\+condition\|condition\|data\|consequence\|fulfilled\|equals\|assertion\|definition\|state\|label\|exception\|anything\)\>"
|
||||
syn match Statement contained "\<\(match\|with\s\+pattern\|fixed\|by\|decreasing\|increasing\|varies\|with\|we\s\+have\|let\|in\|such\s\+that\|exists\|for\|all\|of\|if\|then\|else\|initial\)\>"
|
||||
syn keyword Conditional contained if then else
|
||||
syn match Comment contained "#.*$"
|
||||
|
@ -200,7 +200,7 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(scope|depends\s+on|declaration|includes|collection|content|optional|structure|enumeration|context|input|output|internal|rule|under\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything)\b</string>
|
||||
<string>\b(scope|depends\s+on|declaration|includes|list\s+of|content|optional|structure|enumeration|context|input|output|internal|rule|under\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|state|label|exception|anything)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.other.catala_en</string>
|
||||
</dict>
|
||||
|
@ -75,7 +75,7 @@ ace.define(
|
||||
{
|
||||
token: "keyword.other",
|
||||
regex:
|
||||
"\\b(champ\\s+d'application|si\\s+et\\s+seulement\\s+si|d\u00e9pend\\s+de|d\u00e9claration|inclus|collection|contenu|optionnel|structure|\u00e9num\u00e9ration|contexte|entr\u00e9e|r\u00e9sultat|interne|r\u00e8gle|sous\\s+condition|condition|donn\u00e9e|cons\u00e9quence|rempli|\u00e9gal\\s+\u00e0|assertion|d\u00e9finition|\u00e9tat|\u00e9tiquette|exception|n'importe\\s+quel)\\b",
|
||||
"\\b(champ\\s+d'application|si\\s+et\\s+seulement\\s+si|d\u00e9pend\\s+de|d\u00e9claration|inclus|liste\\s+de|contenu|optionnel|structure|\u00e9num\u00e9ration|contexte|entr\u00e9e|r\u00e9sultat|interne|r\u00e8gle|sous\\s+condition|condition|donn\u00e9e|cons\u00e9quence|rempli|\u00e9gal\\s+\u00e0|assertion|d\u00e9finition|\u00e9tat|\u00e9tiquette|exception|n'importe\\s+quel)\\b",
|
||||
},
|
||||
{
|
||||
token: "constant.numeric",
|
||||
|
@ -125,7 +125,7 @@
|
||||
'name' : 'keyword.control.catala_fr'
|
||||
}
|
||||
{
|
||||
'match' : '\\b(champ\\s+d\'application|si\\s+et\\s+seulement\\s+si|dépend\\s+de|déclaration|inclus|collection|contenu|optionnel|structure|énumération|contexte|entrée|r\\x{00e9}sultat|interne|règle|sous\\s+condition|condition|donnée|conséquence|rempli|égal\\s+à|assertion|définition|état|étiquette|exception|n\'importe\\s+quel)\\b'
|
||||
'match' : '\\b(champ\\s+d\'application|si\\s+et\\s+seulement\\s+si|dépend\\s+de|déclaration|inclus|liste\\s+de|contenu|optionnel|structure|énumération|contexte|entrée|r\\x{00e9}sultat|interne|règle|sous\\s+condition|condition|donnée|conséquence|rempli|égal\\s+à|assertion|définition|état|étiquette|exception|n\'importe\\s+quel)\\b'
|
||||
'name' : 'keyword.other.catala_fr'
|
||||
}
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ code : context {
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(contient|nombre|somme|tel\s+que|existe|pour|tout|de|si|alors|sinon|est|vide|parmi|maximum|minimum|arrondi)\b
|
||||
regex \= \b(contient|nombre|somme|tel\s+que|existe|pour|tout|de|si|alors|sinon|est|liste\s+vide|parmi|maximum|minimum|arrondi)\b
|
||||
styles [] = .keyword_rule ;
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ code : context {
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(structure|énumération|collection|entier|booléen|date|durée|argent|texte|décimal|décret|loi|nombre|somme)\b
|
||||
regex \= \b(structure|énumération|liste\s+de|entier|booléen|date|durée|argent|texte|décimal|décret|loi|nombre|somme)\b
|
||||
styles [] = .primitive;
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,14 @@ class CustomLexer(RegexLexer):
|
||||
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
|
||||
(u'(contexte|entr\xe9e|r\xe9sultat|interne)(\\s*)(|r\xe9sultat)(\\s+)([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_\\\']*)', bygroups(Keyword.Declaration, String, Keyword.Declaration, String, Name.Variable)),
|
||||
(u'\\b(selon|sous\\s+forme|fix\xe9|par|d\xe9croissante|croissante|varie|avec|on\\s+a|soit|dans|champ\\s+d\'application|d\xe9pend\\s+de|d\xe9claration|inclusion|contenu|r\xe8gle|sous\\s+condition|condition|donn\xe9e|cons\xe9quence|rempli|\xe9gal\\s+\xe0|assertion|d\xe9finition|\xe9tat|\xe9tiquette|exception)\\b', bygroups(Keyword.Reserved)),
|
||||
(u'\\b(contient|nombre|somme|tel\\s+que|existe|pour|tout|de|si|alors|sinon|est|vide|parmi|maximum|minimum|arrondi)\\b', bygroups(Keyword.Declaration)),
|
||||
(u'\\b(contient|nombre|somme|tel\\s+que|existe|pour|tout|de|si|alors|sinon|est|liste\\s+vide|parmi|maximum|minimum|arrondi)\\b', bygroups(Keyword.Declaration)),
|
||||
(u'(\\|[0-9]+\\-[0-9]+\\-[0-9]+\\|)', bygroups(Number.Integer)),
|
||||
(u'\\b(vrai|faux)\\b', bygroups(Keyword.Constant)),
|
||||
(u'\\b([0-9]+(,[0-9]*|))\\b', bygroups(Number.Integer)),
|
||||
(u'(\\-\\-|\\;|\\.|\\,|\\:|\\(|\\)|\\[|\\]|\\{|\\})', bygroups(Operator)),
|
||||
(u'(\\-\\>|\\+\\.|\\+\\@|\\+\\^|\\+\u20ac|\\+|\\-\\.|\\-\\@|\\-\\^|\\-\u20ac|\\-|\\*\\.|\\*\\@|\\*\\^|\\*\u20ac|\\*|/\\.|/\\@|/\u20ac|/|\\!|>\\.|>=\\.|<=\\.|<\\.|>\\@|>=\\@|<=\\@|<\\@|>\u20ac|>=\u20ac|<=\u20ac|<\u20ac|>\\^|>=\\^|<=\\^|<\\^|>|>=|<=|<|=|\u20ac|%)', bygroups(Operator)),
|
||||
(u'\\b(non|ou\\s+bien|ou|et|an|mois|jour)\\b', bygroups(Operator)),
|
||||
(u'\\b(structure|\xe9num\xe9ration|collection|entier|bool\xe9en|date|dur\xe9e|argent|texte|d\xe9cimal|d\xe9cret|loi|nombre|somme)\\b', bygroups(Keyword.Type)),
|
||||
(u'\\b(structure|\xe9num\xe9ration|liste\\s+de|entier|bool\xe9en|date|dur\xe9e|argent|texte|d\xe9cimal|d\xe9cret|loi|nombre|somme)\\b', 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\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, String)),
|
||||
(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_\\\']*)\\b', bygroups(Name.Variable)),
|
||||
|
@ -23,7 +23,7 @@ syn match Include "^\s*>\s*Inclusion:.*$"
|
||||
syn match sc_id_def contained "\<\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
|
||||
syn match cc_id contained "\<\([A-ZÉÈÀÂÙÎÔÊŒÇ][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
|
||||
|
||||
syn match Keyword contained "\<\(contexte\|entrée\|résultat\|interne\|champ\s\+d'application\|collection\|structure\|donnée\|énumération\|définition\|déclaration\|si\s\+et\s\+seulement\s\+si\|dépend\s\+de\|inclus\|contenu\|optionnel\|règle\|sous\s\+condition\|condition\|conséquence\|rempli\|égal\s\+à\|assertion\|état\|étiquette\|exception\|n'importe\s\+quel\)\>"
|
||||
syn match Keyword contained "\<\(contexte\|entrée\|résultat\|interne\|champ\s\+d'application\|liste\s\+de\|structure\|donnée\|énumération\|définition\|déclaration\|si\s\+et\s\+seulement\s\+si\|dépend\s\+de\|inclus\|contenu\|optionnel\|règle\|sous\s\+condition\|condition\|conséquence\|rempli\|égal\s\+à\|assertion\|état\|étiquette\|exception\|n'importe\s\+quel\)\>"
|
||||
syn match Statement contained "\<\(selon\|sous\s\+forme\|fixé\|par\|décroissante\|croissante\|varie\|avec\|on\s\+a\|soit\|dans\|tel\s\+que\|existe\|pour\|tout\|de\|initial\)\>"
|
||||
syn keyword Conditional contained si alors sinon
|
||||
syn match Comment contained "#.*$"
|
||||
|
@ -200,7 +200,7 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(champ\s+d'application|si\s+et\s+seulement\s+si|dépend\s+de|déclaration|inclus|collection|contenu|optionnel|structure|énumération|contexte|entrée|résultat|interne|règle|sous\s+condition|condition|donnée|conséquence|rempli|égal\s+à|assertion|définition|état|étiquette|exception|n'importe\s+quel)\b</string>
|
||||
<string>\b(champ\s+d'application|si\s+et\s+seulement\s+si|dépend\s+de|déclaration|inclus|liste\s+de|contenu|optionnel|structure|énumération|contexte|entrée|résultat|interne|règle|sous\s+condition|condition|donnée|conséquence|rempli|égal\s+à|assertion|définition|état|étiquette|exception|n'importe\s+quel)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.other.catala_fr</string>
|
||||
</dict>
|
||||
|
@ -67,7 +67,7 @@
|
||||
<keyword>上下文</keyword>
|
||||
|
||||
<!--COLLECTION-->
|
||||
<keyword>collection</keyword>
|
||||
<keyword>list\s+of</keyword>
|
||||
|
||||
<!--CONTAINS-->
|
||||
<keyword>contains</keyword>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
context list content collection integer
|
||||
context list content list of integer
|
||||
context list_high_count content integer
|
||||
|
||||
scope A:
|
||||
@ -23,10 +23,10 @@ money
|
||||
└─ Article
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_array/bad/fold_error.catala_en:5.35-5.42:
|
||||
┌─⯈ tests/test_array/bad/fold_error.catala_en:5.32-5.39:
|
||||
└─┐
|
||||
5 │ context list content collection integer
|
||||
│ ‾‾‾‾‾‾‾
|
||||
5 │ context list content list of integer
|
||||
│ ‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
Type money coming from expression:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection money
|
||||
output x content list of money
|
||||
|
||||
scope A:
|
||||
definition x equals [$0; $4 + $5; $8 * 0.65]
|
||||
@ -16,9 +16,9 @@ declaration scope B:
|
||||
|
||||
scope B:
|
||||
definition max equals maximum of (m * 2.0) for m among a.x
|
||||
or if collection empty then $0
|
||||
or if list empty then $0
|
||||
definition min equals minimum of (m + $5) for m among a.x
|
||||
or if collection empty then $20
|
||||
or if list empty then $20
|
||||
definition y equals sum money of (m + $1) for m among a.x
|
||||
definition z equals number of m among a.x such that m >= $8.95
|
||||
```
|
||||
|
@ -6,7 +6,7 @@ declaration structure S:
|
||||
data income content money
|
||||
|
||||
declaration scope A:
|
||||
context output x content collection S
|
||||
context output x content list of S
|
||||
|
||||
scope A:
|
||||
definition x equals [
|
||||
@ -23,10 +23,10 @@ declaration scope B:
|
||||
scope B:
|
||||
definition argmax equals
|
||||
(m among a.x such that m.income * 2.0 is maximum
|
||||
or if collection empty then S { -- id: -1 --income: $0 })
|
||||
or if list empty then S { -- id: -1 --income: $0 })
|
||||
definition argmin equals
|
||||
(m among a.x such that m.income + $5 is minimum
|
||||
or if collection empty then S { -- id: -1 --income: $20 })
|
||||
or if list empty then S { -- id: -1 --income: $20 })
|
||||
```
|
||||
|
||||
|
||||
|
@ -21,13 +21,13 @@ scope S:
|
||||
assertion (number of i among [1; 2; 3] such that i >= 2) = 2
|
||||
|
||||
# Extremum
|
||||
assertion maximum of [1; 2; 3] or if collection empty then 10 = 3
|
||||
assertion maximum of (decimal of i) for i among [1; 2; 3] or if collection empty then 10. = 3.
|
||||
assertion maximum of [1; 2; 3] or if list empty then 10 = 3
|
||||
assertion maximum of (decimal of i) for i among [1; 2; 3] or if list empty then 10. = 3.
|
||||
|
||||
# Arg extremum
|
||||
assertion (i among [1; 2; 3]
|
||||
such that decimal of ((2 - i) * (2 - i)) is minimum
|
||||
or if collection empty then 42)
|
||||
or if list empty then 42)
|
||||
= 2
|
||||
```
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
## Unit testing for collection concatenation.
|
||||
## Unit testing for list of concatenation.
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection integer
|
||||
output y content collection integer
|
||||
output x content list of integer
|
||||
output y content list of integer
|
||||
|
||||
scope A:
|
||||
definition x equals [0; 1; 2] ++ [3; 4; 5; 6]
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection money
|
||||
output x content list of money
|
||||
|
||||
scope A:
|
||||
definition x equals [$0; $4 + $5; $8 * 0.65]
|
||||
|
||||
declaration scope B:
|
||||
a scope A
|
||||
output y content collection money
|
||||
output y content list of money
|
||||
|
||||
scope B:
|
||||
definition y equals m among a.x such that m >= $4.95
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection money
|
||||
output x content list of money
|
||||
|
||||
scope A:
|
||||
definition x equals [$0; $4 + $5; $8 * 0.65]
|
||||
|
||||
declaration scope B:
|
||||
a scope A
|
||||
output y content collection money
|
||||
output z content collection boolean
|
||||
output y content list of money
|
||||
output z content list of boolean
|
||||
|
||||
scope B:
|
||||
definition y equals m among a.x such that m >= $4.95
|
||||
|
@ -6,7 +6,7 @@ declaration structure S:
|
||||
data income content money
|
||||
|
||||
declaration scope A:
|
||||
context output x content collection S
|
||||
context output x content list of S
|
||||
|
||||
scope A:
|
||||
definition x equals [
|
||||
@ -23,10 +23,10 @@ declaration scope B:
|
||||
scope B:
|
||||
definition argmax equals
|
||||
(m among a.x such that m.income * 2.0 is maximum
|
||||
or if collection empty then S { -- id: -1 --income: $0 })
|
||||
or if list empty then S { -- id: -1 --income: $0 })
|
||||
definition argmin equals
|
||||
(m among a.x such that m.income + $5 is minimum
|
||||
or if collection empty then S { -- id: -1 --income: $20 })
|
||||
or if list empty then S { -- id: -1 --income: $20 })
|
||||
```
|
||||
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
```catala
|
||||
declaration scope B:
|
||||
output x content collection money
|
||||
output z content collection boolean
|
||||
output x content list of money
|
||||
output z content list of boolean
|
||||
|
||||
scope B:
|
||||
definition x equals [$4; $8 ]
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection integer
|
||||
output x content list of integer
|
||||
|
||||
scope A:
|
||||
definition x equals [0; 4+5; 8*8]
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection integer
|
||||
output x content list of integer
|
||||
output w content boolean
|
||||
|
||||
scope A:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output x content collection integer
|
||||
output x content list of integer
|
||||
|
||||
scope A:
|
||||
definition x equals [0; 4; 8]
|
||||
|
@ -3,12 +3,12 @@
|
||||
|
||||
```catala
|
||||
declaration scope S:
|
||||
input x content collection integer
|
||||
input x content list of integer
|
||||
output y content integer
|
||||
|
||||
scope S:
|
||||
definition y equals
|
||||
potential_max among x such that potential_max is minimum or if collection empty then -1
|
||||
potential_max among x such that potential_max is minimum or if list empty then -1
|
||||
```
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ Invariant Dcalc__Invariants.invariant_default_no_arrow
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Lcalc -s S --avoid-exceptions -O --closure-conversion
|
||||
let scope S (S_in: S_in {x_in: collection integer}): S {y: integer} =
|
||||
let get x : collection integer = S_in.x_in in
|
||||
let scope S (S_in: S_in {x_in: list of integer}): S {y: integer} =
|
||||
let get x : list of integer = S_in.x_in in
|
||||
let set y : integer =
|
||||
match
|
||||
(handle_default_opt
|
||||
@ -72,8 +72,8 @@ with optimizations on passes.
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Lcalc -s S --closure-conversion
|
||||
let scope S (S_in: S_in {x_in: collection integer}): S {y: integer} =
|
||||
let get x : collection integer = S_in.x_in in
|
||||
let scope S (S_in: S_in {x_in: list of integer}): S {y: integer} =
|
||||
let get x : list of integer = S_in.x_in in
|
||||
let set y : integer =
|
||||
match
|
||||
(handle_default_opt
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
```catala
|
||||
declaration scope S:
|
||||
internal weights content collection money
|
||||
output result1 content collection money
|
||||
output result2 content collection money
|
||||
internal weights content list of money
|
||||
output result1 content list of money
|
||||
output result2 content list of money
|
||||
|
||||
scope S:
|
||||
definition weights equals [$4;$1;$1;$4;$1;$1]
|
||||
|
@ -4,12 +4,12 @@ Define a prototype for an external function in an ml file
|
||||
|
||||
```catala-metadata
|
||||
# Trivial algorithm that cumulates all rounding errors to the last element
|
||||
declaration prorata content collection money
|
||||
declaration prorata content list of money
|
||||
depends on amount content money,
|
||||
weights content collection money
|
||||
weights content list of money
|
||||
|
||||
# Another algorithm that distributes errors along the way
|
||||
declaration prorata2 content collection money
|
||||
declaration prorata2 content list of money
|
||||
depends on amount content money,
|
||||
weights content collection money
|
||||
weights content list of money
|
||||
```
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
internal x content collection integer
|
||||
internal x content list of integer
|
||||
output y content boolean
|
||||
|
||||
scope A:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
internal x content collection integer
|
||||
internal x content list of integer
|
||||
output y content boolean
|
||||
|
||||
scope A:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
internal x content collection integer
|
||||
internal x content list of integer
|
||||
output y content boolean
|
||||
|
||||
scope A:
|
||||
|
@ -11,6 +11,6 @@ declaration structure Structure:
|
||||
declaration scope S:
|
||||
input x content integer
|
||||
input output y content Enum
|
||||
output z content collection Structure
|
||||
output z content list of Structure
|
||||
output a content decimal
|
||||
```
|
@ -15,7 +15,7 @@ $ catala Typecheck
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ collection
|
||||
└─⯈ list
|
||||
|
||||
This expression has type decimal:
|
||||
┌─⯈ tests/test_typing/bad/err2.catala_en:10.39-10.42:
|
||||
@ -23,7 +23,7 @@ This expression has type decimal:
|
||||
10 │ definition a equals number of (z ++ 1.1) / 2
|
||||
│ ‾‾‾
|
||||
|
||||
Expected type collection coming from expression:
|
||||
Expected type list coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err2.catala_en:10.36-10.38:
|
||||
└──┐
|
||||
10 │ definition a equals number of (z ++ 1.1) / 2
|
||||
|
@ -40,9 +40,9 @@ This expression has type Enum:
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
Expected type Structure coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:14.31-14.40:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:14.28-14.37:
|
||||
└──┐
|
||||
14 │ output z content collection Structure
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
14 │ output z content list of Structure
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -11,7 +11,7 @@ declaration structure Structure:
|
||||
declaration scope S:
|
||||
input x content integer
|
||||
input output y content Enum
|
||||
output z content collection Structure
|
||||
output z content list of Structure
|
||||
output a content decimal
|
||||
```
|
||||
|
||||
@ -23,7 +23,7 @@ $ catala Typecheck --check-invariants
|
||||
|
||||
┌─⯈ tests/test_typing/good/common.catala_en:14.10-14.11:
|
||||
└──┐
|
||||
14 │ output z content collection Structure
|
||||
14 │ output z content list of Structure
|
||||
│ ‾
|
||||
[WARNING] In scope "S", the variable "a" is declared but never defined; did you forget something?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user