From 726daf228d20fae695ecf903491c8b62d9e6a673 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 20 Oct 2023 19:10:39 +0200 Subject: [PATCH] fmt2 --- flap/src/hopix/hopixParser.mly | 50 ++++++++++++++++------------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/flap/src/hopix/hopixParser.mly b/flap/src/hopix/hopixParser.mly index bda3837..e5b29d4 100644 --- a/flap/src/hopix/hopixParser.mly +++ b/flap/src/hopix/hopixParser.mly @@ -185,10 +185,10 @@ pattern_list: /********************************* DATA TYPE **********************************/ /* Pour résoudre un conflit, on a du split ty en 2 règles * - * separated_nonempty_list(STAR,located(ty)) -> ty STAR separated_nonempty_list(STAR,located(ty)) + * separated_nonempty_list(STAR, located(ty)) -> ty STAR separated_nonempty_list(STAR, located(ty)) * [ ty ] -> ty * [ ty ] * ET - * ty -> ty STAR separated_nonempty_list(STAR,located(ty)) + * ty -> ty STAR separated_nonempty_list(STAR, located(ty)) * ty -> ty * [ ty ] */ simple_ty: @@ -244,7 +244,7 @@ simple_expression: | l=located(literal) { Literal l } - /* Variable */ +/* Variable */ | i=located(identifier) { Variable(i, None) } @@ -255,7 +255,7 @@ simple_expression: Variable(i, t_list) } - /* Tuple n = 0 and n > 1 */ +/* Tuple n = 0 and n > 1 */ | LPAREN RPAREN { Tuple([]) } @@ -263,7 +263,7 @@ simple_expression: Tuple(e::e_list) } - /* Tagged Value*/ +/* Tagged Value*/ /* K */ | const=located(constructor) { Tagged(const, None, []) @@ -280,7 +280,7 @@ simple_expression: | const=located(constructor) INFERIOR t_list=option(separated_nonempty_list(COMMA, located(ty))) SUPERIOR { Tagged(const, t_list, []) } -/* K (e1,...,en) */ +/* K (e1, ..., en) */ | const=located(constructor) INFERIOR t_list=option(separated_nonempty_list(COMMA, located(ty))) SUPERIOR LPAREN e_list=separated_nonempty_list(COMMA, located(expression)) RPAREN { Tagged(const, t_list, e_list) } @@ -343,7 +343,7 @@ expression: Apply(e1, e2) } - /* TODO operation binaire mais j'ai pas très bien compris encore */ +/* TODO operation binaire mais j'ai pas très bien compris encore */ /* Match (exp) {| ...| ... | ...} */ @@ -351,13 +351,12 @@ expression: Case(e, b) } - /* TODO if ( exp ) then { expr } j'ai RIEN COMPRIS */ - /* - | IF LPAREN e=located(expression) RPAREN - THEN LBRACE e2=located(expression) RBRACE{ - IfThenElse(e,e2,None) - } -*/ +/* TODO if ( exp ) then { expr } j'ai RIEN COMPRIS */ +/* | IF LPAREN e=located(expression) RPAREN + THEN LBRACE e2=located(expression) RBRACE { + IfThenElse(e, e2, None) + } */ + /* if ( expr ) then { expr } else { expr } */ | IF LPAREN e=located(expression) RPAREN THEN LBRACE e2=located(expression) RBRACE @@ -365,15 +364,13 @@ expression: IfThenElse(e, e2, e3) } - /* Reference ref expr */ - +/* Reference ref expr */ | REF e=located(expression) { Ref(e) } -/* Affectation */ -/* expr := expr */ - +/* Affectation + * expr := expr */ | e1=located(expression) ASSIGN e2=located(expression) { Assign(e1, e2) } @@ -385,24 +382,25 @@ expression: While(e, e2) } -/* Do while TODO */ -/* do { expr } until ( expr ) */ +/* Do while + * do { expr } until ( expr ) */ +/* TODO */ -/* boucle for */ -/* for x in (e1 to e2) { expr } */ +/* boucle for + * for x in (e1 to e2) { expr } */ | FOR x=located(identifier) FROM LPAREN e1=located(expression) RPAREN TO LPAREN e2=located(expression) RPAREN LBRACE e3=located(expression) RBRACE { For(x, e1, e2, e3) } -/* Parenthésage pas sûr mais je vois pas sinon*/ +/* Parenthésage pas sûr mais je vois pas sinon */ | LPAREN e=expression RPAREN { e } -/* Annotation de type */ -/* (e : ty) */ +/* Annotation de type + * (e : ty) */ | LPAREN e=located(expression) COLON t=located(ty) RPAREN { TypeAnnotation(e, t) }