124 conflitcs

This commit is contained in:
Nicolas PENELOUX 2023-10-23 17:05:28 +02:00
parent 94fdab56fc
commit bfbcc60c5d
2 changed files with 30 additions and 4 deletions

View file

@ -17,8 +17,31 @@
| None -> ""
in
error msg (lex_join lexbuf.lex_start_p lexbuf.lex_curr_p)
(*Fonction qui va convertir une string de caractère ascii en vrai caractère.
On en a besoin pour certains test *)
(*)
let recup_char charac lexbuf =
let taille = String.length charac in
match charac with
| "\\n" -> '\n'
| "\\r" -> '\r'
| "\\t" -> '\t'
| "\\\'" -> '\''
| "\\\\" -> '\\'
| _ ->
(let s2 = String.get charac 1 in
if s2 = '0' || s2 = '1' || s2 = '2' then
(let s=String.sub charac 1 (taille - 1) in
let i = int_of_string s in
Char.chr i)
else error lexbuf )
*)
}
let newline = ('\010' | '\013' | "\013\010")
let blank = [' ' '\009' '\012']
@ -130,10 +153,11 @@ rule token = parse
(* Characters *)
| "'" (letter as c) "'" { CHAR c }
(* | "'" (atom as c) "'" { (* On retire le \ du début
(*| "'" (atom as c) "'" {CHAR (recup_char c lexbuf )} (* On retire le \ du début
* TODO: fix *)
(*)
let code = int_of_string (String.sub c 1 ((String.length c) - 2))
in CHAR (Char.chr (code)) } *)
in CHAR (Char.chr (code)) } *) *)
(** Lexing error *)
(* erreur qui advient pour le test 22-char-literal, le code renvoie bizarrement que "Error (during lexing) "*)

View file

@ -22,13 +22,15 @@
/* TODO: Résoudre tout les shift/reduce conflits */
%left FUN
%left STRING
%left INT
%right WHILE REF DO
%left FUN MATCH IF FOR
%left LET MATCH IF FOR
%right ARROW
%right SEMICOLON
%left ASSIGN
%left LPAREN
%left LET