alainfrisch/sedlex — pull request #4 by sghost (2014-05-29 20:04:56+00:00)
Title: Addition of character set complement operator

This pull request adds the ability to complement given character sets by the following pattern syntax:
```ocaml
| Compl ',' -> (* ... *)
```

In order to facilitate the use of named regular expressions within the complement, I have added new syntax in the form of:
```ocaml
let char_set = [%sedlex.charset? xid_start | xid_continue]
```
This will create both a usual regular expression alias and also a character set alias, which can be used within the complement operator.

An example of usage (and motivation) is:
```ocaml
let uppercase_or_lowercase = [%sedlex.charset? uppercase | lowercase]

let rec token buf =
match%sedlex buf with
| lowercase -> print_endline "Lowercase!"; token buf
| Compl uppercase_or_lowercase -> print_endline "Not lowercase OR uppercase!"; token buf
| uppercase -> print_endline "Uppercase!"; token buf
| eof -> print_endline "EOF"
| _ -> assert false

let () =
let lexbuf = Sedlexing.Latin1.from_string "Abc::DefG" in
token lexbuf
```
This resolves #3.