Project

General

Profile

« Previous | Next » 

Revision 050147ec

Added by Christophe Garion almost 7 years ago

json-parser: correct parser for regex for real variables with e|E

View differences:

src/tools/stateflow/json-parser/json_parser.ml
111 111
  and parse_real_value s =
112 112
    Logs.debug (fun m -> m "parse_real_value %s" s);
113 113
    let real_regexp_simp = regexp "\\(-?[0-9][0-9]*\\)\\.\\([0-9]*\\)" in
114
    let real_regexp_e    = regexp "\\(-?[0-9][0-9]*\\)\\.\\([0-9]*\\)(E|e)\\((\\+|\\-)[0-9][0-9]*\\)" in
114
    let real_regexp_e    = regexp "\\(-?[0-9][0-9]*\\)\\.\\([0-9]*\\)\\(E\\|e\\)\\(\\(\\+\\|\\-\\)[0-9][0-9]*\\)" in
115 115
    if string_match real_regexp_e s 0 then
116 116
      let l = matched_group 1 s in
117 117
      let r = matched_group 2 s in
118
      let e = matched_group 3 s in
118
      let e = matched_group 4 s in
119 119
      Const_real (Num.num_of_string (l ^ r),
120
                  String.length r + -1 * int_of_string e,
120
                  String.length r + (-1 * int_of_string e),
121 121
                  s)
122 122
    else
123 123
    if string_match real_regexp_simp s 0 then

Also available in: Unified diff