sedlex icon indicating copy to clipboard operation
sedlex copied to clipboard

Bug in examples/substraction.ml?

Open ghost opened this issue 9 years ago • 5 comments

I try to compile the code

let rec token buf =
  match%sedlex buf with
    | white_space -> print_endline "\tWhitespace"; token buf
    | Sub (Chars "ab","b") -> print_endline "a"; token buf
    | (Chars "ab"|"c") -> print_endline "abc"; token buf
    | Intersect ("d", Chars "abd") -> print_endline "d"; token buf
    | eof -> print_endline "\tEnd"
    | any -> print_endline "Other"; token buf
    | _ -> failwith "Internal failure: Reached impossible place"


let () =
  let lexbuf = Sedlexing.Utf8.from_string "a b c d e" in
  token lexbuf

And it said Sedlex: this pattern is not a valid regexp, which told me the regexp Sub (Chars "ab","b") is not valid.

ghost avatar Apr 30 '15 22:04 ghost

I can't reproduce, did you changed something ? Can you give details about your setup ?

Drup avatar May 07 '15 14:05 Drup

I also hit this problem with sedlex.1.99.2 installed from OPAM. Reproducing:

ocamlfind ocamlc -c -package sedlex -package gen substraction.ml
File "substraction.ml", line 4, characters 6-26:
Sedlex: this pattern is not a valid regexp

murmour avatar May 09 '15 03:05 murmour

I am facing the similar issue. It seems we get this issue when using packages from opam and using 'ocamlfind'.

bikallem avatar Feb 25 '16 01:02 bikallem

Yup, I can reproduce the error. Change Makefile for subtraction target to below,

subtraction$(EXE): subtraction.ml
    ocamlfind ocamlc -package gen -ppx "$HOME/.opam/4.02.3/lib/sedlex/ppx_sedlex$(EXE)" -I $HOME/.opam/4.02.3/lib/sedlex -o subtraction$(EXE) -linkpkg sedlexing.cma subtraction.ml

You get the error as below,

File "subtraction.ml", line 4, characters 6-26:
Sedlex: this pattern is not a valid regexp
Makefile:22: recipe for target 'subtraction' failed
make: *** [subtraction] Error 2

bikallem avatar Feb 25 '16 01:02 bikallem

Pretty sure it's because you are using the stable version and not the dev version.

Drup avatar Feb 25 '16 17:02 Drup

Should likely be closed.

hhugo avatar Feb 17 '23 14:02 hhugo

@toots, what do you think of closing this one ?

hhugo avatar Feb 17 '23 16:02 hhugo

Looks like it. Anyone can re-open/resubmit if it sill occurs.

toots avatar Feb 17 '23 16:02 toots