how made token of || in alex

64 Views Asked by At

I'm new at Haskell and Alex. I'm trying to make tokens of operators in Lexer.x

here is an example of my code

    \<=                           { \s -> TLE       }
    \==                           { \s -> TEQ       }
    \/=                           { \s -> TNEQ      }
    \&&                           { \s -> TAND      }

but when I wrote

    \||                           { \s -> TOR       }

I got a parse error on this line How I should make token for || ?

1

There are 1 best solutions below

0
willeM_ Van Onsem On BEST ANSWER

You can use string literals to prevent escaping all characters, so you can use:

    "||"                           { \s -> TOR       }