Search code examples
ocamlocamllexsedlex

Any character other than


I have defined a token for ocamllex let non_line_termination_character = [^ '\x0D' '\x0A'], which represents any character other than '\x0D' and '\x0A'.

Now, I would like to translate it to sedlex.

Does anyone know how to translate it correctly? Should I use SUB (e.g., SUB(SUB(any, '\x0D'), '\x0A') or SUB(any, ('\x0D' | '\x0A')))?


Solution

  • This corresponds to Compl as described in sedlex documentation

    Compl  ('\x0D' | '\x0A')
    

    See also the example at https://github.com/ocaml-community/sedlex/blob/master/examples/complement.ml .