aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Parse.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2015-10-01 17:19:45 +0200
committerBernhard Schommer <bschommer@users.noreply.github.com>2015-10-01 17:19:45 +0200
commita594de0f1c15b71a423d2cfc51a5c603796deafa (patch)
tree50053d3348d6976ef77f4b38c62c6cbb07083318 /cparser/Parse.ml
parentefd453afac8fcfb741f06166af0379ec8178650f (diff)
parent504228b1f7b875550eae9e3782a5f2c1033b0233 (diff)
downloadcompcert-kvx-a594de0f1c15b71a423d2cfc51a5c603796deafa.tar.gz
compcert-kvx-a594de0f1c15b71a423d2cfc51a5c603796deafa.zip
Merge pull request #57 from jhjourdan/parser_fix
Correction of a few bugs in the pre-parser, added comments.
Diffstat (limited to 'cparser/Parse.ml')
-rw-r--r--cparser/Parse.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/cparser/Parse.ml b/cparser/Parse.ml
index 2be3a612..cfa95688 100644
--- a/cparser/Parse.ml
+++ b/cparser/Parse.ml
@@ -44,12 +44,16 @@ let preprocessed_file transfs name sourcefile =
let p =
try
let t = parse_transformations transfs in
- let lb = Lexer.init name ic in
let rec inf = Datatypes.S inf in
let ast : Cabs.definition list =
Obj.magic
- (match Timing.time2 "Parsing"
- Parser.translation_unit_file inf (Lexer.tokens_stream lb) with
+ (match Timing.time "Parsing"
+ (* The call to Lexer.tokens_stream results in the pre
+ parsing of the entire file. This is non-negligeabe,
+ so we cannot use Timing.time2 *)
+ (fun () ->
+ Parser.translation_unit_file inf (Lexer.tokens_stream name ic)) ()
+ with
| Parser.Parser.Inter.Fail_pr ->
(* Theoretically impossible : implies inconsistencies
between grammars. *)