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.67 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
1 2 3
(********************************************************************)
(*                                                                  *)
(*  The Why3 Verification Platform   /   The Why3 Development Team  *)
Guillaume Melquiond's avatar
Guillaume Melquiond committed
4
(*  Copyright 2010-2018   --   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 13 14

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

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

56 57
}

Jean-Christophe Filliâtre's avatar
drivers  
Jean-Christophe Filliâtre committed
58 59 60 61 62
let space = [' ' '\t' '\r']
let alpha = ['a'-'z' 'A'-'Z' '_']
let digit = ['0'-'9']
let ident = alpha (alpha | digit | '\'')*

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

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

{
109
  let parse_file_gen parse input_lexbuf lexbuf =
110 111 112 113 114 115 116 117
    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 ->
118 119
          let dirname = Filename.dirname lexbuf.lex_curr_p.pos_fname in
          let filename = Sysutil.absolutize_filename dirname filename in
120 121 122 123 124 125 126
          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;
127
    Loc.with_location (parse multifile) lex_dumb
128 129 130

  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
131
}