diff options
author | jjourdan <jjourdan@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-05-11 21:33:18 +0000 |
---|---|---|
committer | jjourdan <jjourdan@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-05-11 21:33:18 +0000 |
commit | 3a9359e3d89f41d8003b1ea4e01254bb38ea534d (patch) | |
tree | 13260fc43131871dc7b5f18a0b50c99bf759e800 /cparser/Lexer.mll | |
parent | 7cfa996a5bda25a167350c50fa0d2f173fe98721 (diff) | |
download | compcert-3a9359e3d89f41d8003b1ea4e01254bb38ea534d.tar.gz compcert-3a9359e3d89f41d8003b1ea4e01254bb38ea534d.zip |
Fix string litteral parsing
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2490 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Lexer.mll')
-rw-r--r-- | cparser/Lexer.mll | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cparser/Lexer.mll b/cparser/Lexer.mll index 70662137..e4cb9a67 100644 --- a/cparser/Lexer.mll +++ b/cparser/Lexer.mll @@ -250,7 +250,7 @@ rule initial = parse match suffix with | None -> None | Some c -> Some (String.make 1 c) }, - currentLoc lexbuf)} + currentLoc lexbuf) } | hexadecimal_floating_constant { CONSTANT (Cabs.CONST_FLOAT {Cabs.isHex_FI = true; Cabs.integer_FI = intpart; @@ -313,6 +313,9 @@ rule initial = parse try Hashtbl.find lexicon id (currentLoc lexbuf) with Not_found -> VAR_NAME (id, ref VarId, currentLoc lexbuf) } | eof { EOF } + | '"' ("" | 'L') s_char* '\\' (_ as c) { + Cerrors.fatal_error "%s:%d Error:@ invalid escape sequence in string litteral %S" + lexbuf.lex_curr_p.pos_fname lexbuf.lex_curr_p.pos_lnum (Printf.sprintf "\\%c" c) } | _ as c { Cerrors.fatal_error "%s:%d Error:@ invalid symbol %C" lexbuf.lex_curr_p.pos_fname lexbuf.lex_curr_p.pos_lnum c } |