summaryrefslogtreecommitdiff
path: root/cparser
diff options
context:
space:
mode:
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Elab.ml5
-rw-r--r--cparser/Lexer.mll5
2 files changed, 7 insertions, 3 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 95484b4..f4b2061 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -222,9 +222,10 @@ let parse_next_char s pos loc =
| 'r' -> (Int64.of_int (Char.code '\r'), pos+2)
| 't' -> (Int64.of_int (Char.code '\t'), pos+2)
| 'v' -> (11L, pos+2)
- | '0'..'9' ->
+ | '0'..'7' ->
let next = ref (pos+1) in
- while !next < String.length s && s.[!next] >= '0' && s.[!next] <= '9' do
+ while !next < pos + 4 && !next < String.length s &&
+ s.[!next] >= '0' && s.[!next] <= '7' do
incr next
done;
(parse_int 8 (String.sub s (pos+1) (!next-pos-1)), !next)
diff --git a/cparser/Lexer.mll b/cparser/Lexer.mll
index 7066213..e4cb9a6 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 }