mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Now parses all new code
This commit is contained in:
parent
f22be88a5f
commit
f7308eadd0
@ -146,7 +146,7 @@ Une donnée, introduite par \inlinekw{donnée}, peut également être annotée p
|
||||
\kw{condition} droits_ouverts_majorations_allocations_familiales
|
||||
\kw{donnée} majorations_allocations_familiales \kw{contenu montant}
|
||||
|
||||
\kw{déclaration champ d'application} PrestationFamiliale:
|
||||
\kw{déclaration champ d'application} PrestationFamiliale :
|
||||
\kw{contexte} ménage \kw{structure} Ménage
|
||||
\kw{contexte} l512_3 \kw{structure} L512_3
|
||||
|
||||
|
@ -63,19 +63,22 @@ let rec lex_code lexbuf =
|
||||
| "si et seulement si" ->
|
||||
update_and_acc lexbuf;
|
||||
IFF
|
||||
| "choix" ->
|
||||
update_and_acc lexbuf;
|
||||
CHOICE
|
||||
| "situation" ->
|
||||
update_and_acc lexbuf;
|
||||
SITUATION
|
||||
| 0xE9, "tend" ->
|
||||
update_and_acc lexbuf;
|
||||
EXTENDS
|
||||
| "donn", 0xE9, "e" ->
|
||||
(* 0xE9 is é *)
|
||||
update_and_acc lexbuf;
|
||||
DATA (* TODO: Find the unicode point of é to enable donnée *)
|
||||
DATA
|
||||
| "d", 0xE9, "pend" ->
|
||||
update_and_acc lexbuf;
|
||||
DEPENDS
|
||||
| "d", 0xE9, "claration" ->
|
||||
update_and_acc lexbuf;
|
||||
DECLARATION
|
||||
| "contexte" ->
|
||||
update_and_acc lexbuf;
|
||||
CONTEXT
|
||||
| "inclus" ->
|
||||
update_and_acc lexbuf;
|
||||
INCLUDES
|
||||
| "d", 0xE9, "croissant" ->
|
||||
update_and_acc lexbuf;
|
||||
DECREASING
|
||||
@ -85,22 +88,9 @@ let rec lex_code lexbuf =
|
||||
| "de" ->
|
||||
update_and_acc lexbuf;
|
||||
OF
|
||||
| "type" ->
|
||||
update_and_acc lexbuf;
|
||||
TYPE
|
||||
| "collection" ->
|
||||
update_and_acc lexbuf;
|
||||
COLLECTION
|
||||
| "fonction" ->
|
||||
update_and_acc lexbuf;
|
||||
FUNCTION
|
||||
| "param", 0xE8, "tres" ->
|
||||
(* 0xE8 is è *)
|
||||
update_and_acc lexbuf;
|
||||
PARAMETERS
|
||||
| "renvoie" ->
|
||||
update_and_acc lexbuf;
|
||||
RETURNS
|
||||
| "entier" ->
|
||||
update_and_acc lexbuf;
|
||||
INTEGER
|
||||
@ -126,14 +116,20 @@ let rec lex_code lexbuf =
|
||||
WITH
|
||||
| "sous condition" ->
|
||||
update_and_acc lexbuf;
|
||||
CONDITION
|
||||
IF
|
||||
| "cons", 0xE9, "quence" ->
|
||||
(* 0xE9 is é *)
|
||||
update_and_acc lexbuf;
|
||||
CONSEQUENCE
|
||||
| "constante" ->
|
||||
THEN
|
||||
| "condition" ->
|
||||
update_and_acc lexbuf;
|
||||
CONSTANT
|
||||
CONDITION
|
||||
| "contenu" ->
|
||||
update_and_acc lexbuf;
|
||||
CONTENT
|
||||
| "structure" ->
|
||||
update_and_acc lexbuf;
|
||||
STRUCT
|
||||
| "optionnel" ->
|
||||
update_and_acc lexbuf;
|
||||
OPTIONAL
|
||||
@ -232,9 +228,6 @@ let rec lex_code lexbuf =
|
||||
| ',' ->
|
||||
update_and_acc lexbuf;
|
||||
COMMA
|
||||
| ';' ->
|
||||
update_and_acc lexbuf;
|
||||
SEMICOLON
|
||||
| ':' ->
|
||||
update_and_acc lexbuf;
|
||||
COLON
|
||||
@ -244,7 +237,7 @@ let rec lex_code lexbuf =
|
||||
| "--" ->
|
||||
update_and_acc lexbuf;
|
||||
ALT
|
||||
| uppercase, Star (uppercase | lowercase | '0' .. '9') ->
|
||||
| uppercase, Star (uppercase | lowercase | '0' .. '9' | '_' | '\'') ->
|
||||
update_and_acc lexbuf;
|
||||
CONSTRUCTOR (Sedlexing.Utf8.lexeme buf)
|
||||
| lowercase, Star (lowercase | uppercase | '0' .. '9' | '_' | '\'') ->
|
||||
|
@ -27,20 +27,20 @@
|
||||
%token<string> CONSTRUCTOR IDENT
|
||||
%token<string> END_CODE
|
||||
%token<int> INT_LITERAL
|
||||
%token BEGIN_CODE CHOICE
|
||||
%token COLON ALT SITUATION DATA
|
||||
%token OF SEMICOLON INTEGER TYPE COLLECTION
|
||||
%token RULE CONDITION CONSEQUENCE DEFINED_AS
|
||||
%token BEGIN_CODE
|
||||
%token COLON ALT DATA
|
||||
%token OF INTEGER COLLECTION
|
||||
%token RULE CONDITION DEFINED_AS
|
||||
%token EXISTS IN SUCH THAT NOW LESSER GREATER
|
||||
%token DOT AND OR LPAREN RPAREN OPTIONAL EQUAL
|
||||
%token COMMA CARDINAL LESSER_EQUAL GREATER_EQUAL
|
||||
%token ASSERTION FIXED BY CONSTANT YEAR
|
||||
%token ASSERTION FIXED BY YEAR
|
||||
%token PLUS MINUS MULT DIV MATCH WITH VARIES_WITH
|
||||
%token FORALL WE_HAVE INCREASING DECREASING
|
||||
%token FUNCTION PARAMETERS RETURNS NOT BOOLEAN
|
||||
%token EXTENDS
|
||||
|
||||
%token NOT BOOLEAN
|
||||
%token FIELD FILLED IFF EURO NOT_EQUAL DEFINITION
|
||||
%token STRUCT CONTENT IF THEN DEPENDS DECLARATION
|
||||
%token CONTEXT INCLUDES
|
||||
|
||||
%type <Ast.source_file> source_file
|
||||
|
||||
@ -48,26 +48,14 @@
|
||||
|
||||
%%
|
||||
|
||||
choice:
|
||||
| CONSTRUCTOR situation_type {}
|
||||
|
||||
choices:
|
||||
| ALT choice choices {}
|
||||
| {}
|
||||
|
||||
type_ident:
|
||||
typ_base:
|
||||
| IDENT {}
|
||||
| INTEGER {}
|
||||
| BOOLEAN {}
|
||||
| CONSTRUCTOR {}
|
||||
|
||||
situation_type_alt:
|
||||
| CHOICE IDENT {}
|
||||
| TYPE type_ident {}
|
||||
| SITUATION CONSTRUCTOR {}
|
||||
|
||||
situation_type:
|
||||
| OF situation_type_alt {}
|
||||
| {}
|
||||
typ:
|
||||
| typ_base option(OPTIONAL) {}
|
||||
|
||||
qident:
|
||||
| IDENT {}
|
||||
@ -161,10 +149,6 @@ forall_prefix:
|
||||
exists_prefix:
|
||||
| EXISTS IDENT IN qident SUCH THAT {}
|
||||
|
||||
quantifier_prefix:
|
||||
| forall_prefix {}
|
||||
| exists_prefix {}
|
||||
|
||||
expression:
|
||||
| exists_prefix expression {}
|
||||
| forall_prefix expression {}
|
||||
@ -172,7 +156,7 @@ expression:
|
||||
| logical_expression {}
|
||||
|
||||
condition:
|
||||
| CONDITION expression CONSEQUENCE {}
|
||||
| IF expression THEN {}
|
||||
|
||||
|
||||
rule:
|
||||
@ -195,26 +179,34 @@ assertion:
|
||||
| exists_prefix assertion {}
|
||||
| forall_prefix assertion {}
|
||||
|
||||
constant:
|
||||
| IDENT situation_type DEFINED_AS literal {}
|
||||
|
||||
func_parameter:
|
||||
| IDENT situation_type {}
|
||||
|
||||
func_parameters:
|
||||
| ALT func_parameter func_parameters {}
|
||||
| {}
|
||||
|
||||
func_def:
|
||||
| IDENT PARAMETERS func_parameters RETURNS type_ident COLON expression {}
|
||||
|
||||
application_field_item:
|
||||
| RULE option(OPTIONAL) rule {}
|
||||
| DEFINITION option(OPTIONAL) definition {}
|
||||
| ASSERTION option(condition) assertion {}
|
||||
|
||||
struct_field_base:
|
||||
| DATA IDENT option(COLLECTION) CONTENT typ {}
|
||||
| CONDITION IDENT {}
|
||||
|
||||
struct_field_func:
|
||||
| DEPENDS OF typ {}
|
||||
|
||||
struct_field:
|
||||
| struct_field_base option(struct_field_func) {}
|
||||
|
||||
field_decl_item:
|
||||
| CONTEXT IDENT STRUCT CONSTRUCTOR {}
|
||||
|
||||
field_decl_include:
|
||||
| CONSTRUCTOR DOT IDENT EQUAL IDENT {}
|
||||
|
||||
field_decl_includes:
|
||||
| INCLUDES FIELD CONSTRUCTOR CONTEXT nonempty_list(field_decl_include) {}
|
||||
|
||||
code_item:
|
||||
| FIELD CONSTRUCTOR COLON nonempty_list(application_field_item) { }
|
||||
| STRUCT CONSTRUCTOR COLON nonempty_list(struct_field) {}
|
||||
| DECLARATION FIELD CONSTRUCTOR COLON nonempty_list(field_decl_item) option(field_decl_includes) {}
|
||||
|
||||
code:
|
||||
| code_item code {}
|
||||
|
@ -1,3 +1,44 @@
|
||||
/*
|
||||
structure Enfant :
|
||||
donnée fin_obligation_scolaire contenu date
|
||||
donnée âge contenu entier
|
||||
donnée rémuneration contenu montant
|
||||
|
||||
structure Ménage :
|
||||
donnée enfants collection contenu Enfant
|
||||
donnée enfant_plus_âgé contenu Enfant optionnel
|
||||
donnée ressources contenu montant
|
||||
|
||||
structure L512_3 :
|
||||
donnée âge_limite_alinéa_2 contenu entier
|
||||
donnée plafond_rémunération_alinéa_2 contenu montant
|
||||
condition droits_ouverts_prestations_familiales
|
||||
|
||||
structure L521_1 :
|
||||
donnée allocations_familiales contenu montant
|
||||
condition droits_ouverts_allocations_familiales
|
||||
donnée allocation_forfaitaire contenu montant
|
||||
condition allocation_forfaitaire_versée
|
||||
donnée nombre_minimum_enfants contenu montant
|
||||
|
||||
structure L521_3 :
|
||||
donnée âge_limite_alinéa_1 contenu entier dépend de Enfant
|
||||
donnée minimum_alinéa_2 contenu montant
|
||||
condition droits_ouverts_majorations_allocations_familiales
|
||||
donnée majorations_allocations_familiales contenu montant
|
||||
|
||||
déclaration champ d'application PrestationFamiliale :
|
||||
contexte ménage structure Ménage
|
||||
contexte l512_3 structure L512_3
|
||||
|
||||
déclaration champ d'application AllocationsFamiliales :
|
||||
contexte ménage structure Ménage
|
||||
contexte l521_1 structure L521_1
|
||||
contexte l521_3 structure L521_3
|
||||
inclus champ d'application PrestationsFamiliales contexte
|
||||
PrestationFamiliale.ménage = ménage
|
||||
*/
|
||||
|
||||
@Article L512-3@
|
||||
Sous réserve des règles particulières à chaque prestation, ouvre droit aux prestations familiales :
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user