Commit 4c067dcc authored by Julien Lopez's avatar Julien Lopez

Fix in lexer

parent 17b988b3
......@@ -223,10 +223,14 @@ let rec token = lexer
let s = get_stored_string () in
return_loc start (L.lexeme_end lexbuf) (STRING s)
| "'" "\\"? _ "'" ->
let s = L.utf8_lexeme lexbuf in
let s = String.make 1 (s.[String.length s - 2]) in
return lexbuf (CHAR s)
| "'" qname ->
L.rollback lexbuf;
(fun _ -> lexer
| "'" -> let start = L.lexeme_start lexbuf in
string (L.lexeme_start lexbuf) '\'' lexbuf;
let s = get_stored_string () in
return_loc start (L.lexeme_end lexbuf) (CHAR s)
| _ -> assert false) () lexbuf
| "'" ncname ->
let s = L.utf8_lexeme lexbuf in
let s = String.sub s 1 (String.length s - 1) in
return lexbuf (PTYPE s)
......@@ -273,11 +277,14 @@ and token2 = lexer
let s = get_stored_string () in
return_loc start (L.lexeme_end lexbuf) (STRING s)
| "'" [^ '\'']+ "'" ->
let s = L.utf8_lexeme lexbuf in
let s = String.sub s 1 (String.length s - 2) in
let s = unescape s (L.lexeme_start lexbuf) in
return lexbuf (STRING2 s)
| "('" qname ")" ->
L.rollback lexbuf;
(fun _ -> lexer
| "'" -> let start = L.lexeme_start lexbuf in
string (L.lexeme_start lexbuf) '\'' lexbuf;
let s = get_stored_string () in
return_loc start (L.lexeme_end lexbuf) (STRING2 s)
| _ -> assert false) () lexbuf
| "('" ncname ")" ->
let s = L.utf8_lexeme lexbuf in
let s = String.sub s 2 (String.length s - 3) in
return lexbuf (PTYPE s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment