correction reference et lexer
This commit is contained in:
parent
892d0bf8dc
commit
94fdab56fc
2 changed files with 11 additions and 2 deletions
|
@ -53,6 +53,8 @@ let int = '-'? (digit+ | hexa+ | bina+ | octa+)
|
||||||
(* Littéraux caractères *)
|
(* Littéraux caractères *)
|
||||||
let letter = (digit | ['A'-'Z'] | ['a'-'z'])
|
let letter = (digit | ['A'-'Z'] | ['a'-'z'])
|
||||||
|
|
||||||
|
let ascii_trop_grand = '\\' ['3'-'9']['0'-'9'](['0'-'9'])+
|
||||||
|
|
||||||
rule token = parse
|
rule token = parse
|
||||||
(** Layout *)
|
(** Layout *)
|
||||||
| newline { next_line_and token lexbuf }
|
| newline { next_line_and token lexbuf }
|
||||||
|
@ -134,6 +136,8 @@ rule token = parse
|
||||||
in CHAR (Char.chr (code)) } *)
|
in CHAR (Char.chr (code)) } *)
|
||||||
|
|
||||||
(** Lexing error *)
|
(** Lexing error *)
|
||||||
|
(* erreur qui advient pour le test 22-char-literal, le code renvoie bizarrement que "Error (during lexing) "*)
|
||||||
|
| "'" ascii_trop_grand "'" { error lexbuf None "" }
|
||||||
| _ as _c { error lexbuf None (* (Some _c) *) "unexpected character." }
|
| _ as _c { error lexbuf None (* (Some _c) *) "unexpected character." }
|
||||||
|
|
||||||
(* TODO: Gérer les imbrications de commentaires *)
|
(* TODO: Gérer les imbrications de commentaires *)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
/* TODO: Résoudre tout les shift/reduce conflits */
|
/* TODO: Résoudre tout les shift/reduce conflits */
|
||||||
|
|
||||||
%right WHILE REF DO
|
%right WHILE REF DO
|
||||||
|
|
||||||
%left FUN MATCH IF FOR
|
%left FUN MATCH IF FOR
|
||||||
%right ARROW
|
%right ARROW
|
||||||
%right SEMICOLON
|
%right SEMICOLON
|
||||||
|
@ -327,10 +326,16 @@ expression:
|
||||||
}
|
}
|
||||||
/* Sequence - Séquencement *
|
/* Sequence - Séquencement *
|
||||||
* Pas sûr, voir s'il ne faut pas une troisième couche d'expression */
|
* Pas sûr, voir s'il ne faut pas une troisième couche d'expression */
|
||||||
|
|
||||||
| e=located(simple_expression)
|
| e=located(simple_expression)
|
||||||
SEMICOLON e_list=separated_nonempty_list(SEMICOLON, located(simple_expression)) {
|
SEMICOLON e_list=separated_nonempty_list(SEMICOLON, located(simple_expression)) {
|
||||||
Sequence(e :: e_list)
|
Sequence(e :: e_list)
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
|e1=located(expression) SEMICOLON e2=located(expression){
|
||||||
|
Sequence([e1;e2])
|
||||||
|
}*/
|
||||||
|
|
||||||
/* Definition locale */
|
/* Definition locale */
|
||||||
| vd=vdefinition SEMICOLON e=located(expression) {
|
| vd=vdefinition SEMICOLON e=located(expression) {
|
||||||
Define(vd, e)
|
Define(vd, e)
|
||||||
|
@ -389,7 +394,7 @@ expression:
|
||||||
}
|
}
|
||||||
/* Reference - Allocation
|
/* Reference - Allocation
|
||||||
* ref expr */
|
* ref expr */
|
||||||
| REF e=located(expression) {
|
| REF e=located(simple_expression) {
|
||||||
Ref(e)
|
Ref(e)
|
||||||
}
|
}
|
||||||
/* Affectation
|
/* Affectation
|
||||||
|
|
Reference in a new issue