Search code examples
ocamllexerocamllex

OCamllex syntax error


When defining some identifiers in the definition section of my lexer (as described at here), i'm trying to write something of the form:

    let op_char = ['+' '-' '*' '/']
    let id_char = [^ ' ' '\r' '\n' '\t' op_char]

To define id_char as every char not being a blank char or an op_char. However, i get a syntax error on "op_char" on the second line. How should I write this? Thanks.


Solution

  • let id_char = [^ ' ' '\r' '\n' '\t'] # op_char
    

    See manual.