aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Elab.ml
diff options
context:
space:
mode:
authorjjourdan <jjourdan@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-11 21:33:18 +0000
committerjjourdan <jjourdan@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-11 21:33:18 +0000
commit3a9359e3d89f41d8003b1ea4e01254bb38ea534d (patch)
tree13260fc43131871dc7b5f18a0b50c99bf759e800 /cparser/Elab.ml
parent7cfa996a5bda25a167350c50fa0d2f173fe98721 (diff)
downloadcompcert-kvx-3a9359e3d89f41d8003b1ea4e01254bb38ea534d.tar.gz
compcert-kvx-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/Elab.ml')
-rw-r--r--cparser/Elab.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 95484b4e..f4b20613 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)