Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

driver_lexer.mll 3.81 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
1 2 3
(********************************************************************)
(*                                                                  *)
(*  The Why3 Verification Platform   /   The Why3 Development Team  *)
4
(*  Copyright 2010-2015   --   INRIA - CNRS - Paris-Sud University  *)
Andrei Paskevich's avatar
Andrei Paskevich committed
5 6 7 8 9 10
(*                                                                  *)
(*  This software is distributed under the terms of the GNU Lesser  *)
(*  General Public License version 2.1, with the special exception  *)
(*  on linking described in file LICENSE.                           *)
(*                                                                  *)
(********************************************************************)
11 12

{
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
13
  open Format
14 15
  open Lexing
  open Driver_parser
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
16

17 18 19 20 21 22
  exception IllegalCharacter of char

  let () = Exn_printer.register (fun fmt e -> match e with
    | IllegalCharacter c -> fprintf fmt "illegal character %c" c
    | _ -> raise e)

Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
23
  let keywords = Hashtbl.create 97
24 25
  let () =
    List.iter
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
26 27
      (fun (x,y) -> Hashtbl.add keywords x y)
      [ "theory", THEORY;
28 29
        "end", END;
        "syntax", SYNTAX;
30
        "overriding", OVERRIDING;
31 32 33 34
        "remove", REMOVE;
        "meta", META;
        "prelude", PRELUDE;
        "printer", PRINTER;
35
	"steps", STEPS;
36
	"model_parser", MODEL_PARSER;
37 38
        "valid", VALID;
        "invalid", INVALID;
39
        "timeout", TIMEOUT;
40
        "outofmemory", OUTOFMEMORY;
41
        "steplimitexceeded", STEPLIMITEXCEEDED;
42
        "time",    TIME;
43 44
        "unknown", UNKNOWN;
        "fail", FAIL;
45
        "constant", CONSTANT;
46 47
        "function", FUNCTION;
        "predicate", PREDICATE;
48 49
        "type", TYPE;
        "prop", PROP;
50
        "filename", FILENAME;
51
        "transformation", TRANSFORM;
52 53 54 55 56 57
        "plugin", PLUGIN;
        "blacklist", BLACKLIST;
        (* WhyML *)
        "module", MODULE;
        "exception", EXCEPTION;
        "val", VAL;
58
        "converter", CONVERTER;
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
59 60
      ]

61 62
}

Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
63 64 65 66 67
let space = [' ' '\t' '\r']
let alpha = ['a'-'z' 'A'-'Z' '_']
let digit = ['0'-'9']
let ident = alpha (alpha | digit | '\'')*

68 69 70
let op_char = ['=' '<' '>' '~' '+' '-' '*' '/' '%'
               '!' '$' '&' '?' '@' '^' '.' ':' '|' '#']

71
rule token = parse
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
72
  | '\n'
73
      { Lexlib.newline lexbuf; token lexbuf }
74
  | space+
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
75
      { token lexbuf }
76 77
  | "(*)"
      { LEFTPAR_STAR_RIGHTPAR }
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
78
  | "(*"
79
      { Lexlib.comment lexbuf; token lexbuf }
80
  | '_'
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
81 82 83
      { UNDERSCORE }
  | ident as id
      { try Hashtbl.find keywords id with Not_found -> IDENT id }
84 85
  | digit+ as i
      { INTEGER (int_of_string i) }
86 87 88 89 90 91
  | "<-"
      { LARROW }
  | "["
      { LEFTSQ }
  | "]"
      { RIGHTSQ }
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
92 93 94 95 96 97
  | "("
      { LEFTPAR }
  | ")"
      { RIGHTPAR }
  | "."
      { DOT }
98 99
  | ","
      { COMMA }
100 101
  | "'"
      { QUOTE }
102 103
  | op_char+ as op
      { OPERATOR op }
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
104
  | "\""
105
      { STRING (Lexlib.string lexbuf) }
106
  | "import" space*  "\""
107
      { INPUT (Lexlib.string lexbuf) }
108
  | eof
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
109 110
      { EOF }
  | _ as c
111
      { raise (IllegalCharacter c) }
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
112 113

{
114
  let parse_file_gen parse input_lexbuf lexbuf =
115 116 117 118 119 120 121 122
    let s = Stack.create () in
    Stack.push lexbuf s;
    let rec multifile lex_dumb =
      let lexbuf = Stack.top s in
      let tok = token lexbuf in
      Loc.transfer_loc lexbuf lex_dumb;
      match tok with
        | INPUT filename ->
123 124
          let dirname = Filename.dirname lexbuf.lex_curr_p.pos_fname in
          let filename = Sysutil.absolutize_filename dirname filename in
125 126 127 128 129 130 131
          Stack.push (input_lexbuf filename) s;
          multifile lex_dumb
        | EOF -> ignore (Stack.pop s);
          if Stack.is_empty s then EOF else multifile lex_dumb
        | _ -> tok in
    let lex_dumb = Lexing.from_function (fun _ _ -> assert false) in
    Loc.transfer_loc lexbuf lex_dumb;
132
    Loc.with_location (parse multifile) lex_dumb
133 134 135

  let parse_file = parse_file_gen Driver_parser.file
  let parse_file_extract = parse_file_gen Driver_parser.file_extract
Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
136
}